Colombiaproyecto26/MyAPI
A template to create awesome APIs easily ⚡️
⚡ MyAPI — Template NestJS "bật là chạy" cho REST API production
Starter kit NestJS đầy đủ batteries-included: auth, validation, migrations, logging, tests — clone, cài đặt, code business logic ngay.
MyAPI là template NestJS do Proyecto 26 duy trì, mục tiêu giúp team backend khởi tạo dự án API mới trong vài phút thay vì vài ngày setup boilerplate. Nó gói sẵn các quyết định kiến trúc phổ biến (Repository pattern, Guards, Pipes, Interceptors) và công cụ đi kèm (TypeORM, Passport, class-validator, Winston, Swagger) theo cấu trúc module rõ ràng, dễ mở rộng. Dự án cung cấp 2 nhánh: master dùng PostgreSQL/SQL và nosql dùng MongoDB — cùng API surface, khác chỉ data layer.
✨ Điểm nổi bật
- Khởi động tức thì với live-reload:
yarn start:devwatch file TypeScript, compile & restart tự động. - Repository pattern sẵn sàng: abstract data access, dễ swap implementation, test unit tách biệt DB.
- OpenAPI/Swagger tự động: decorators trên controller/dto sinh spec, UI tại
/api. - JWT + Passport built-in: strategy, token refresh, hash password (bcrypt), guard bảo vệ route.
- RBAC với Guards: decorator
@Roles('admin', 'editor')trên handler, guard check permission tập trung. - Validation pipes dùng class-validator: DTO có decorator (
@IsEmail,@IsOptional, v.v.) tự chặn payload sai trước khi vào service. - Winston logger đa cấp độ (error, warn, info, debug, verbose) + format JSON cho log aggregation.
- TypeORM migrations CLI:
yarn migration:create,yarn migration,yarn migration:revert— versioning schema an toàn. - CORS configurable: whitelist domain cho resource nhạy cảm (mobile/web app riêng).
- Test harness đầy đủ: unit (
yarn test), e2e (yarn test:e2e), coverage (yarn test:cov).
💡 Vì sao đáng chú ý
Khác với các starter "hello world" chỉ có controller/service rỗng, MyAPI đưa ra opinionated baseline đã battle-test trong thực tế: cấu trúc module theo feature, separation of concerns rõ ràng (dto, entity, repository, service, controller), error handling tập trung, và config qua .env theo 12-factor. Điều này giúp team vừa onboard dev mới nhanh, vừa tránh technical debt ban đầu do tự setup lẻ tẻ. Demo live tại https://myapi-template.herokuapp.com/api cho thấy Swagger UI hoạt động ngay. Phù hợp cho: microservice mới, BFF layer, admin panel backend, hoặc bất kỳ REST API nào cần auth/validation/logging/migration từ ngày 1.
#NestJS #TypeScript #API #StarterTemplate #TypeORM #OpenSource #TiniX
Dự án tương tự
Khám phá các dự án và mô hình AI khác có sự tương đồng.
NestJS CRUD for RESTful API 使用 NestJS + Mysql + Typeorm + Redis + JWT + Swagger 企业中后台管理系统项目RBAC权限管理(细粒度到按钮)、实现单点登录等...
A production-ready 🏭 NestJS boilerplate with batteries 🔋 included. No Kidding! Now Supports NestJS V10!!
Production-ready NestJS boilerplate featuring JWT authentication, TypeORM, RBAC, Swagger, and Docker support. Built for enterprise-grade Node.js applications
NestJS 12 boilerplate with JWT, OAuth (Google & Apple), TOTP/2FA, RBAC, and multi-workspace tenancy. Prisma on MongoDB, modular repository layer, native ESM. Production-ready.
Hybrid NestJs v9.x Boilerplate. Repository Design Pattern. Kafka Microservice. MongoDB(mongoose). Support Containerization.
OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
A curated list of free public APIs — searchable, community-maintained, with a free JSON API.
Development tool to mock API endpoints quickly and easily - NOT MAINTAINED