{"id":16419417,"url":"https://github.com/devmahmud/express-prisma-typescript-boilerplate","last_synced_at":"2026-01-26T03:32:42.025Z","repository":{"id":189481602,"uuid":"679656102","full_name":"devmahmud/express-prisma-typescript-boilerplate","owner":"devmahmud","description":"RESTful API server boilerplate using Node JS, TypeScript, Express and Prisma.","archived":false,"fork":false,"pushed_at":"2025-08-31T07:53:37.000Z","size":2423,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-31T09:21:59.121Z","etag":null,"topics":["boilerplate","docker","express","nodejs","passport","postgresql","prettier","prisma","restful-api","swagger","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devmahmud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-08-17T10:22:18.000Z","updated_at":"2025-08-31T07:53:40.000Z","dependencies_parsed_at":"2024-11-10T07:45:30.835Z","dependency_job_id":"45d6ce6c-66e2-41ca-b711-4d6feedc40ee","html_url":"https://github.com/devmahmud/express-prisma-typescript-boilerplate","commit_stats":null,"previous_names":["devmahmud/express-prisma-typescript-boilerplate"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/devmahmud/express-prisma-typescript-boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmahmud%2Fexpress-prisma-typescript-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmahmud%2Fexpress-prisma-typescript-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmahmud%2Fexpress-prisma-typescript-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmahmud%2Fexpress-prisma-typescript-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devmahmud","download_url":"https://codeload.github.com/devmahmud/express-prisma-typescript-boilerplate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devmahmud%2Fexpress-prisma-typescript-boilerplate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28765914,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T03:19:35.311Z","status":"ssl_error","status_checked_at":"2026-01-26T03:19:13.815Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["boilerplate","docker","express","nodejs","passport","postgresql","prettier","prisma","restful-api","swagger","typescript"],"created_at":"2024-10-11T07:24:19.038Z","updated_at":"2026-01-26T03:32:42.020Z","avatar_url":"https://github.com/devmahmud.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Express Prisma TypeScript Boilerplate\n\nA production-ready REST API boilerplate with Node.js, Express, TypeScript, and Prisma.\n\n## Features\n\n- **TypeScript** - Type-safe development\n- **Express.js** - Fast, unopinionated web framework\n- **Prisma** - Modern database toolkit\n- **PostgreSQL** - Robust, open-source database\n- **JWT Authentication** - Secure token-based authentication\n- **Role-based Access Control** - Flexible permission system\n- **Input Validation** - Request validation with Zod and zParse\n- **Error Handling** - Centralized error handling\n- **Logging** - Structured logging with Winston\n- **Rate Limiting** - API rate limiting\n- **CORS** - Cross-origin resource sharing\n- **Helmet** - Security headers\n- **Swagger/OpenAPI** - API documentation\n- **Docker** - Containerization support\n- **PM2** - Process management\n- **Testing** - Unit and integration tests with Vitest\n- **ESLint \u0026 Prettier** - Code quality and formatting\n- **Husky** - Git hooks\n- **Semantic Release** - Automated versioning\n\n## Quick Start\n\n### Prerequisites\n\n- Node.js 20+\n- PostgreSQL\n- pnpm or npm\n\n### Installation\n\n1. Clone the repository:\n```bash\ngit clone \u003crepository-url\u003e\ncd express-prisma-typescript-boilerplate\n```\n\n2. Install dependencies:\n```bash\npnpm install\n```\n\n3. Set up environment variables:\n```bash\ncp .env.example .env\n```\n\n4. Update the `.env` file with your configuration:\n```env\nNODE_ENV=development\nPORT=8000\nDATABASE_URL=\"postgresql://username:password@localhost:5432/database_name\"\nJWT_SECRET=your-jwt-secret\n```\n\n5. Set up the database:\n```bash\npnpm db:migrate\n```\n\n6. Start the development server:\n```bash\npnpm dev\n```\n\nThe API will be available at `http://localhost:8000`\n\n## Project Structure\n\n```\nsrc/\n├── config/                 # Configuration files\n│   ├── config.ts          # Main configuration\n│   ├── logger.ts          # Logging configuration\n│   ├── morgan.ts          # HTTP request logging\n│   ├── passport.ts        # Authentication strategy\n│   ├── roles.ts           # Role-based access control\n│   └── limiter.ts         # Rate limiting\n├── modules/               # Feature modules\n│   ├── auth/              # Authentication module\n│   ├── user/              # User management\n│   ├── post/              # Example post module\n│   ├── notification/      # Notifications\n│   └── file/              # File uploads\n├── shared/                # Shared utilities\n│   ├── middlewares/       # Express middlewares\n│   ├── services/          # Shared services\n│   └── utils/             # Utility functions\n├── routes/                # Route definitions\n├── types/                 # TypeScript type definitions\n└── index.ts               # Application entry point\n```\n\n## Input Validation\n\nThis boilerplate uses [Zod](https://zod.dev/) for schema-based validation and a utility called `zParse` for parsing and validating Express requests. Validation schemas are defined using Zod in each module, and controllers use `zParse` to validate and extract typed data from the request. This approach provides type safety, clear error messages, and a consistent validation experience.\n\n**Example:**\n```typescript\n// post.validation.ts\nimport { z } from 'zod';\n\nexport const createPostSchema = z.object({\n  body: z.object({\n    title: z.string().min(1, 'Title is required'),\n    content: z.string().min(1, 'Content is required'),\n    published: z.boolean().optional(),\n  }),\n});\n\n// post.controller.ts\nimport zParse from '@/shared/utils/z-parse';\nimport * as postSchema from './post.validation';\n\nconst createPost = catchAsync(async (req, res) =\u003e {\n  const { body } = await zParse(postSchema.createPostSchema, req);\n  // ...\n});\n```\n\n## API Documentation\n\nOnce the server is running, you can access the API documentation at:\n- Swagger UI: `http://localhost:8000/v1/docs`\n- OpenAPI JSON: `http://localhost:8000/v1/docs-json`\n\n## Available Scripts\n\n- `pnpm dev` - Start development server\n- `pnpm build` - Build for production\n- `pnpm start` - Start production server\n- `pnpm test` - Run tests\n- `pnpm test:watch` - Run tests in watch mode\n- `pnpm coverage` - Generate test coverage\n- `pnpm lint` - Run ESLint\n- `pnpm lint:fix` - Fix ESLint errors\n- `pnpm prettier` - Check code formatting\n- `pnpm prettier:fix` - Fix code formatting\n- `pnpm db:studio` - Open Prisma Studio\n- `pnpm db:migrate` - Run database migrations\n- `pnpm docker:dev` - Start with Docker (development)\n- `pnpm docker:prod` - Start with Docker (production)\n\n## Docker\n\nThe boilerplate includes Docker configuration for easy development and deployment.\n\n### Development\n```bash\npnpm docker:dev\n```\n\n### Production\n```bash\npnpm docker:prod\n```\n\n### With Database and Redis\nThe main `docker-compose.yml` includes PostgreSQL and Redis services:\n\n```bash\ndocker compose up --build\n```\n\nThis will start:\n- Express API server\n- PostgreSQL database\n- Redis cache\n\n## Environment Variables\n\n| Variable                        | Description                   | Default       |\n| ------------------------------- | ----------------------------- | ------------- |\n| `NODE_ENV`                      | Environment                   | `development` |\n| `PORT`                          | Server port                   | `8000`        |\n| `DATABASE_URL`                  | Database connection string    | -             |\n| `JWT_SECRET`                    | JWT secret key                | `secret`      |\n| `JWT_ACCESS_EXPIRATION_MINUTES` | JWT access token expiration   | `30`          |\n| `JWT_REFRESH_EXPIRATION_DAYS`   | JWT refresh token expiration  | `30`          |\n| `SMTP_HOST`                     | SMTP server host              | -             |\n| `SMTP_PORT`                     | SMTP server port              | -             |\n| `SMTP_USERNAME`                 | SMTP username                 | -             |\n| `SMTP_PASSWORD`                 | SMTP password                 | -             |\n| `EMAIL_FROM`                    | Email sender address          | -             |\n| `REDIS_URL`                     | Redis connection string       | -             |\n| `SENTRY_DSN`                    | Sentry DSN for error tracking | -             |\n| `LOGTAIL_SOURCE_TOKEN`          | Logtail source token          | -             |\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests if applicable\n5. Run linting and tests\n6. Submit a pull request\n\n## License\n\nMIT License - see LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevmahmud%2Fexpress-prisma-typescript-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevmahmud%2Fexpress-prisma-typescript-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevmahmud%2Fexpress-prisma-typescript-boilerplate/lists"}