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 pointgit clone https://github.com/your-username/simple_crud_express.git
cd simple_crud_express
npm installCopy .env.example and adjust as needed:
cp .env.example .envnpx prisma generate
npx prisma migrate dev --name initnpm run dev
⚠️ Make sure your.envfile hasDATABASE_URLandREDIS_URLupdated with the correct service names fromdocker-compose.yml, e.g.:
DATABASE_URL=postgresql://postgres:postgres@postgres:5432/postgres
REDIS_URL=redis://redis:6379Then run:
docker-compose up --buildnpm run lint # Lint all .ts files
npm run format # Format files with PrettierSwagger 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).