Skip to content

A production-ready template for building scalable API microservices following best practices and clean architecture principles.

Notifications You must be signed in to change notification settings

Nodetus-Integrators-LLC/API-Microservice-Template

Repository files navigation

API Microservice Template

A production-ready template for building scalable API microservices following best practices and clean architecture principles.

Core Features

  • Modular API routing with versioning
  • Built-in authentication and authorization
  • Database agnostic with support for multiple databases
  • Standardized error handling and responses
  • Comprehensive logging and monitoring
  • Docker and Kubernetes ready
  • Testing framework with pytest
  • OpenAPI documentation

Structure

service-name/
├── app/                  # Application core
│   ├── api/             # API endpoints and routers
│   ├── core/            # Core configurations
│   ├── models/          # Database models
│   ├── schemas/         # Request/response schemas
│   ├── services/        # Business logic
│   └── utils/           # Utilities and helpers
├── tests/               # Test suite
├── scripts/             # Operational scripts
└── docs/                # Documentation

Key Components

  • API Layer: Route definitions and request handling
  • Core: Application configuration and essential setup
  • Models: Database structure definitions
  • Schemas: Data validation and serialization
  • Services: Business logic implementation
  • Utils: Shared utilities and helpers

Usage

  1. Clone template
  2. Configure environment variables
  3. Add domain-specific models, schemas, and services
  4. Implement business logic
  5. Run tests and deploy

Customization Points

  • Add new domains under api/v1/endpoints/
  • Extend models and schemas for specific needs
  • Implement custom services
  • Configure database connections
  • Add middleware as needed

Best Practices

  • Keep endpoints thin
  • Move logic to services
  • Use dependency injection
  • Maintain consistent error handling
  • Document interfaces
  • Follow test-driven development

About

A production-ready template for building scalable API microservices following best practices and clean architecture principles.

Resources

Stars

Watchers

Forks

Packages

No packages published