{"id":34694059,"url":"https://github.com/ibnabdullah1/fastify-prisma-starter","last_synced_at":"2026-03-12T22:33:17.225Z","repository":{"id":328754539,"uuid":"1116569268","full_name":"ibnabdullah1/fastify-prisma-starter","owner":"ibnabdullah1","description":"Production-ready Node.js Fastify Prisma starter for REST API with authentication, Docker, and TypeScript","archived":false,"fork":false,"pushed_at":"2025-12-15T06:23:34.000Z","size":463,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-13T19:36:59.943Z","etag":null,"topics":["authentication","backend","clean-architecture","docker","fastify","fastify-prisma","fastify-starter","jwt-auth","nodejs","nodejs-api","prisma","prisma-starter","rest-api","scaffold","starter","starter-template","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/ibnabdullah1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"DOCS/CONTRIBUTING.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-15T04:25:16.000Z","updated_at":"2025-12-15T09:31:58.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ibnabdullah1/fastify-prisma-starter","commit_stats":null,"previous_names":["ibnabdullah1/nodejs-fastify-prisma-starter"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ibnabdullah1/fastify-prisma-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibnabdullah1%2Ffastify-prisma-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibnabdullah1%2Ffastify-prisma-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibnabdullah1%2Ffastify-prisma-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibnabdullah1%2Ffastify-prisma-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ibnabdullah1","download_url":"https://codeload.github.com/ibnabdullah1/fastify-prisma-starter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibnabdullah1%2Ffastify-prisma-starter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30446445,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T21:31:01.033Z","status":"ssl_error","status_checked_at":"2026-03-12T21:30:43.161Z","response_time":114,"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":["authentication","backend","clean-architecture","docker","fastify","fastify-prisma","fastify-starter","jwt-auth","nodejs","nodejs-api","prisma","prisma-starter","rest-api","scaffold","starter","starter-template","typescript"],"created_at":"2025-12-24T22:13:48.647Z","updated_at":"2026-03-12T22:33:17.218Z","avatar_url":"https://github.com/ibnabdullah1.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node.js Fastify Prisma Starter\n\n**Production-ready Node.js Fastify Prisma starter** for building scalable REST APIs with TypeScript, PostgreSQL, and modern development practices. A clean architecture Fastify Prisma boilerplate with JWT authentication, Docker support, and comprehensive documentation.\n\n## Why this Fastify Prisma starter?\n\nThis **Node.js Fastify Prisma starter template** provides everything you need to build production-ready REST APIs quickly. Built with Fastify (high-performance web framework), Prisma ORM (type-safe database access), and TypeScript for a robust development experience.\n\n## 🚀 Features\n\nThis **Fastify Prisma TypeScript starter** includes:\n\n- **🔧 Tech Stack**: Node.js, Fastify, TypeScript, PostgreSQL, Prisma ORM\n- **🔐 Authentication**: JWT-based authentication with refresh tokens (Fastify Prisma authentication starter)\n- **👥 User Management**: Complete user CRUD with role-based access control\n- **📁 File Upload**: Cloudinary integration for media management\n- **📧 Email Service**: Nodemailer integration for email functionality\n- **🛡️ Security**: Helmet, CORS, rate limiting, input validation\n- **📊 Database**: PostgreSQL with Prisma ORM for type-safe operations\n- **🧪 Testing**: Jest setup with coverage reporting\n- **📝 Code Quality**: ESLint, Prettier, Husky for code standards\n- **🐳 Docker**: Dockerized Fastify Prisma starter with docker-compose\n- **📚 Documentation**: Comprehensive documentation and API reference\n- **🔄 CI/CD Ready**: GitHub Actions workflow templates\n- **⚡ Module Generation**: Automated module creation and renaming scripts\n\n## 📋 Prerequisites\n\n- **Node.js** (v16 or higher)\n- **npm** or **yarn** package manager\n- **PostgreSQL** database\n- **Git**\n\n## ⚡ Getting Started with Node.js Fastify Prisma Boilerplate\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/ibnabdullah1/nodejs-fastify-prisma-starter.git\ncd nodejs-fastify-prisma-starter\n```\n\n### 2. Install Dependencies\n\n```bash\nnpm install\n```\n\n### 3. Environment Setup\n\n```bash\n# Copy environment template\ncp env.example .env\n\n# Edit .env with your configuration\nnano .env\n```\n\n### 4. Database Setup\n\n```bash\n# Generate Prisma client\nnpm run db:generate\n\n# Run database migrations\nnpm run migrate\n\n# (Optional) Seed the database\nnpm run db:seed\n```\n\n### 5. Start Development Server\n\n```bash\nnpm run dev\n```\n\nYour server will be running at `http://localhost:5000`\n\n## 🛠️ Available Scripts\n\n### Development\n- `npm run dev` - Start development server with hot reload\n- `npm run build` - Build the project for production\n- `npm run start` - Start production server\n\n### Database\n- `npm run migrate` - Run database migrations\n- `npm run migrate:deploy` - Deploy migrations to production\n- `npm run migrate:reset` - Reset database\n- `npm run db:studio` - Open Prisma Studio\n- `npm run db:generate` - Generate Prisma client\n- `npm run db:seed` - Seed database with sample data\n\n### Code Quality\n- `npm run lint` - Run ESLint\n- `npm run lint:fix` - Fix ESLint errors\n- `npm run format` - Format code with Prettier\n- `npm run type-check` - Run TypeScript type checking\n\n### Module Scripts\n- `npm run create-module \u003cname\u003e` - Create a new module with complete structure\n- `npm run rename-module \u003cold\u003e \u003cnew\u003e` - Rename an existing module and update all references\n\n### Testing\n- `npm test` - Run tests\n- `npm run test:watch` - Run tests in watch mode\n- `npm run test:coverage` - Run tests with coverage\n\n### Docker\n- `npm run docker:build` - Build Docker image\n- `npm run docker:run` - Run Docker container\n- `npm run docker:compose` - Start with docker-compose\n\n## 📁 Project Structure\n\n```\nsrc/\n├── controllers/         # Request handlers\n├── services/           # Business logic\n├── models/             # Data models\n├── middleware/         # fastify middleware\n├── utils/              # Utility functions\n├── types/              # TypeScript type definitions\n├── constants/          # Application constants\n├── validators/         # Request validation schemas\n├── database/           # Database configuration\n├── routes/             # Route definitions\n├── config/             # Configuration files\n├── scripts/            # Utility scripts\n├── templates/          # Email templates\n├── tests/              # Test files\n├── app.ts              # fastify app configuration\n└── server.ts           # Server entry point\n```\n\n## 🔧 Configuration\n\n### Environment Variables\n\nSee `env.example` for all available environment variables:\n\n- **Database**: PostgreSQL connection string\n- **JWT**: Authentication secrets and expiration times\n- **Email**: SMTP configuration for email sending\n- **Cloudinary**: File upload and storage\n- **Security**: CORS, rate limiting, and other security settings\n\n### Database Schema\n\nThe template includes the following models:\n\n- **User**: User authentication and profile management\n- **Media**: File upload and metadata storage\n\n## 🛠️ Module Generation\n\nThis **Fastify Prisma starter template for Node.js** includes powerful scripts to quickly generate and manage modules with clean architecture patterns.\n\n### Create a New Module\n\nGenerate a complete module structure with all necessary files:\n\n```bash\nnpm run create-module \u003cmodule-name\u003e\n\n# Examples:\nnpm run create-module product\nnpm run create-module order\nnpm run create-module category\n```\n\n**Generated Files:**\n- `module.routes.ts` - Fastify plugin routes with authentication\n- `module.controller.ts` - Request handlers (FastifyRequest/FastifyReply)\n- `module.service.ts` - Business logic with Prisma\n- `module.interface.ts` - TypeScript interfaces\n- `module.validation.ts` - Zod validation schemas\n- `module.constant.ts` - Module constants\n\n**After creating a module:**\n\n1. **Register routes** in `src/app/routes/index.ts`:\n```typescript\nimport { ProductRoutes } from \"../modules/product/product.routes\";\n\nconst router = async (fastify: FastifyInstance) =\u003e {\n  fastify.register(ProductRoutes, { prefix: \"/product\" });\n};\n```\n\n2. **Update Prisma schema** (`prisma/schema.prisma`):\n```prisma\nmodel Product {\n  id        Int      @id @default(autoincrement())\n  name      String\n  createdAt DateTime @default(now())\n  updatedAt DateTime @updatedAt\n}\n```\n\n3. **Run migrations**:\n```bash\nnpm run migrate\n```\n\n### Rename a Module\n\nRename an existing module and update all references:\n\n```bash\nnpm run rename-module \u003cold-name\u003e \u003cnew-name\u003e\n\n# Examples:\nnpm run rename-module product item\nnpm run rename-module order purchase\n```\n\n**What it does:**\n- Renames the module directory\n- Updates all file contents (lowercase and capitalized names)\n- Renames files if they contain the module name\n- Updates all references throughout the codebase\n\n**Important:** After renaming, manually update:\n- Route registrations in `src/app/routes/index.ts`\n- Prisma schema if needed\n- Any other external references\n\n## 🚀 Deployment\n\n### Docker Deployment\n\n```bash\n# Build and start with docker-compose\nnpm run docker:compose\n\n# Or build and run manually\nnpm run docker:build\nnpm run docker:run\n```\n\n### Manual Deployment\n\n1. **Build the application**:\n   ```bash\n   npm run build\n   ```\n\n2. **Set up production environment**:\n   ```bash\n   cp env.example .env\n   # Configure production environment variables\n   ```\n\n3. **Run database migrations**:\n   ```bash\n   npm run migrate:deploy\n   ```\n\n4. **Start the application**:\n   ```bash\n   npm start\n   ```\n\n## 📚 Documentation\n\nComprehensive documentation is available in the `DOCS/` directory:\n\n- **[Quick Start Guide](./DOCS/QUICK_START.md)** - Get started in 5 minutes\n- **[API Documentation](./DOCS/API_DOCUMENTATION.md)** - Complete API reference\n- **[Project Structure](./DOCS/PROJECT_STRUCTURE.md)** - Detailed project organization\n- **[Deployment Guide](./DOCS/DEPLOYMENT_GUIDE.md)** - Production deployment\n- **[Troubleshooting](./DOCS/TROUBLESHOOTING.md)** - Common issues and solutions\n\n## 🧪 Testing\n\n```bash\n# Run all tests\nnpm test\n\n# Run tests in watch mode\nnpm run test:watch\n\n# Run tests with coverage\nnpm run test:coverage\n```\n\n## 🔍 Code Quality\n\nThe project includes:\n\n- **ESLint** for code linting\n- **Prettier** for code formatting\n- **Husky** for git hooks\n- **lint-staged** for pre-commit checks\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests if applicable\n5. Submit a pull request\n\nSee [Contributing Guide](./DOCS/CONTRIBUTING.md) for detailed information.\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 🆘 Support\n\n- **Documentation**: Check the `DOCS/` directory\n- **Issues**: Create an issue on GitHub\n- **Discussions**: Use GitHub Discussions for questions\n\n## 🙏 Acknowledgments\n\n- [Fastify](https://fastify.dev/) - Web framework\n- [Prisma](https://www.prisma.io/) - Database ORM\n- [TypeScript](https://www.typescriptlang.org/) - Type safety\n- [PostgreSQL](https://www.postgresql.org/) - Database\n\n---\n\n**Happy Coding! 🎉**\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibnabdullah1%2Ffastify-prisma-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibnabdullah1%2Ffastify-prisma-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibnabdullah1%2Ffastify-prisma-starter/lists"}