Node.js TypeScript Template - Express API with Sequelize & JWT
π Production-ready Node.js monolithic server template with Express, Sequelize, and JWT authentication - TypeScript Edition.

β‘ Quick Start: Clone, install dependencies, configure .env, and run npm run dev - you're ready to build with full TypeScript support!
π What is this?
A production-ready Node.js backend template featuring:
- TypeScript for type safety and better developer experience
- Feature-first architecture for scalable code organization
- JWT authentication out of the box
- PostgreSQL database with Sequelize ORM
- Security best practices (Helmet, CORS, rate limiting)
- Clean code structure following industry standards
- Full type definitions for all models, services, and controllers
Perfect for startups, MVPs, or learning modern TypeScript backend development.
β¨ Features
- ποΈ Feature-first architecture - Organized by domain/feature
- π JWT Authentication - Secure token-based auth with TypeScript types
- ποΈ Sequelize ORM - PostgreSQL with Supabase support
- π‘οΈ Security - Helmet, CORS, rate limiting
- π Error Handling - Centralized error handling with typed errors
- β
Validation - Request validation middleware with TypeScript
- π Logging - Structured logging utility
- π Graceful Shutdown - Proper cleanup on termination
- πͺ Type Safety - Full TypeScript support with strict mode
π Project Structure
src/
βββ config/ # Database configuration
βββ features/ # Feature modules (users, products)
β βββ users/ # User feature (auth, JWT)
β βββ products/ # Product feature
βββ shared/ # Shared resources
β βββ middleware/ # Shared middleware
β βββ utils/ # Utility functions
β βββ constants/ # Constants
β βββ types/ # TypeScript type definitions
βββ models/ # Sequelize models index
βββ routes/ # Route registration
βββ app.ts # Express app configuration
βββ server.ts # Server entry point
π Quick Start
1. Install Dependencies
npm install
2. Configure Environment
Copy .env.example to .env and fill in your values:
cp .env.example .env
Edit .env:
PORT=3000
NODE_ENV=development
DATABASE_URL=postgresql://user:password@host:port/database
JWT_SECRET=your-super-secret-jwt-key-change-in-production
JWT_EXPIRES_IN=7d
CORS_ORIGIN=*
3. Start Development Server
npm run dev
The development server uses tsx for hot reloading TypeScript files.
4. Build for Production
npm run build
npm run prod
5. Type Checking
npm run type-check
π‘ API Endpoints
Same as the JavaScript version - see the main README for details.
π οΈ Technologies
- TypeScript - Type-safe JavaScript
- Express.js - Web framework
- Sequelize - ORM for PostgreSQL
- PostgreSQL (Supabase) - Database
- JWT - Authentication
- bcrypt - Password hashing
- Helmet - HTTP security
- CORS - Cross-origin resource sharing
- express-rate-limit - Rate limiting
π TypeScript Configuration
The project uses strict TypeScript configuration:
- Strict mode enabled
- ES2022 target
- ESNext modules
- Source maps for debugging
- Declaration files generated
See tsconfig.json for full configuration.
π Type Safety
All models, services, controllers, and middleware are fully typed:
- Models: Sequelize models with TypeScript interfaces
- Services: Typed business logic functions
- Controllers: Typed Express handlers
- Middleware: Typed request/response handlers
- Types: Shared type definitions in
src/shared/types/
π Code Style
- Double quotes for strings
- Semicolons
- 2-space indentation
- ES6+ modules
- TypeScript strict mode
- JSDoc comments for functions
π’ Deployment
Build Process
- Run
npm run build to compile TypeScript to JavaScript
- The compiled code will be in the
dist/ directory
- Run
npm start or npm run prod to start the server
Environment Setup
- Set
NODE_ENV=production
- Configure
DATABASE_URL with production database
- Set strong
JWT_SECRET
- Configure
CORS_ORIGIN for your frontend domain
π Differences from JavaScript Version
- β
Full TypeScript type safety
- β
Interface definitions for all data structures
- β
Typed Express request/response handlers
- β
Type-safe Sequelize models
- β
Compile-time error checking
- β
Better IDE autocomplete and IntelliSense
π License
ISC
π€ Contributing
This is a template - feel free to fork and customize for your needs!