A boilerplate API built with Node.js to serve as a solid foundation for new projects.
- ⚡ Fastify – Fast and low-overhead web framework
- 🐘 PostgreSQL – Relational database
- 🧪 Prisma ORM – Type-safe database ORM
- 🧱 TypeScript – Typed development for better developer experience
- 🐳 Docker support (optional)
- 📚 Auto-generated API documentation with Swagger (OpenAPI)
- 🔐 JWT-based authentication
- 🚀 High-performance with Fastify
- 🌱 Scalable architecture and Docker-ready
Create a .env file based on the following template:
NODE_ENV=development
PORT=8080
DATABASE_URL=postgresql://user:password@localhost:5432/node-template?schema=public
JWT_SECRET=your_secret
JWT_EXPIRY_SECONDS=3600000# Create and apply a new migration
pnpm prisma migrate dev --name your-migration-name
# Open Prisma Studio to explore and manage your data
pnpm prisma studio
# Generate Prisma Client based on your schema
pnpm prisma generate
# Format your Prisma schema file
pnpm prisma format
# Reset the database and apply all migrations
pnpm prisma migrate reset
# Run migrations on docker container
docker exec -it <container> npx prisma migrate deploy --schema=prisma/schema.prismaTo run the project locally:
# Clone the repository
git clone https://github.com/ma-molinari/node-template.git
# Enter the project directory
cd node-template
# Install dependencies
pnpm install
# Run database migrations
pnpm prisma migrate dev
# Start the dev server
pnpm dev