Base Express server template with Prisma ORM (v5), routing-controllers, JWT authentication, TypeScript, Swagger, Postman config, Docker, Email, S3, Logging, Bun, Worker, Batch
- 🔥 Type checking with TypeScript
- 🗄️ Simply SQL with Prisma ORM
- 🛣️ Routing controllers with routing-controllers
- 🪪 Authentication with jsonwebtoken
- ⚖️ Authorization and roles with routing-controllers
- 📧 Send Email with Nodemailer
- 🗃️ Store files in S3
- 🔎 Show api with Swagger
- 🖊️ Api test with Postman
- 🐋 Deploy with Docker
- 📏 Linter with ESLint
- 💖 Code Formatter with Prettier
- ❌ Global error handler with routing-controllers
- 🔡 Environment variables with Dotenv
- 🧵 Logging systen with Pino
- ⏩ Fast build, test, install with Bun
- 🤼 Load test with Artillery
- 👷 Worker and batch processing with Bullmq
- 🧪 CI/CD for test and build
- ✅ Validations
- 📜 DTO pattern
📦/ # Main folder
┣ 📂postman # The Postman config to import
┣ 📂docker # For launch the server and db in docker container
┣ 📂prisma # the SQL schema and migrations
┣ 📦src # Main folder of code
┣ 📂controllers # Folder for handlers functions called from routes
┣ 📂dtos # DTO pattern for handling data
┣ 📂exceptions # Global handle error
┣ 📂interfaces # Interfaces for greater abstraction
┣ 📂middleware # Folder for express middlewares
┣ 📂server # Express server instance with routing-controllers config
┣ 📂services # Services for write core code bussiness
┣ test # Unit test and Artillery test
┣ 📂utils # Utils for usage in the application
┗ 📜app.ts # Main file
Install required packages with
bun install
Create an .env
file and setup the variables
cp .env.example .env
Migrate with prisma in order to create the required database tables
bun prisma:deploy
While editing your code, you probably want to automatically build your application and watch for changes with nodemon, in order to achieve that, just run bun dev
and bun dev:watch
You can import backend-express-template.postman_collection.json
in your postman collections
And workspace.postman_globals.json
in your Environments
You can launch the server, the database and a smtp server in docker with this command (edit variable in the docker-compose.yml
)
cd /docker
docker-compose up -d
Build your application with bun build
and then run it with bun start
If you have this error : Module '"@prisma/client"' has no exported member 'User'
run bun prisma generate
MIT