create-nepbs
v1.0.5
Published
NEPBS - Node Express Prisma Backend Server generator for JavaScript and TypeScript.
Maintainers
Readme
NEPBS
Node Express Prisma Backend Server
NEPBS is an interactive command-line generator for creating a ready-to-use Node.js, Express, and Prisma backend. It helps you start a new backend project with TypeScript or JavaScript, a supported database, Prisma configuration, environment files, validation utilities, and a clean source structure.
NEPBS is a starter generator, not a complete application. It does not create authentication routes, CRUD modules, payment logic, or application-specific business rules automatically.
- npm package: create-nepbs
- GitHub repository: Asadul1120/create-nepbs
- License: MIT
- Current package version:
1.0.5
Contents
- Features
- Quick start
- Requirements
- How the generator works
- Choose a language
- Choose a database
- Choose a Prisma profile
- Generated project structure
- Configure environment variables
- Initialize the database
- Available npm scripts
- Packages installed
- Request validation with Zod
- Included utilities
- Adding your own modules
- Run and build the API
- Project name rules
- Global installation
- Repository development
- Troubleshooting
- Security checklist
- What NEPBS does not generate
- Useful links
Features
- Interactive TypeScript or JavaScript selection
- Support for PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, CockroachDB, and MongoDB
- Prisma 6.19 compatibility profile
- Prisma 7 profile with database adapters and drivers
- Prisma 8 contract-based profile for PostgreSQL and MongoDB
- Express application starter with
/api/v1health endpoint - Zod request validation middleware and starter user schema
- Environment configuration with
dotenv - CORS and cookie parsing middleware
- JWT and bcrypt helper utilities
- Global error handling and not-found handling
- Automatic dependency installation
- Automatic Prisma client or contract artifact generation
- Generated project build verification
- Exact resolved direct dependency versions saved to
package.jsonandpackage-lock.json
Quick start
Run the generator with npx:
npx create-nepbs my-apiNEPBS will ask you to choose a language, database, and compatible Prisma profile. After you answer, it will:
- Create the project directory.
- Copy the selected language template.
- Generate the Prisma files for your selected profile.
- Create
.envand.env.examplefiles. - Generate a project-specific
package.json. - Install the required packages.
- Generate Prisma client or contract artifacts.
- Build/check the generated project.
Then enter the project:
cd my-apiReview and update .env. For a relational database, create the initial migration:
npm run prisma:migrate -- --name initFinally, start the development server:
npm run devThe starter endpoint is available at:
http://localhost:5000/api/v1Expected response:
{
"success": true,
"message": "API is running"
}Requirements
- Node.js: major version
19through24 - npm: included with Node.js
- An empty or not-yet-created target folder
- A database server or hosted database for the selected database
Check your local versions:
node --version
npm --versionFor production, use a currently supported Node.js LTS release.
Node.js and Prisma compatibility
NEPBS checks your Node.js version before generating a project.
- Prisma 7 is offered for Node
20.19+,22.12+, and24.x. - Prisma 8 is offered for Node
22.18+or24.11+. - Older supported runtime combinations may use the Prisma
6.19compatibility profile. - Odd-numbered Node.js releases such as
19,21, and23are accepted within the supported range, but NEPBS displays a warning because they are not recommended Prisma production runtimes.
Unsupported Node.js versions are rejected before project creation.
How the generator works
The generator follows this workflow:
npx create-nepbs my-api
|
v
Choose a language
|
v
Choose a database
|
v
Choose a compatible Prisma profile
|
v
Create project files
|
v
Install dependencies
|
v
Generate Prisma artifacts
|
v
Build and verify the projectLanguage prompt
Choose your language:
1. TypeScript
2. JavaScript
Enter your choice [1]:Press Enter to select TypeScript, or enter 2 for JavaScript.
Database prompt
Choose your database:
1. PostgreSQL
2. MySQL
3. MariaDB
4. SQLite
5. SQL Server
6. CockroachDB
7. MongoDB
Enter your choice [1]:Press Enter to select PostgreSQL.
Prisma prompt
The Prisma list depends on your selected database and Node.js version. Unsupported combinations are not shown. The first available option is selected when you press Enter.
Choose a language
TypeScript
The TypeScript template uses:
- ES modules
- Strict TypeScript
- NodeNext module resolution
tsxfor developmenttscfor builds- Explicit module extensions for Node.js ESM compatibility
Example import:
import app from "./app.js";JavaScript
The JavaScript template uses:
- ES modules
- JavaScript source files
- Node.js watch mode for development
- The same core folders and starter utilities as the TypeScript template
Example import:
import express from "express";Choose a database
| Choice | Prisma provider | Notes |
| --- | --- | --- |
| PostgreSQL | postgresql | Default choice |
| MySQL | mysql | Uses MySQL connector and driver |
| MariaDB | mysql | Uses Prisma's MySQL connector |
| SQLite | sqlite | Uses a local database file by default |
| SQL Server | sqlserver | Microsoft SQL Server |
| CockroachDB | cockroachdb | PostgreSQL-compatible adapter setup |
| MongoDB | mongodb | Uses Prisma 6.19 compatibility or Prisma 8 |
Hosted database services can be used when they provide a compatible connection string. Put the connection string in .env as DATABASE_URL.
Choose a Prisma profile
| Profile | Databases offered by NEPBS | Node.js requirement |
| --- | --- | --- |
| Prisma 7 | PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, CockroachDB | Node 20.19+, 22.12+, or 24.x |
| Prisma 8 / Latest | PostgreSQL and MongoDB | Node 22.18+ or 24.11+ |
| Prisma 6.19 compatibility | MongoDB and combinations where Prisma 7 is unavailable | Available on other supported Node.js versions |
Prisma 7 does not support MongoDB. For MongoDB, NEPBS offers Prisma 6.19 compatibility or Prisma 8 when the runtime supports it.
The Prisma 8 profile is currently treated by this project as a release-candidate/early-access setup. Prisma 8 uses different packages, contract files, and commands from Prisma 6 and Prisma 7. Review the current Prisma release status before using it in production.
The Latest option currently resolves to the Prisma 8 toolchain. Because latest follows the npm registry, the resolved package versions may change over time. NEPBS records the resolved direct dependency versions after installation.
Generated project structure
A generated project has a structure similar to this:
my-api/
├── src/
│ ├── modules/ # Application modules and features
│ ├── middleware/ # Validation and error middleware
│ ├── utils/ # Reusable helpers
│ ├── validations/ # Zod schemas
│ ├── config/ # Environment configuration
│ ├── lib/
│ │ └── prisma.ts or prisma.js
│ ├── app.ts or app.js # Express app and middleware
│ ├── server.ts or server.js # Database connection and HTTP server
│ └── index.ts or index.js # Application entry point
├── prisma/
│ └── schema.prisma # Prisma 6/7 profiles
├── src/prisma/
│ └── contract.prisma # Prisma 8 profile
├── .env
├── .env.example
├── .gitignore
├── package.json
├── package-lock.json
├── tsconfig.json # TypeScript projects/profiles
└── README.mdThe Prisma folders are profile-specific:
- Prisma 6 and Prisma 7 use
prisma/schema.prisma. - Prisma 7 also generates
prisma.config.tsand the client undersrc/generated/prisma/. - Prisma 8 uses
src/prisma/contract.prisma,prisma.config.ts, and generated contract artifacts undersrc/prisma/.
NEPBS creates src/modules/ for your own features. It does not generate authentication routes or CRUD endpoints by default.
Configure environment variables
NEPBS generates .env and .env.example with starter values:
NODE_ENV=development
PORT=5000
DATABASE_URL="postgresql://postgres:your_password@localhost:5432/your_database?schema=public"
FRONTEND_URL=http://localhost:5173
BACKEND_URL=http://localhost:5000
BCRYPT_SALT_ROUNDS=12
JWT_ACCESS_SECRET=your_access_secret_key
JWT_REFRESH_SECRET=your_refresh_secret_key
JWT_ACCESS_EXPIRES_IN=15m
JWT_REFRESH_EXPIRES_IN=7dReplace the sample values before using the project with a real database:
DATABASE_URL- Database name, username, and password
JWT_ACCESS_SECRETJWT_REFRESH_SECRETFRONTEND_URL, if your frontend runs elsewherePORT, if port5000is already in use
Never commit real credentials or secrets to Git.
Database URL examples
PostgreSQL:
DATABASE_URL="postgresql://username:password@localhost:5432/my_database?schema=public"MySQL or MariaDB:
DATABASE_URL="mysql://username:password@localhost:3306/database_name"SQLite:
DATABASE_URL="file:./prisma/dev.db"SQL Server:
DATABASE_URL="sqlserver://localhost:1433;database=database_name;user=sa;password=YourPassword;encrypt=true;trustServerCertificate=true"CockroachDB:
DATABASE_URL="postgresql://username:password@localhost:26257/database_name?sslmode=require"MongoDB:
DATABASE_URL="mongodb://localhost:27017/database_name".env and .env.example
.envcontains local secrets and real connection values. It should not be committed..env.exampledocuments the required variables without containing real credentials.
Initialize the database
Always update DATABASE_URL before running database commands.
Prisma 6.19 or Prisma 7 with a relational database
Create and apply the initial development migration:
npm run prisma:migrate -- --name initThis applies to PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, and CockroachDB.
For later schema changes:
npm run prisma:migrate -- --name add-profile-modelPrisma 6.19 with MongoDB
MongoDB uses schema push instead of Prisma Migrate:
npm run prisma:pushPrisma 8
Initialize the Prisma 8 contract and database:
npm run prisma:generate
npm run prisma:initFor later contract changes:
npm run prisma:generate
npm run prisma:plan -- --name add-profile-model
npm run prisma:migratePrisma 8 does not use the Prisma 6/7 prisma migrate dev workflow.
Available npm scripts
Common scripts
| Script | Purpose |
| --- | --- |
| npm run dev | Start the development server with file watching |
| npm run build | Compile TypeScript or check JavaScript source syntax |
| npm run start | Start the production entry point |
| npm run prisma:generate | Generate the Prisma client or Prisma 8 contract artifacts |
Prisma 6 and Prisma 7 scripts
| Script | Purpose |
| --- | --- |
| npm run prisma:migrate -- --name init | Create and apply a development migration for relational databases |
| npm run prisma:push | Push the schema without creating migration files |
| npm run prisma:studio | Open Prisma Studio |
For the Prisma 6 MongoDB profile, the prisma:migrate script is mapped to prisma db push.
Prisma 8 scripts
| Script | Purpose |
| --- | --- |
| npm run prisma:init | Initialize the selected Prisma 8 database |
| npm run prisma:plan -- --name add-model | Create a Prisma 8 migration plan |
| npm run prisma:migrate | Apply the Prisma 8 migration workflow |
Packages installed
Every generated project includes these core runtime packages:
| Package | Purpose |
| --- | --- |
| express | HTTP server and routing |
| dotenv | Loads environment variables from .env |
| cors | Configures cross-origin requests |
| cookie-parser | Reads cookies from incoming requests |
| jsonwebtoken | Creates and verifies JWTs |
| bcryptjs | Hashes and compares passwords |
| zod | Validates request data |
| http-status-codes | Provides readable HTTP status codes |
Default TypeScript + PostgreSQL + Prisma 7 setup
For a modern compatible Node.js runtime, the common default selection is TypeScript, PostgreSQL, and Prisma 7. Its direct runtime dependencies are generally:
express
dotenv
cors
cookie-parser
jsonwebtoken
bcryptjs
zod
http-status-codes
prisma@7
@prisma/client@7
@prisma/adapter-pg
pgIts TypeScript development dependencies generally include:
typescript
tsx
@types/node
@types/express
@types/cookie-parser
@types/jsonwebtoken
@types/cors
@types/bcryptjs
@types/pgThe exact resolved versions are written to package.json and package-lock.json during generation.
Prisma 6.19 packages
The Prisma 6.19 profile includes:
[email protected]
@prisma/[email protected]It does not use the Prisma 7 database adapter packages. TypeScript projects also receive TypeScript tooling and relevant type packages.
Prisma 7 database packages
Prisma 7 adds a database adapter and driver according to the selected database:
| Database | Additional runtime packages |
| --- | --- |
| PostgreSQL | @prisma/adapter-pg, pg |
| CockroachDB | @prisma/adapter-pg, pg |
| MySQL | @prisma/adapter-mariadb, mariadb |
| MariaDB | @prisma/adapter-mariadb, mariadb |
| SQLite | @prisma/adapter-better-sqlite3, better-sqlite3 |
| SQL Server | @prisma/adapter-mssql, mssql |
| MongoDB | Not available in the Prisma 7 profile |
TypeScript projects may also receive:
@types/pgfor PostgreSQL and CockroachDB@types/better-sqlite3for SQLite@types/mssqlfor SQL Server
JavaScript projects using Prisma 7 may still receive TypeScript tooling because Prisma 7 generates TypeScript client files.
Prisma 8 packages
Prisma 8 uses database-specific ORM packages instead of @prisma/client:
- PostgreSQL:
@prisma/orm-postgres - MongoDB:
@prisma/orm-mongo - MongoDB also includes
mongodb@7 - The Prisma CLI is provided by
prisma
Packages not installed by default
NEPBS does not install optional tools such as:
helmetmorganeslintprettierhuskyswaggernodemon
Add them later if your project requires them:
npm install helmet morgan
npm install -D eslint prettierRequest validation with Zod
Both templates include a reusable validation middleware and a starter user schema.
Example schema:
import { z } from "zod";
export const createUserSchema = z.object({
email: z.string().email(),
password: z.string().min(8),
});Use the schema in a route:
import { Router } from "express";
import { validateRequest } from "../middleware/validateRequest.js";
import { createUserSchema } from "../validations/user.schema.js";
const router = Router();
router.post(
"/users",
validateRequest(createUserSchema),
(req, res) => {
res.status(201).json({
success: true,
data: req.body,
});
},
);
export default router;When validation succeeds, the parsed data is assigned to req.body. When validation fails, the middleware sends the error to the global error handler with a 400 status.
Included utilities
The generated project includes:
- Express app, server, and
/api/v1starter endpoint - Prisma client setup for the selected database and profile
- Zod request validation middleware
- Starter user validation schema
- Environment variable loading
- CORS configuration
- Cookie parsing
- JWT token creation and verification helpers
- bcrypt password hashing and comparison helpers
- Async error wrapper
- Custom application error class
- API response helper
- Global error handler
- Not-found handler
These utilities are foundations for your application. They do not replace a complete authentication or authorization system.
Adding your own modules
Keep feature code inside src/modules/. A typical feature can use this structure:
src/modules/user/
├── user.route.ts
├── user.controller.ts
├── user.service.ts
├── user.validation.ts
└── user.interface.tsRecommended responsibilities:
- Route: Defines the URL and connects middleware.
- Controller: Reads the request and sends the response.
- Service: Contains business logic.
- Validation: Checks incoming data.
- Prisma/database layer: Reads and writes database data.
Register your router in src/app.ts or src/app.js:
import userRouter from "./modules/user/user.route.js";
app.use("/api/v1/users", userRouter);Keeping routes, controllers, services, and validation separate makes the project easier to maintain as it grows.
Run and build the API
Start development mode:
npm run devBuild the project:
npm run buildStart the production entry point:
npm run startFor production, update the environment values, run the required database migrations, set NODE_ENV=production, and use a secure database connection.
Project name rules
The project name:
- Must not be empty.
- Must not contain spaces.
- Must not start with
.or-. - May contain letters, numbers, dots, hyphens, and underscores.
- Must point to a new folder or an empty existing folder.
Valid examples:
npx create-nepbs my-api
npx create-nepbs blog_api
npx create-nepbs backend.v2
npx create-nepbs shop-backend-2026NEPBS refuses to overwrite a non-empty folder.
Global installation
A global installation is not required. The recommended approach is npx:
npx create-nepbs my-appIf you prefer a global installation:
npm install -g create-nepbs
create-nepbs my-appRepository development
This repository is the CLI generator itself, not a generated backend project.
Source structure
src/
├── index.ts
├── commands/create.ts
├── types.ts
└── utils/
├── ask-database.ts
├── ask-language.ts
├── ask-prisma-version.ts
├── create-project.ts
├── install-packages.ts
├── node-profile.ts
├── package-list.ts
├── project-name.ts
├── render-files.ts
└── run-command.tsInstall repository dependencies
npm ciBuild the CLI
npm run buildThis compiles the CLI into dist/ and makes dist/index.js executable.
Run all checks
npm run checkThe check command verifies the CLI TypeScript source, checks the TypeScript template, and runs node --check against important JavaScript template files.
Test the local CLI
After building:
node dist/index.js my-apiThe CLI package itself uses commander at runtime. Its package dependencies are separate from the dependencies installed into a generated backend project.
Troubleshooting
Unsupported Node.js version
Check your version:
node --versionUse Node.js 19 through 24. Some Prisma profiles require a newer minor version, so NEPBS may show only the compatible profiles.
Target folder already has files
Choose a different project name or use an empty folder. NEPBS does not replace files in a non-empty folder.
npm install fails
Check that:
- Your internet connection is working.
- npm can reach the registry.
- Your Node.js version is supported.
- A proxy or firewall is not blocking package downloads.
After fixing the problem, run this inside the generated project:
npm installDatabase connection errors
Verify that:
- The database server is running.
- The database exists when required.
- The username and password are correct.
- The host and port are correct.
DATABASE_URLuses the correct protocol.- Hosted databases have the required SSL options.
Prisma client is missing
Generate the client or contract artifacts:
npm run prisma:generateThen build again:
npm run buildMigration errors
For relational databases:
npm run prisma:migrate -- --name initFor MongoDB with Prisma 6.19:
npm run prisma:pushFor Prisma 8, use its contract workflow instead of the Prisma 6/7 migration command.
Port is already in use
Change the port in .env:
PORT=5001Then restart the server.
Security checklist
Before deploying to production:
- Keep real secrets in
.envand never commit them. - Use long, random JWT secrets.
- Store hashed passwords, never plain-text passwords.
- Restrict CORS to your actual frontend origin.
- Validate all untrusted input.
- Enforce authorization on the server.
- Do not expose stack traces in production responses.
- Add rate limiting and security headers as needed.
- Review database migrations before applying them to production.
- Audit dependencies regularly:
npm audit
npm outdatedWhat NEPBS does not generate
NEPBS intentionally does not generate the following application-specific features:
- Login and registration endpoints
- Complete authentication middleware
- User CRUD operations
- Roles and permissions
- Pagination, filtering, or search
- File uploads
- Payment integration
- Swagger/OpenAPI documentation
- Automated tests
- Docker configuration
- Deployment configuration
Add these features according to your application requirements.
Installation behavior
NEPBS prepares the generated package.json, runs one npm install pass, resolves the required direct dependency versions, writes those versions to package.json and package-lock.json, generates Prisma artifacts, and runs the generated project's build check.
Installation time depends on your network, npm registry access, selected database, and selected Prisma profile.
Useful links
- NEPBS on npm
- NEPBS on GitHub
- Prisma ORM release status
- Prisma ORM supported databases
- Node.js previous releases
npx create-nepbs my-app