A clean and minimal boilerplate for building scalable Express.js servers with TypeScript, Prisma ORM, and PostgreSQL following the Modular MVC pattern.
- TypeScript for type safety
- Express 5 modular MVC structure
- Prisma ORM with PostgreSQL
- JWT Authentication ready
- Bcrypt for password hashing
- Centralized error handling with
http-status-codes - Supports npm, yarn, pnpm, and bun
demo-prisma-mvc-express/
├── prisma/
│ └── schema.prisma # Prisma schema
├── src/
│ ├── config/ # Configs (db, env)
│ ├── modules/ # Features (user, auth, etc.)
│ │ └── user/
│ │ ├── user.controller.ts
│ │ ├── user.service.ts
│ │ ├── user.route.ts
│ │ └── user.model.ts
│ ├── utils/ # Helpers
│ ├── app.ts # Express app setup
│ └── server.ts # Server entry point
├── .env # Env vars (DATABASE_URL, JWT_SECRET)
├── package.json
└── tsconfig.jsonClone the repository:
git clone https://github.com/Sarwarhridoy4/demo-prisma-mvc-express.git
cd demo-prisma-mvc-expressChoose your preferred package manager:
npm install
npm run devyarn
yarn devpnpm install
pnpm devbun install
bun run devCreate a .env file in the root directory:
DATABASE_URL="postgresql://USER:PASSWORD@localhost:5432/demo_db?schema=public"
JWT_SECRET="supersecretkey"
PORT=5000- Generate Prisma Client:
npx prisma generate- Run migrations:
npx prisma migrate dev --name init- Open Prisma Studio (DB GUI):
npx prisma studionpm run dev
# or
yarn dev
# or
pnpm dev
# or
bun run devnpm run build && npm start
# or
yarn build && yarn start
# or
pnpm build && pnpm start
# or
bun build && bun startcurl -X POST http://localhost:5000/api/v1/user \
-H "Content-Type: application/json" \
-d '{
"name": "John Doe",
"email": "john@example.com",
"phone:"+8801xxxxxxxxx",
"password": "123456"
}'curl http://localhost:5000/api/v1/user- Passwords hashed with
bcryptjs - JWT-based authentication
- Centralized error handling
"scripts": {
"dev": "ts-node-dev --respawn --transpile-only src/server.ts",
"build": "tsc -p .",
"start": "node dist/server.js",
"prisma:migrate": "prisma migrate dev --name init",
"prisma:studio": "prisma studio"
}- Add more modules (auth, wallet, transactions)
- Implement request validation (e.g.,
zodorjoi) - Add logging (e.g.,
winstonorpino) - Dockerize for deployment
MIT © Sarwar Hossain