Skip to content

v1.0.0 - Fastify Prisma Starter Templa

Latest

Choose a tag to compare

@ibnabdullah1 ibnabdullah1 released this 15 Dec 05:55
· 1 commit to main since this release

🚀 v1.0.0 - Fastify Prisma Starter Template

A comprehensive, production-ready Node.js backend starter template built with Fastify, PostgreSQL, Prisma ORM, TypeScript, and modern development practices.

✨ What's New

🎯 Core Features

  • Fastify Framework: High-performance web framework with plugin architecture
  • Prisma ORM: Type-safe database access with PostgreSQL
  • JWT Authentication: Complete authentication system with refresh tokens
  • File Upload: Cloudinary integration for media management
  • Email Service: Nodemailer integration for email functionality
  • Health Monitoring: Comprehensive health check endpoint with database status
  • Graceful Shutdown: Proper server shutdown with database cleanup

🛠️ Module Generation Scripts

  • Create Module: Generate complete module structure with one command
    npm run create-module
    • Rename Module: Rename modules and update all references automatically
      npm run rename-module

    📦 Generated Module Structure

Each module includes:

  • Routes (Fastify plugin-based)
  • Controllers (FastifyRequest/FastifyReply)
  • Services (Prisma integration)
  • Interfaces (TypeScript types)
  • Validation (Zod schemas)
  • Constants (Module constants)

🔐 Security Features

  • Helmet for security headers
  • CORS configuration
  • Rate limiting support
  • Input validation with Zod
  • JWT-based authentication
  • Role-based access control

📊 Health Check Endpoint

  • Server status monitoring
  • Database connection status
  • Memory usage tracking
  • Response time metrics
  • Uptime information

🐳 Docker Support

  • Complete Docker setup
  • Docker Compose configuration
  • Production-ready Dockerfile
  • Health check integration

📚 Documentation

Comprehensive documentation included:

  • Quick Start Guide: Get started in 5 minutes
  • API Documentation: Complete API reference
  • Project Structure: Detailed project organization
  • Deployment Guide: Production deployment instructions
  • Troubleshooting: Common issues and solutions
  • Contributing Guide: How to contribute

🚀 Quick Start

sh

Clone the repository

git clone https://github.com/ibnabdullah1/nodejs-fastify-prisma-starter.git
cd nodejs-fastify-prisma-starter

Install dependencies

npm install

Setup environment

cp env.example .env

Edit .env with your configuration

Generate Prisma client

npm run db:generate

Run migrations

npm run migrate

Start development server

npm run dev## 📋 Prerequisites

  • Node.js (v16 or higher)
  • PostgreSQL database
  • npm or yarn

🛠️ Available Scripts

Development

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm run start - Start production server

Database

  • npm run migrate - Run database migrations
  • npm run db:studio - Open Prisma Studio
  • npm run db:generate - Generate Prisma client

Module Management

  • npm run create-module <name> - Create new module
  • npm run rename-module <old> <new> - Rename module

Code Quality

  • npm run lint - Run ESLint
  • npm run format - Format code with Prettier
  • npm run type-check - TypeScript type checking

🎯 Key Features

  • ✅ Fastify framework (high performance)
  • ✅ TypeScript (type safety)
  • ✅ Prisma ORM (type-safe database)
  • ✅ JWT authentication
  • ✅ File upload (Cloudinary)
  • ✅ Email service (Nodemailer)
  • ✅ Health monitoring
  • ✅ Graceful shutdown
  • ✅ Module generation scripts
  • ✅ Comprehensive documentation
  • ✅ Docker support
  • ✅ ESLint & Prettier
  • ✅ Testing setup (Jest)

📦 Tech Stack

  • Runtime: Node.js
  • Framework: Fastify
  • Language: TypeScript
  • Database: PostgreSQL
  • ORM: Prisma
  • Authentication: JWT
  • File Storage: Cloudinary
  • Email: Nodemailer
  • Validation: Zod
  • Testing: Jest

🔗 Links

🙏 Acknowledgments

📄 License

MIT License - see LICENSE file for details


Happy Coding! 🎉