{"id":30172874,"url":"https://github.com/deepakcodez/node-express-ts-prisma-biolerplate","last_synced_at":"2026-04-08T18:02:33.742Z","repository":{"id":307857000,"uuid":"1029922627","full_name":"Deepakcodez/node-express-ts-prisma-biolerplate","owner":"Deepakcodez","description":"Boilerplate for Node as Runtime  Express for Server With Type safety along with Prisma ORM","archived":false,"fork":false,"pushed_at":"2025-08-02T19:03:31.000Z","size":55,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-11T23:23:49.477Z","etag":null,"topics":["api","api-rest","backend","backend-boilerplate","boilerplate","express","mysql","node","node-boilerplate","nodemon","orm","postgres","prisma","prisma-client","prisma-orm","tsc","typesafety","typescript"],"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/Deepakcodez.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,"zenodo":null}},"created_at":"2025-07-31T19:45:01.000Z","updated_at":"2025-08-03T20:06:06.000Z","dependencies_parsed_at":"2025-08-02T17:49:30.890Z","dependency_job_id":null,"html_url":"https://github.com/Deepakcodez/node-express-ts-prisma-biolerplate","commit_stats":null,"previous_names":["deepakcodez/node-express-ts-prisma-biolerplate"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Deepakcodez/node-express-ts-prisma-biolerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deepakcodez%2Fnode-express-ts-prisma-biolerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deepakcodez%2Fnode-express-ts-prisma-biolerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deepakcodez%2Fnode-express-ts-prisma-biolerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deepakcodez%2Fnode-express-ts-prisma-biolerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Deepakcodez","download_url":"https://codeload.github.com/Deepakcodez/node-express-ts-prisma-biolerplate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deepakcodez%2Fnode-express-ts-prisma-biolerplate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31567227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"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":["api","api-rest","backend","backend-boilerplate","boilerplate","express","mysql","node","node-boilerplate","nodemon","orm","postgres","prisma","prisma-client","prisma-orm","tsc","typesafety","typescript"],"created_at":"2025-08-11T23:18:00.195Z","updated_at":"2026-04-08T18:02:33.721Z","avatar_url":"https://github.com/Deepakcodez.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Express TypeScript Authentication Backend\n\nA production-ready Node.js backend built with Express, TypeScript, Prisma, and PostgreSQL featuring comprehensive user authentication, robust error handling, and industry best practices.\n\n## 🚀 Features\n\n- 🔐 **JWT Authentication** - Secure token-based authentication with configurable expiration\n- 🛡️ **Password Security** - bcrypt hashing with configurable salt rounds\n- 📝 **Input Validation** - Joi schema validation with custom error messages\n- 🗄️ **Database ORM** - PostgreSQL with Prisma for type-safe database operations\n- 🚦 **Security Middleware** - Rate limiting, CORS, Helmet security headers\n- 📊 **Structured Responses** - Consistent API response format across all endpoints\n- 🔍 **Error Handling** - Comprehensive error handling with custom error classes\n- 📋 **Code Quality** - ESLint, TypeScript strict mode, and proper project structure\n- 🔄 **Development Tools** - Hot reload, logging, and database management tools\n- 🏗️ **Architecture** - Clean separation of concerns with controllers, services, and middleware\n\n## Quick Start\n\n1. **Install dependencies**\n\n   ```bash\n   npm install\n   ```\n\n2. **Set up environment variables**\n\n   ```bash\n   cp .env.example .env\n   ```\n\n   Update the `.env` file with your database URL and JWT secret.\n\n3. **Set up database**\n\n   ```bash\n   npm run prisma:migrate\n   npm run prisma:generate\n   ```\n\n4. **Start development server**\n   ```bash\n   npm run dev\n   ```\n\n## 📡 API Endpoints\n\n### Authentication Endpoints\n\n#### Register User\n\n```http\nPOST /api/v1/auth/register\nContent-Type: application/json\n\n{\n  \"email\": \"user@example.com\",\n  \"password\": \"securePassword123\",\n  \"firstName\": \"John\",\n  \"lastName\": \"Doe\"\n}\n```\n\n#### Login User\n\n```http\nPOST /api/v1/auth/login\nContent-Type: application/json\n\n{\n  \"email\": \"user@example.com\",\n  \"password\": \"securePassword123\"\n}\n```\n\n#### Get User Profile (Protected)\n\n```http\nGET /api/v1/auth/profile\nAuthorization: Bearer \u003cjwt_token\u003e\n```\n\n### System Endpoints\n\n#### Health Check\n\n```http\nGET /api/v1/health\n```\n\n## 🔧 Authentication Flow\n\n1. **Registration**: User provides email, password, and optional profile info\n2. **Password Hashing**: Password is hashed using bcrypt with configurable rounds\n3. **JWT Generation**: Server generates JWT token with user payload\n4. **Login**: User provides credentials, server validates and returns JWT\n5. **Protected Routes**: Client sends JWT in Authorization header\n6. **Token Verification**: Middleware verifies JWT and extracts user info\n\n## 🏗️ Project Architecture\n\n```\nsrc/\n├── config/\n│   └── database.ts          # Prisma client configuration\n├── controllers/\n│   └── authController.ts    # Authentication route handlers\n├── middleware/\n│   ├── auth.ts             # JWT authentication middleware\n│   ├── errorHandler.ts     # Global error handling\n│   └── validation.ts       # Request validation middleware\n├── routes/\n│   ├── authRoutes.ts       # Authentication routes\n│   └── index.ts            # Main route aggregator\n├── services/\n│   └── authService.ts      # Authentication business logic\n├── types/\n│   └── index.ts            # TypeScript interfaces and types\n├── utils/\n│   ├── apiResponse.ts      # Standardized API responses\n│   ├── errors.ts           # Custom error classes\n│   ├── jwt.ts              # JWT utility functions\n│   └── validation.ts       # Joi validation schemas\n├── app.ts                  # Express application setup\n└── server.ts               # Server entry point and graceful shutdown\n```\n\n### Architecture Principles\n\n- **Controllers**: Handle HTTP requests/responses, delegate to services\n- **Services**: Contain business logic, interact with database\n- **Middleware**: Handle cross-cutting concerns (auth, validation, errors)\n- **Utils**: Reusable utility functions and helpers\n- **Types**: TypeScript interfaces for type safety\n- **Separation of Concerns**: Each layer has a single responsibility\n\n## Scripts\n\n- `npm run dev` - Start development server\n- `npm run build` - Build for production\n- `npm run start` - Start production server\n- `npm run lint` - Run ESLint\n- `npm run lint:fix` - Fix ESLint issues\n- `npm run prisma:generate` - Generate Prisma client\n- `npm run prisma:migrate` - Run database migrations\n- `npm run prisma:studio` - Open Prisma Studio\n\n## Environment Variables\n\n```env\nNODE_ENV=development\nPORT=3000\nDATABASE_URL=\"mysql://root:root@localhost:3306/test_db\"\nJWT_SECRET=your-super-secret-jwt-key-here\nJWT_EXPIRES_IN=7d\nBCRYPT_ROUNDS=12\n```\n\n## API Response Format\n\nAll API responses follow a consistent structure:\n\n```json\n{\n  \"success\": true,\n  \"message\": \"Operation successful\",\n  \"data\": {},\n  \"timestamp\": \"2024-01-01T00:00:00.000Z\"\n}\n```\n\nError responses:\n\n```json\n{\n  \"success\": false,\n  \"message\": \"Error message\",\n  \"error\": \"Detailed error information\",\n  \"timestamp\": \"2024-01-01T00:00:00.000Z\"\n}\n```\n\n## 📚 Documentation\n\nFor detailed information, check out these documentation files:\n\n- **[Setup Guide](docs/SETUP_GUIDE.md)** - Complete installation and configuration guide\n- **[API Documentation](docs/API_DOCUMENTATION.md)** - Detailed API endpoints with examples\n- **[Architecture Guide](docs/ARCHITECTURE.md)** - System architecture and design patterns\n\n## 🛠️ Development\n\n### Code Quality Standards\n\n- **TypeScript**: Strict mode enabled with comprehensive type checking\n- **ESLint**: Configured with TypeScript rules and best practices\n- **Error Handling**: Custom error classes with proper HTTP status codes\n- **Validation**: Joi schemas for request validation with custom messages\n- **Security**: Helmet, CORS, rate limiting, and JWT authentication\n\n### Project Conventions\n\n- **Naming**: camelCase for variables/functions, PascalCase for classes\n- **File Structure**: Feature-based organization with clear separation\n- **Error Handling**: Always use try-catch with proper error propagation\n- **API Responses**: Consistent response format using ApiResponseUtil\n- **Database**: Use Prisma for all database operations\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepakcodez%2Fnode-express-ts-prisma-biolerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeepakcodez%2Fnode-express-ts-prisma-biolerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepakcodez%2Fnode-express-ts-prisma-biolerplate/lists"}