Skip to Content
FAQs

FAQs

Common questions developers have about using nodebuilder-xd, its CLI, and its generated templates.


General

How do I create a new project with nodebuilder-xd?

Run the CLI directly using npx:

npx nodebuilder-xd

You’ll be prompted for:

  • Project name
  • Template type (Basic, REST API, or Socket)
  • Whether to include CRUD modules

After generation, follow the next steps:

cd my-app npm install npm run dev

How do I change the default template?

You can choose a template during the CLI prompt, or edit the generated files manually later. If you want to make a new default, open src/config/templates.js and reorder or modify the entries.


How can I add my own custom template?

  1. Create a new folder under backend/templates/ (e.g., express-graphql).

  2. Add all necessary files: server.js, src/app.js, package.json, etc.

  3. Register it in templates.js:

    { name: "GraphQL API", path: path.join(__dirname, "../../templates/express-graphql") }
  4. Run npx nodebuilder-xd and select your new template from the list.


How do CRUD files get removed?

nodebuilder-xd removes CRUD-related files and route references using markers in app.js:

// ROUTE_IMPORTS_START // ROUTE_IMPORTS_END // ROUTE_USES_START // ROUTE_USES_END

When you select “No CRUD” during setup, these files are deleted:

  • src/models/*.model.js
  • src/controllers/*.controller.js
  • src/routes/*.route.js

…and their imports and uses are stripped automatically.


Why are my CRUD routes missing?

If you selected “No CRUD” during CLI setup, the example CRUD files were removed intentionally. To restore them, either:

  • Re-run the CLI and include CRUD, or
  • Copy CRUD modules manually from the template folder.

Can I use TypeScript with nodebuilder-xd?

Currently, templates are JavaScript-based, but the structure is TS-friendly. A future update will include:

--typescript

flag support for generating .ts files.


Configuration & Environment

Where do I configure environment variables?

Each template includes a .env.example file. Copy it and rename to .env, then adjust values like:

PORT=5000 DB_URL=mongodb://localhost:27017/mydb

Your app automatically loads these via dotenv in server.js.


How do I change the default port?

Open server.js in your generated project and modify:

const PORT = process.env.PORT || 5000;

Then update .env accordingly.


Can I use nodebuilder-xd inside an existing project?

You can, but it’s not recommended. The CLI assumes it’s creating a new folder. If you must, use:

npx nodebuilder-xd .

and it’ll scaffold into the current directory.


Troubleshooting

I see “Folder already exists” error

nodebuilder-xd won’t overwrite existing directories to avoid data loss. Either:

cd existing-folder && npx nodebuilder-xd .

or create a new one:

npx nodebuilder-xd my-new-app

removeCrudReferences didn’t clean my app.js file

Make sure your app.js includes both comment markers:

// ROUTE_IMPORTS_START // ROUTE_IMPORTS_END // ROUTE_USES_START // ROUTE_USES_END

The regex-based remover depends on these comments.


Why does placeholder replacement not work everywhere?

By default, only occurrences of project-name inside package.json are replaced. Future updates will support:

{{projectName}}, {{author}}, {{version}}

for broader replacement coverage.


How do I update nodebuilder-xd?

If globally installed:

npm update -g nodebuilder-xd

Or if using via npx, it always fetches the latest published version.


Miscellaneous

Where are templates stored?

Templates live inside the CLI package itself, under:

backend/templates/

Each template folder is a complete Node.js project with its own dependencies.


Can I deploy generated projects directly?

Yes — each generated project is a self-contained Node.js app. You can deploy it to:

  • Render
  • Railway
  • Vercel (with Node adapter)
  • Any VPS (via PM2)

Will nodebuilder-xd support monorepo setup?

Planned for future versions. A --monorepo flag will scaffold independent services (auth, API, socket) under one root.

💬 Still stuck?

If you hit issues not covered here, open a discussion or issue on GitHub .


Last updated on