A production-ready Node.js starter kit with Express, TypeScript, Prisma, MySQL, comprehensive testing, and automated code generation.
- TypeScript 5.9 - Type-safe development with latest features
- Express 5.2 - Fast, minimalist web framework
- Prisma 7 - Next-generation ORM with type safety
- MySQL - Reliable relational database
- JWT - Secure token-based authentication
- RBAC - Role-based access control with permissions
- π― Code Generator - Auto-generate CRUD modules with tests in seconds
- π RESTful APIs - Standard REST conventions (POST /, GET /, GET /:id, PUT /:id, DELETE /:id)
- π Swagger UI - Interactive API documentation at
/api-docs - β ESLint 9 - Modern flat config with strict rules
- π Prettier - Consistent code formatting
- π i18n - Multi-language support (English, Spanish)
- Jest 30 - Modern testing framework with great DX
- Unit Tests - Isolated tests with mocked dependencies
- Integration Tests - Full API endpoint testing with real database
- Performance Tracking - Color-coded benchmarking (π’ Fast, π‘ Acceptable, π Slow, π΄ Very Slow)
- Coverage Reports - Detailed HTML reports with >80% coverage
- Node.js 20+
- MySQL 8+ (or Docker)
- npm or yarn
# Clone repository
git clone <repository-url>
cd node-starter-kit
# Install dependencies
npm install
# Setup environment
cp .env.example .env
# Start MySQL (Docker)
docker-compose up -d
# Run migrations
npm run prisma:migrate
# Seed database
npm run seed# Start development server
npm run dev
# Server runs on http://localhost:5000
# Swagger UI: http://localhost:5000/api-docs# Run all tests with coverage
npm test
# Run unit tests only (fast, isolated)
npm run test:unit
# Run integration tests only (with database)
npm run test:integration
# Run all tests sequentially
npm run test:all
# Run tests for specific module (unit + integration)
npm run test:module user
# Run only unit tests for specific module
npm run test:unit:module user
# Watch mode
npm run test:watchπ‘ Pro Tips:
- Use
test:moduleto test a specific feature (e.g.,user,role) - Use
test:unit:modulefor fast unit tests of a single module - Pattern matching works:
npm run test:module roleruns all role-related tests
Generate complete CRUD modules with one command:
npm run generateWhat it generates:
- β Model class with TypeScript interfaces
- β Service with CRUD operations + pagination
- β Controller with RESTful endpoints
- β Routes with authentication & validation
- β Validators with i18n error messages
- β Swagger documentation (schemas + paths)
- β Unit tests (controller + service)
- β Integration tests with performance tracking
Example: Generate a Product module in < 5 seconds with full test coverage!
π Detailed guide: docs/CODE_GENERATION.md
βββ prisma/ # Database schema & migrations
β βββ schema.prisma # Prisma schema
β βββ migrations/ # Database migrations
β βββ seeders/ # Seed data
βββ src/
β βββ config/ # Configuration files
β β βββ swagger/ # API documentation
β β βββ locales/ # i18n translations
β β βββ templates/ # Code generation templates
β βββ controllers/ # Request handlers
β βββ services/ # Business logic
β βββ routes/ # API routes
β βββ middlewares/ # Express middlewares
β βββ validators/ # Request validation
β βββ models/ # Data models
β βββ utils/ # Utility functions
β βββ tests/ # Test files
β βββ unit/ # Unit tests
β βββ integration/ # Integration tests
β βββ helpers/ # Test utilities
βββ docs/ # Documentation
β βββ TESTING.md # Testing guide
β βββ BENCHMARKING.md # Performance guide
β βββ CODE_GENERATION.md # Generator guide
βββ logs/ # Application logs
βββ benchmark/ # Performance logs
π Full API docs: http://localhost:5000/api-docs
npm run dev # Start development server
npm run build # Build for production
npm start # Start production servernpm run lint:check # Check for linting errors
npm run lint:fix # Fix linting errors
npm run format:check # Check code formatting
npm run format:fix # Format code with Prettiernpm run prisma:generate # Generate Prisma Client
npm run prisma:migrate # Run migrations
npm run prisma:deploy # Deploy migrations (production)
npm run prisma:format # Format schema.prisma
npm run seed # Seed databasenpm run generate # Generate CRUD module with testsnpm test # Run all tests with coverage
npm run test:unit # Run all unit tests
npm run test:integration # Run all integration tests
npm run test:all # Run unit then integration (sequential)
npm run test:module <name> # Run all tests for specific module
npm run test:unit:module <name> # Run unit tests for specific module
npm run test:watch # Watch mode for developmentExamples:
npm run test:module user # All user tests (unit + integration)
npm run test:unit:module role # Only role unit tests (fast)
npm run test:module Controller # All controller testsDetailed guides available in the docs/ folder:
| Guide | Description |
|---|---|
| TESTING.md | Complete testing guide (unit, integration, performance) |
| TESTING_CHEATSHEET.md | Quick reference for all test commands β‘ |
| BENCHMARKING.md | Performance tracking and optimization tips |
| CODE_GENERATION.md | Code generator usage and customization |
# Build image
docker build -t node-starter-kit .
# Run container
docker-compose up -d
# Check logs
docker-compose logs -f app# Build
npm run build
# Set environment
export NODE_ENV=production
# Run migrations
npm run prisma:deploy
# Start server
npm start- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Guidelines:
- Write tests for new features
- Follow TypeScript/ESLint conventions
- Update documentation as needed
- Maintain >80% code coverage
The starter kit includes built-in performance tracking:
- Color-coded benchmarks in test output
- Automatic logging to
logs/benchmark/ - Performance thresholds: Fast (<100ms), Acceptable (<500ms), Slow (<1000ms)
- Summary reports after test runs
npm run analyze-benchmark
Example output:
========================================
Performance Test Summary
========================================
API Call: Get All Users
β±οΈ Time: 89ms
Status: π’ Fast (Expected: 500ms)
API Call: Create User
β±οΈ Time: 245ms
Status: π‘ Acceptable (Expected: 500ms)
# Check Docker containers
docker-compose ps
# Restart database
docker-compose restart db
# Check logs
docker-compose logs db# Reset database (β οΈ Development only)
npx prisma migrate reset
# Re-run migrations
npm run prisma:migrate
# Regenerate client
npm run prisma:generate
# Run only one seeder
npm run seed -- --name=Permissions# Find process using port 3000
lsof -ti:5000
# Kill process
lsof -ti:5000 | xargs kill -9This project is licensed under the MIT License - see the LICENSE file for details.
- Express.js - Web framework
- Prisma - Database ORM
- Jest - Testing framework
- TypeScript - Type safety
For questions or issues:
- π Check Documentation
- π Open an Issue
- π¬ Start a Discussion
git remote add upstream git@github.com:Jobinjose01/NodeTS-Starter-Kit.git
Built with β€οΈ using TypeScript, Express, and Prisma