Create your first project
This guide walks you through creating a complete Node.js API with Express, PostgreSQL, and Drizzle ORM, including JWT authentication.Enter project name
When prompted, enter your project name:
The CLI creates a directory with this name in your current location. If the directory already exists, you’ll be asked whether to overwrite it.
Select framework
Choose your preferred Node.js framework:Currently, Express is the primary option with Fastify support in development.
Select ORM
Choose your ORM based on the database you selected:
If you selected MongoDB, Mongoose is automatically selected as it’s the recommended ODM for MongoDB.
Configure authentication
Choose whether to include authentication:JWT auth includes login, register, token refresh, and password hashing with bcrypt.
Add optional features
Select additional features (use Space to select, Enter to continue):Docker setup includes a
Dockerfile and docker-compose.yml with your selected database pre-configured.What was generated?
After successful creation, you’ll see a success message with next steps:Project structure
Your generated project includes:Configure your environment
Before running the app, set up your environment variables:Set up the database
Generated projects include database schema and migration tools:- Drizzle ORM
- Prisma ORM
- Mongoose ODM
Ensure database exists
Create your database if it doesn’t exist:Or connect to PostgreSQL and run:
PostgreSQL
Generate migration
Generate the migration files from your schema:This creates migration files in
src/db/migrations/ based on your schema definitions in src/db/schema/.Apply migration
Run the migration to create tables:Your database now has the
users and tokens tables (if you selected JWT auth).Run your application
Start the development server:The dev server uses
tsx for hot-reloading. Changes to your TypeScript files automatically restart the server.Test the API
Your application includes several pre-built endpoints:Health check
Verify the server is running:Authentication endpoints (if JWT auth enabled)
- Register
- Login
- Refresh token
Create a new user:Response:
User endpoints
Get all users (example endpoint):Explore the code
Now that your app is running, explore the generated code:Routes
Check
src/routes/ to see how endpoints are defined. Each route file maps HTTP methods to controller functions.Controllers
Open
src/controllers/ to see request handling logic. Controllers process requests and call services.Database schema
For Drizzle:
For Prisma:
For Mongoose:
src/db/schema/For Prisma:
prisma/schema.prismaFor Mongoose:
src/models/Middleware
Review
src/middlewares/ for CORS, error handling, and security (Helmet) configurations.Next steps
Add new endpoints
Create new route files in
src/routes/, controllers in src/controllers/, and wire them together in src/router.ts.Extend the schema
Add new database models or modify existing ones in your schema files, then generate and run migrations.
Add validation
Use the patterns in
src/validations/ to add request validation for your new endpoints.Troubleshooting
Database connection errors
Database connection errors
If you see connection errors:
- Verify your database is running (check with
psql,mysql, ormongosh) - Confirm the
DATABASE_URLin.envmatches your database credentials - Ensure the database exists (create it if needed)
- Check firewall settings if using a remote database
Port already in use
Port already in use
If port 8000 is already taken:
- Change the
PORTin your.envfile - Or find and kill the process using port 8000:
Migration errors
Migration errors
For Drizzle migration issues:
- Check that
drizzle.config.tshas the correct database URL - Ensure your database user has sufficient permissions
- Try dropping and recreating your database (development only!)
- Delete the
prisma/migrations/folder - Run
npx prisma migrate dev --name initto start fresh
TypeScript errors
TypeScript errors
If you see type errors:
- Run
npm installto ensure all dependencies are installed - For Prisma: Run
npx prisma generateto update the Prisma Client - Restart your IDE’s TypeScript server
- Check that
tsconfig.jsonhasn’t been modified
What’s next?
You’ve successfully created and run your first Node Blueprint project! Here are some ideas for what to build:- Blog API: Add posts, comments, and categories
- E-commerce backend: Products, carts, and orders
- Task management: Projects, tasks, and team collaboration
- Social network: Users, posts, likes, and follows