docker-express-postgres-boilerplate GitHub Details, Stars and Alternatives | OpenRepoFinder
alexleboucher / repository
docker-express-postgres-boilerplate
A modern boilerplate for building scalable and maintainable REST APIs with JWT authentication, written in TypeScript. It features Docker, Express, Drizzle, and integrates Clean Architecture principles with Dependency Injection powered by Inversify.
A transparent discovery signal based on current public GitHub metadata.
Recent activity35% weight
90
Community adoption25% weight
31
Maintenance state20% weight
65
License clarity10% weight
100
Project information10% weight
75
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
README preview
Overview
The main goal of this boilerplate is to provide a robust foundation for building a scalable and maintainable REST API with Express, following modern development practices.
It integrates common features such as:
Docker containerization
Database connection (PostgreSQL with Drizzle ORM)
Authentication (using jsonwebtoken)
Centralized error handling
Clean Architecture principles for better separation of concerns
Dependency Injection powered by Inversify for modular and testable code
Some basic routes for authentication and user creation are already implemented, allowing you to quickly start your project. The architecture is designed to be extensible, making it easy to add new features or adapt it to your needs.
For more details on the already implemented routes, see API Routes.
End-to-end and unit tests are already implemented, ensuring a robust testing strategy. The code coverage is over 90%, providing high confidence in the stability and reliability of the boilerplate.
Packages are frequently upgraded. You can easily see the packages version status here.
⭐ If you like it, please leave a star, it helps me a lot! ⭐
Features
Docker containerization to easily run your code anywhere and avoid installing tools like PostgreSQL on your computer.
🚀 A modern, production-ready Express.js starter template built with TypeScript. Features JWT authentication, Prisma ORM, comprehensive testing, Docker support, and monitoring tools. Perfect for building scalable and secure REST APIs.
Note:rm -rf .git (or rd /s /q .git on Windows) deletes the git info of the branch like history.
Step 2: Copy .env.example file
macOS/Linux:
cp .env.example .env
Windows:
copy .env.example .env
Step 3: Start the server
Start the application in a Docker container and run the development server:
yarn docker:up
yarn install
yarn dev
This starts a local server using nodemon, which automatically restarts the server when file changes are detected.
The server will run on http://localhost:8000.
Note: The yarn docker:up command will automatically open a shell inside the backend container where you should run the subsequent commands.
Step 4: Test the server
To verify the server is running:
Open your browser and navigate to http://localhost:8000/health.
Alternatively, use a tool like Postman to query the endpoint.
You should see the response:
{ "success": true }
Step 5 (optional): Clean Github templates and workflows
The project contains Github templates and workflows. If you don't want to keep them, you can easily delete them by following this section.
Scripts
⚠️ Except Docker scripts, all the scripts must be executed inside the backend container shell.
Docker
Run yarn docker:up to start the containers defined in docker-compose.yml. It automatically opens a shell in the backend container. Inside this shell, you can execute other scripts like yarn dev.
Run yarn docker:test:up to start the containers in test mode.
Run yarn docker:down to stop all running containers.
Run yarn docker:shell to open a shell inside the backend container.
Run yarn docker:build to build a Docker image of your API.
Install
Run yarn install to install all dependencies. This command needs to be executed:
Locally on your host machine
Inside the Docker container
This dual installation is necessary because node_modules are intentionally not shared between host and container to avoid OS compatibility issues.
Important: The container should generate the final yarn.lock file. Either:
Run yarn install in the container last, or
Use yarn install --pure-lockfile locally to prevent updating yarn.lock
Running in dev mode
Run yarn dev to start the application in development mode using nodemon. It automatically reloads the server when file changes are detected. By default, the server will run on http://localhost:8000.
Build
Run yarn build to compile the project. The output files will be placed in the build/ directory.
Run yarn start to start the compiled project.
Run yarn type-check to perform type checking.
Migrations
Run yarn migration:run to execute all pending migrations
Run yarn migration:generate MigrationName to generate a migration based on the current schema changes.
Linting
Run yarn lint to analyze code quality using ESLint. This displays warnings and errors.
Run yarn lint:fix to automatically fix linting issues where possible.
Test
Run yarn test to execute the unit and integration tests.
Run yarn test:coverage to execute tests and generate a coverage report.
Application layer containing controllers, middlewares, and request handlers.
src/app/routers/
REST API routers.
src/app/middlewares/
Custom Express middlewares for authentication, error handling, etc.
src/app/request-handlers/
Handlers for processing API requests following the Clean Architecture principles. Organized into commands and queries.
src/app/server.ts
Express server configuration and initialization.
src/container/
Dependency Injection container setup with InversifyJS.
src/core/
Core utilities, interfaces, and helpers used across the project.
src/domain/
Domain layer containing business logic, models, and interfaces.
src/domain/models/
Domain models representing business entities.
src/domain/repositories/
Interfaces for database operations.
src/domain/services/
Interfaces for domain-level services (e.g., authentication, encryption).
src/domain/use-cases/
Use cases implementing business logic.
src/infra/
Infrastructure layer providing implementations for core and domain abstractions.
src/infra/auth/
Authentication implementations
src/infra/database/
Database configuration, models, and migrations.
src/infra/database/config/
Database configuration files for Drizzle scripts.
src/infra/database/repositories/
Concrete implementations of domain repository interfaces.
src/infra/database/schemas/
Database schema definitions (e.g., user table schema).
src/infra/id-generator/
UUID-based ID generator.
src/infra/security/
Security utilities like password encryption.
src/infra/logger/
Logger implementations.
src/tests/
A modern REST API boilerplate built with Bun runtime and Elysia framework. Offers superior performance over Node.js with MongoDB integration, request validation, authentication middleware, comprehensive error handling, and Docker deployment configurations.
A production-ready Node.js REST API built with Supabase Authentication and Prisma ORM for secure, scalable backends. Features enterprise-grade architecture with JWT auth, validation, rate limiting, and clean layered design. Ideal for building modern, secure applications with PostgreSQL and full TypeScript safety.
A production-ready REST API boilerplate built with Hono and TypeScript, featuring a sophisticated Role-Based Access Control (RBAC) system, multi-tenant organizations, and modern authentication.