Skip to content

Hey Devs! πŸ‘‹πŸ½. Build express backends 10x faster with this boilerplate (Express, Prisma, PostgresQL, Docker), easily customizable ⚑️ . More code and boilerplate will be added. Feel free to clone or contribute!

License

Notifications You must be signed in to change notification settings

jonace-mpelule/the-express-boilerplate

Repository files navigation

The Express Boilerplate

πŸš€ A production-ready Express.js boilerplate with TypeScript, Prisma, and PostgreSQL

TypeScript Express Prisma Jest License

✨ Features

πŸ›  Core Technologies

  • Express.js - Fast, unopinionated, minimalist web framework
  • TypeScript - JavaScript with syntax for types
  • Prisma - Next-generation ORM for Node.js and TypeScript
  • PostgreSQL - Advanced open-source relational database

πŸ”’ Security & Performance

πŸ“Š Monitoring & Logging

πŸ§ͺ Development & Testing

  • Jest - Delightful JavaScript Testing Framework
  • ESLint - Pluggable linting utility
  • Prettier - Opinionated code formatter
  • Nodemon - Auto-reload during development

πŸš€ Quick Start

Prerequisites

  • Node.js (v18 or higher)
  • PostgreSQL
  • Redis (optional, for caching)

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/the-express-boilerplate.git
cd the-express-boilerplate
  1. Install dependencies:
npm install
  1. Set up environment variables:
cp .env.development .env
  1. Start the development server:
npm run dev:start

πŸ“ Project Structure

β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ __tests__/       # Test files
β”‚   β”œβ”€β”€ config/         # Configuration files
β”‚   β”œβ”€β”€ helpers/        # Helper functions and constants
β”‚   β”œβ”€β”€ loaders/        # Startup process modules
β”‚   β”œβ”€β”€ middleware/     # Custom middleware
β”‚   β”œβ”€β”€ routes/         # API routes
β”‚   β”œβ”€β”€ types/          # TypeScript type definitions
β”‚   β”œβ”€β”€ utils/          # Utility functions
β”‚   β”œβ”€β”€ bootstrap.ts    # Application bootstrap
β”‚   └── server.ts       # Server entry point
β”œβ”€β”€ prisma/            # Prisma schema and migrations
└── docker/            # Docker configuration files

πŸ›  Development

Available Scripts

  • npm run dev:start - Start the development server with hot-reload
  • npm run build - Build the project
  • npm run prod:start - Start the production server
  • npm test - Run tests

πŸ”’ Environment Variables

Create a .env file in the root directory:

# Server
PORT=3000
NODE_ENV=development

# Database
DATABASE_URL="postgresql://user:password@localhost:5432/dbname"

# JWT
JWT_SECRET=your-secret-key

# Redis
REDIS_URL="redis://localhost:6379"

🐳 Docker Support

Build and run with Docker Compose:

docker-compose up --build

πŸ“ˆ Monitoring

This boilerplate includes:

  • Prometheus metrics at /metrics
  • Grafana Loki for log aggregation
  • Response time monitoring
  • Custom metrics support

πŸ§ͺ Testing

Run tests with Jest:

npm test

Test files are located in src/__tests__/

πŸ“œ License

This project is licensed under the ISC License - see the LICENSE file for details.

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“« Support

For support, please open an issue in the GitHub repository.

About

Hey Devs! πŸ‘‹πŸ½. Build express backends 10x faster with this boilerplate (Express, Prisma, PostgresQL, Docker), easily customizable ⚑️ . More code and boilerplate will be added. Feel free to clone or contribute!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published