{"id":27217412,"url":"https://github.com/kayange123/nestjs-starter","last_synced_at":"2026-04-28T21:35:25.083Z","repository":{"id":287071067,"uuid":"963468436","full_name":"Kayange123/nestjs-starter","owner":"Kayange123","description":"A comprehensive, production-ready NestJS API starter kit with authentication, role-based access control, database integration, and many more enterprise-ready features.","archived":false,"fork":false,"pushed_at":"2025-04-13T07:37:08.000Z","size":149,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-10-13T23:40:04.331Z","etag":null,"topics":["cache","cicd","docker","nestjs","postgres","starter","starter-kit","starterkit"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kayange123.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-09T18:18:42.000Z","updated_at":"2025-09-12T15:39:08.000Z","dependencies_parsed_at":"2025-04-10T06:58:50.873Z","dependency_job_id":null,"html_url":"https://github.com/Kayange123/nestjs-starter","commit_stats":null,"previous_names":["kayange123/nestjs-starter"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/Kayange123/nestjs-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kayange123%2Fnestjs-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kayange123%2Fnestjs-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kayange123%2Fnestjs-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kayange123%2Fnestjs-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kayange123","download_url":"https://codeload.github.com/Kayange123/nestjs-starter/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kayange123%2Fnestjs-starter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017233,"owners_count":26086016,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cache","cicd","docker","nestjs","postgres","starter","starter-kit","starterkit"],"created_at":"2025-04-10T05:28:31.203Z","updated_at":"2025-10-13T23:40:05.670Z","avatar_url":"https://github.com/Kayange123.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NestJS API Starter Kit\n\nA comprehensive, production-ready NestJS API starter kit with authentication, role-based access control, database integration, and many more enterprise-ready features.\n\n## Features\n\n- 🔒 **Authentication \u0026 Authorization**\n\n  - JWT Authentication with refresh tokens\n  - Role-based access control (RBAC)\n  - Permission-based access control\n  - CSRF protection\n  - Rate limiting and throttling\n\n- 🛠️ **Core Infrastructure**\n\n  - Modular architecture following NestJS best practices\n  - PostgreSQL integration with TypeORM\n  - In-memory caching support\n  - Comprehensive logging with Winston\n  - Health check endpoints with detailed system monitoring\n  - Request/response validation with class-validator\n  - API versioning with proper routing structure\n\n- 📊 **Developer Experience**\n\n  - Swagger/OpenAPI documentation\n  - Environment configuration with validation\n  - Automated testing infrastructure (unit, integration, e2e)\n  - Docker \u0026 Docker Compose for local development\n  - GitHub Actions CI/CD workflows\n  - Linting and code formatting (ESLint, Prettier)\n  - Git hooks with Husky and lint-staged\n  - Conventional commits enforcement\n\n- 🔄 **Database Tools**\n\n  - Database migrations\n  - Data seeding (development, testing, production)\n  - Query pagination support\n\n- 🔧 **Production Ready**\n  - Optimized Docker images with multi-stage builds\n  - API error handling and standardized responses\n  - CORS configuration\n  - Helmet security headers\n  - Health monitoring and metrics\n\n## Getting Started\n\n### Prerequisites\n\n- Node.js (v20+)\n- PNPM (v8+)\n- PostgreSQL (v16+)\n- Docker \u0026 Docker Compose (optional)\n\n### Local Installation\n\n1. Clone this repository\n2. Install dependencies:\n\n   ```bash\n   pnpm install\n   ```\n\n3. Create a `.env` file from the example:\n\n   ```bash\n   cp .env.example .env\n   ```\n\n4. Update the `.env` file with your configuration\n\n5. Start the application:\n\n   ```bash\n   pnpm start:dev\n   ```\n\n### Docker Setup\n\nRun the application with Docker:\n\n```bash\n# Development mode with hot reload\ndocker compose build\ndocker compose up -d\n\n# Production mode\nNODE_ENV=production docker compose up -d\n```\n\n## Health Monitoring\n\nThe application includes comprehensive health checks at `/v1/health` that monitor:\n\n- API status\n- Database connectivity\n- Disk storage usage\n- Memory usage\n\n## Caching Strategy\n\nThe application uses NestJS's built-in in-memory caching system for performance optimization.\n\nConfigure cache TTL in your .env file:\n\n```ruby\nCACHE_TTL=300  # Time-to-live in seconds (default is 5 minutes)\n```\n\n## Security Features\n\n### CSRF Protection\n\nCSRF protection is enabled by default for all non-GET endpoints. The CSRF token is provided in the response header `csrf-token` for any GET request and must be included in subsequent non-GET requests either as:\n\n- `csrf-token` or `x-csrf-token` header\n- `_csrf` property in the request body\n\n### Rate Limiting\n\nAPI rate limiting is configured at 100 requests per minute by default. Customize in `.env`:\n\n```ruby\nTHROTTLE_TTL=60000\nTHROTTLE_LIMIT=100\n```\n\n## API Versioning\n\nAPI versioning is enabled through URI paths. Endpoints are accessible at `/v1/resource`.\n\nWhen introducing breaking changes, create new controllers under a new version namespace.\n\n## Testing\n\n```bash\n# Run unit tests\npnpm test\n\n# Run e2e tests\npnpm test:e2e\n\n# Generate test coverage\npnpm test:cov\n```\n\n## CI/CD\n\nContinuous Integration and Deployment is set up using GitHub Actions:\n\n- **CI Pipeline**: Runs on all pushes to `main` and `develop` branches and all PRs\n\n  - Linting and type checking\n  - Unit and integration tests\n  - Test coverage reporting\n\n- **CD Pipeline**:\n  - Triggered by pushes to `main` (deploys to staging)\n  - Triggered by version tags (deploys to production)\n  - Builds and pushes Docker images to GitHub Container Registry\n  - Supports seamless deployment to multiple environments\n\n## API Documentation\n\nSwagger documentation is available at `/docs` when the application is running.\n\n## Available Scripts\n\n- `pnpm start:dev` - Start the application in development mode\n- `pnpm build` - Build the application\n- `pnpm start:prod` - Start the application in production mode\n- `pnpm test` - Run tests\n- `pnpm test:watch` - Run tests in watch mode\n- `pnpm test:cov` - Run tests with coverage\n- `pnpm test:e2e` - Run end-to-end tests\n- `pnpm lint` - Run linting\n- `pnpm format` - Run code formatting\n- `pnpm typecheck` - Run type checking\n- `pnpm migration:generate -- src/database/migrations/MigrationName` - Generate a new migration\n- `pnpm migration:run` - Run migrations\n- `pnpm migration:revert` - Revert the last migration\n- `pnpm seed:init` - Seed the database with initial data\n\n## Project Structure\n\n```ruby\nsrc/\n├── app.controller.ts        # App controller\n├── app.module.ts            # Main application module\n├── app.service.ts           # App service\n├── main.ts                  # Application entry point\n├── config/                  # Configuration management\n├── database/                # Database setup and migrations\n├── filters/                 # Global exception filters\n├── guards/                  # Authentication guards\n├── interceptors/            # HTTP interceptors\n├── lib/                     # Shared libraries\n│   ├── cache/               # Caching implementation\n│   └── logger/              # Logging implementation\n├── modules/                 # Feature modules\n│   ├── auth/                # Authentication module\n│   ├── health/              # Health check module\n│   ├── shared/              # Shared module\n│   └── users/               # Users module\n├── pipes/                   # Validation pipes\n├── security/                # Security features\n│   └── csrf/                # CSRF protection\n└── seeders/                 # Database seeders\n```\n\n## Git Workflow and Conventions\n\n### Husky Git Hooks\n\nThis project uses [Husky](https://typicode.github.io/husky) to enforce code quality and consistency through Git hooks:\n\n- **pre-commit**: Runs linting and formatting on staged files using lint-staged\n- **pre-push**: Runs tests and type checking before pushing to remote\n- **commit-msg**: Validates commit messages against conventional commit format\n\nHusky ensures that all code meets the project's quality standards before being committed or pushed.\n\n### Conventional Commits\n\nWe enforce the [Conventional Commits](https://www.conventionalcommits.org/) specification for commit messages. Each commit message must follow this format:\n\n```bash\ntype(scope): message [#issue-number]\n```\n\n**Types allowed** (from commitlint.config.js):\n\n- `feat`: A new feature\n- `fix`: A bug fix\n- `docs`: Documentation changes\n- `style`: Code style changes (formatting, etc.)\n- `refactor`: Code changes that neither fix bugs nor add features\n- `perf`: Performance improvements\n- `test`: Adding or updating tests\n- `chore`: Changes to the build process, tools, etc.\n- `revert`: Reverting a previous commit\n\n**Rules**:\n\n- Header length must not exceed 72 characters\n- A reference to an issue is required\n- Type must be one of the allowed types listed above\n\n**Examples**:\n\n```bash\nfeat(auth): implement refresh token rotation #123\nfix(api): resolve race condition in request handler #456\ndocs(readme): update deployment instructions #789\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a new feature branch (`git checkout -b feature/amazing-feature`)\n3. Make your changes\n4. Commit your changes using conventional commits\n5. Push to the branch (`git push origin feature/amazing-feature`)\n6. Open a Pull Request\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkayange123%2Fnestjs-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkayange123%2Fnestjs-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkayange123%2Fnestjs-starter/lists"}