{"id":22882315,"url":"https://github.com/ebukaodini/express-api-template","last_synced_at":"2026-01-20T15:37:05.816Z","repository":{"id":216816032,"uuid":"742254171","full_name":"ebukaodini/express-typescript-api-template","owner":"ebukaodini","description":"an express typescript api template","archived":false,"fork":false,"pushed_at":"2025-01-17T16:13:53.000Z","size":47,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T21:11:32.377Z","etag":null,"topics":["expressjs","low-code","restapi-framework","typescript","validation-library"],"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/ebukaodini.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-01-12T04:21:34.000Z","updated_at":"2025-01-17T16:13:56.000Z","dependencies_parsed_at":"2024-01-13T02:47:54.744Z","dependency_job_id":"364ee42f-49d0-4c49-8326-4109e76ea3e6","html_url":"https://github.com/ebukaodini/express-typescript-api-template","commit_stats":null,"previous_names":["ebukaodini/express-typescript-api-template"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebukaodini%2Fexpress-typescript-api-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebukaodini%2Fexpress-typescript-api-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebukaodini%2Fexpress-typescript-api-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebukaodini%2Fexpress-typescript-api-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ebukaodini","download_url":"https://codeload.github.com/ebukaodini/express-typescript-api-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248961236,"owners_count":21189993,"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","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":["expressjs","low-code","restapi-framework","typescript","validation-library"],"created_at":"2024-12-13T18:16:54.738Z","updated_at":"2026-01-20T15:37:05.810Z","avatar_url":"https://github.com/ebukaodini.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Express TypeScript API Template\n\nA robust, production-ready Express.js API template built with TypeScript, featuring comprehensive testing, documentation, and modern development practices.\n\n## 🚀 Features\n\n- **TypeScript** - Full type safety and modern JavaScript features\n- **Express.js** - Fast, unopinionated web framework\n- **Central Entry Point** - Robust application architecture with dependency injection\n- **Prisma** - Modern database toolkit with type-safe queries\n- **Jest** - Comprehensive testing suite with unit and integration tests\n- **Swagger/OpenAPI** - Interactive API documentation\n- **Winston** - Structured logging\n- **Rate Limiting** - Built-in request rate limiting\n- **Security** - Helmet.js for security headers\n- **Validation** - Class-validator for request validation\n- **Error Handling** - Custom error classes and centralized error handling\n- **Environment Configuration** - Centralized config management\n- **Docker Support** - Ready for containerization\n- **Code Quality** - Prettier, ESLint, and TypeScript strict mode\n\n## 📁 Project Structure\n\n```\nsrc/\n├── app/                   # Central entry point architecture\n│   ├── application.ts      # Main application class\n│   └── service-registry.ts # Service management\n├── bootstrap/                 # Configuration management\n│   ├── app.ts      # Express app setup\n│   ├── config.ts      # Main application class\n│   ├── errors.ts      # Custom error classes\n│   ├── modules.ts      # Main application class\n│   ├── seeders.ts      # Main application class\n│   └── services.ts      # Main application class\n├── features/               # Feature-based modules\n│   └── user/              # User feature module\n│       ├── user.controller.ts\n│       ├── user.service.ts\n│       ├── user.repo.ts\n│       ├── user.dto.ts\n│       └── user.entity.ts\n├── middlewares/            # Express middlewares\n├── services/               # Shared services\n├── utils/                  # Utility functions\n├── server.ts                 # Central entry point\n├── __tests__/             # Test files\n│   ├── unit/              # Unit tests\n│   ├── integration/       # Integration tests\n│   └── prisma.config.ts          # Test configuration\n```\n\n## 🛠️ Setup\n\n### Prerequisites\n\n- Node.js (v18 or higher)\n- PostgreSQL (v12 or higher)\n- npm or yarn\n\n### 1. Clone the repository\n\n```bash\nnpx degit https://github.com/ebukaodini/express-api-template.git my-api\ncd my-api\n```\n\n### 2. Install dependencies\n\n```bash\npnpm install\n```\n\n### 3. Environment Configuration\n\nCreate a `.env` file in the root directory:\n\n```bash\ncp .env.example .env\n```\n\nUpdate the environment variables:\n\n```env\n# Server Configuration\nPORT=3000\nNODE_ENV=development\n\n# Database Configuration\nDATABASE_URL=\"postgresql://username:password@localhost:5432/sample_api\"\n\n# CORS Configuration\nCORS_ORIGIN=\"http://localhost:3000,http://localhost:3001\"\nCORS_CREDENTIALS=true\n\n# Rate Limiting\nRATE_LIMIT_WINDOW_MS=900000\nRATE_LIMIT_MAX=100\n\n# JWT Configuration\nJWT_SECRET=\"your-super-secret-jwt-key-change-this-in-production\"\nJWT_EXPIRES_IN=\"24h\"\n\n# Logging\nLOG_LEVEL=\"debug\"\n```\n\n### 4. Database Setup\n\n```bash\n# Generate Prisma client\npnpm prisma:generate\n\n# Run database migrations\npnpm prisma:migrate\n\n# Seed the database (optional)\npnpm seed:dev\n```\n\n### 5. Start the development server\n\n**Traditional way:**\n```bash\npnpm dev\n```\n\nThe API will be available at `http://localhost:3000`\n\n## 📚 API Documentation\n\nOnce the server is running, you can access the interactive API documentation at:\n\n- **Swagger UI**: `http://localhost:3000/api-docs`\n- **Health Check**: `http://localhost:3000/health`\n\n## 🧪 Testing\n\n### Run all tests\n\n```bash\npnpm test\n```\n\n### Run tests in watch mode\n\n```bash\npnpm run test:watch\n```\n\n### Run tests with coverage\n\n```bash\nnpm run test:coverage\n```\n\n### Run integration tests only\n\n```bash\nnpm run test:integration\n```\n\n## 📝 Available Scripts\n\n| Script | Description |\n|--------|-------------|\n| `npm run dev` | Start development server with hot reload |\n| `npm run build` | Build the project for production |\n| `npm start` | Start production server |\n| `npm test` | Run all tests |\n| `npm run test:watch` | Run tests in watch mode |\n| `npm run test:coverage` | Run tests with coverage report |\n| `npm run test:integration` | Run integration tests only |\n| `npm run test:central` | Run central entry point tests |\n| `npm run example` | Run central entry point examples |\n| `npm run start:central` | Start with central entry point |\n| `npm run dev:central` | Development with central entry point |\n| `npm run lint` | Format code with Prettier |\n| `npm run lint:check` | Check code formatting |\n| `npm run prisma:migrate` | Run database migrations |\n| `npm run prisma:generate` | Generate Prisma client |\n| `npm run prisma:seed` | Seed the database |\n| `npm run docs` | Display API documentation info |\n\n## 🏗️ Architecture\n\n### Central Entry Point Architecture\n\nThis template implements a robust central entry point architecture that provides:\n\n- **Application Class** - Main orchestrator for application lifecycle\n- **Dependency Injection** - Container-based service management\n- **Service Registry** - Centralized service lifecycle management\n- **Service Factory** - Factory pattern for service creation\n- **Health Monitoring** - Comprehensive service health checks\n\n### Feature-Based Structure\n\nThe project follows a feature-based architecture where each feature is self-contained with its own:\n\n- **Controller** - Handles HTTP requests and responses\n- **Service** - Contains business logic\n- **Repository** - Handles data access\n- **DTO** - Data transfer objects for validation\n- **Entity** - Domain models\n- **Routes** - API route definitions\n\n### Error Handling\n\n- Custom error classes for different error types\n- Centralized error handling middleware\n- Structured error responses\n- Proper HTTP status codes\n\n### Logging\n\n- Winston logger with multiple transports\n- Structured logging with timestamps\n- Different log levels for different environments\n- Request/response logging\n\n### Security\n\n- Helmet.js for security headers\n- CORS configuration\n- Rate limiting\n- Input validation\n- SQL injection protection (via Prisma)\n\n## 🚀 Deployment\n\n### Docker\n\n```bash\n# Build the Docker image\ndocker build -t my-api .\n\n# Run the container\ndocker run -p 3000:3000 my-api\n```\n\n### Environment Variables for Production\n\nMake sure to set the following environment variables in production:\n\n- `NODE_ENV=production`\n- `DATABASE_URL` - Your production database URL\n- `JWT_SECRET` - A strong, random secret key\n- `CORS_ORIGIN` - Your production frontend URL\n- `LOG_LEVEL=info`\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests for your changes\n5. Ensure all tests pass\n6. Submit a pull request\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 🙏 Acknowledgments\n\n- Built with [scaffold.js](https://www.npmjs.com/package/@ebukaodini/scaffold.js)\n- Inspired by modern Node.js best practices\n- Community contributions and feedback","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febukaodini%2Fexpress-api-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Febukaodini%2Fexpress-api-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febukaodini%2Fexpress-api-template/lists"}