Nest boilerplate with Typescript πΆ, Postgres π¬, TypeORM π and fully CI-CD with GitHub Action πββοΈ
- π NestJS with TypeScript
- π¦ PNPM as package manager
- ποΈ PostgreSQL with TypeORM
- π Swagger API documentation
- π§ͺ Jest for testing
- π¨ Prettier for code formatting
- π ESLint for code linting
- π³ Docker support
- π GitHub Actions for CI/CD
- π Conventional Commits with CommitLint
- π Semantic Release for versioning
- Node.js (v22 or higher)
- PNPM (v8 or higher)
- PostgreSQL (v14 or higher)
- Docker (optional, for containerization)
- Create a personal access token with
write:packages
scope here - Add a secret
PAT
with the generated token value in your repository settings
# Install dependencies
$ pnpm install
# Copy environment file
$ cp .env.example .env
- Update the
.env
file with your database credentials and other configuration - Default configuration includes:
- Database connection
- JWT settings
- API port
- Swagger documentation settings
# development
$ pnpm start
# watch mode
$ pnpm start:dev
# production mode
$ pnpm start:prod
# debug mode
$ pnpm start:debug
Once the application is running, you can access the Swagger documentation at:
http://localhost:3000/api
# unit tests
$ pnpm test
# e2e tests
$ pnpm test:e2e
# test coverage
$ pnpm test:cov
# test watch mode
$ pnpm test:watch
# generate migration
$ pnpm migration:generate MigrationName
# or
$ pnpm build && pnpm typeorm migration:generate -p ./src/database/migrations/MigrationName
# run migration
$ pnpm migration:run
# revert migration
$ pnpm migration:revert
# drop schema
$ pnpm typeorm schema:drop
# create migration
$ pnpm migration:create MigrationName
# Build image
$ docker build -t nest-boilerplate .
# Run container
$ docker run -p 3000:3000 nest-boilerplate
src/
βββ config/ # Configuration files
βββ database/ # Database configuration and migrations
βββ modules/ # Feature modules
βββ common/ # Common utilities and decorators
βββ filters/ # Exception filters
βββ guards/ # Guards
βββ interceptors/ # Interceptors
βββ middlewares/ # Middlewares
βββ pipes/ # Pipes
βββ main.ts # Application entry point
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'feat: add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.