A production-ready backend system for a simple CRUD application built with Node.js, TypeScript, Express, PostgreSQL, Prisma, and Redis, following Clean Architecture principles.
- ✅ RESTful API with Express.js
- ✅ Clean Architecture: Domain / Application / Infrastructure / Interfaces / Config
- ✅ PostgreSQL via Prisma ORM
- ✅ Redis Caching
- ✅ Input validation with Zod
- ✅ OpenAPI (Swagger) docs generation
- ✅ Logging via Winston
- ✅ ESLint + Prettier + Commitlint + Husky
- ✅ Docker + Docker Compose support
Layer | Technology |
---|---|
Language | Node.js, TypeScript |
Framework | Express.js |
ORM | Prisma |
Database | PostgreSQL |
Cache | Redis |
API Docs | Swagger UI + swagger-jsdoc |
Validation | Zod + zod-to-openapi |
Linting | ESLint + Prettier |
CI Hooks | Husky + lint-staged + commitlint |
Build Tool | tsup |
Testing | Jest (TBD) |
Dockerization | Docker + docker-compose |
src/
├── application/ # Use cases, DTOs
├── domain/ # Entities, interfaces
├── infrastructure/ # DB, cache, log, etc.
│ └── database/
│ └── prisma/ # schema.prisma, migrations
├── interfaces/ # Express controllers & routes
├── config/ # env, rate-limit, etc.
├── shared/ # Common utilities
├── types/ # Global TypeScript types
└── index.ts # Entry point
git clone https://github.com/your-username/simple_crud_express.git
cd simple_crud_express
npm install
Copy .env.example
and adjust as needed:
cp .env.example .env
npx prisma generate
npx prisma migrate dev --name init
npm run dev
⚠️ Make sure your.env
file hasDATABASE_URL
andREDIS_URL
updated with the correct service names fromdocker-compose.yml
, e.g.:
DATABASE_URL=postgresql://postgres:postgres@postgres:5432/postgres
REDIS_URL=redis://redis:6379
Then run:
docker-compose up --build
npm run lint # Lint all .ts files
npm run format # Format files with Prettier
Swagger UI available at:
GET /api-docs
MIT © Vinh Dang Quang
- This project follows Clean Architecture.
- Prisma client is generated for both
darwin
(local) andlinux-musl-arm64
(Docker).