Skip to content

πŸƒ Template for building microservice using golang πŸš€, Also consisting various architechtural πŸ›οΈ design pattern.

License

Notifications You must be signed in to change notification settings

akash-aman/microservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

88 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Microservice

  • A microservice template for building robust, scalable applications in Golang.

Implementation Details

Packages

  • SQLC – Generates type-safe Go code from SQL queries, improving database interactions.
  • Viper – A powerful configuration management tool for environment variables, config files, and flags.
  • Echo – A high-performance, extensible, and minimalist web framework for building APIs.
  • Ent – A Go entity framework for struct-based ORM, simplifying database modeling.
  • GraphQL – A Go GraphQL server implementation with a focus on code generation.
  • WebSocket – A highly optimized WebSocket implementation for real-time communication.
  • OpenTelemetry – Provides observability (tracing, metrics, logs) for distributed systems.
  • Zap – A high-performance, structured logging library by Uber.
  • Consul – A service discovery and configuration tool for dynamic service registration and health checking.
  • Fx – A dependency injection framework for simplifying application initialization and lifecycle management.
  • Ants – A high-performance goroutine pool in Go.

Custom

  • Workerpool : Added Implementation adaptive and fix workerpool.

Folder Structure

Top Level View

β”œβ”€β”€ pkg
└── services
    β”œβ”€β”€ inventory
    └── products
  • pkg: Contains shared packages for different services.

Product Service

β”œβ”€β”€ app
β”‚   β”œβ”€β”€ apis
β”‚   β”‚   β”œβ”€β”€ coupons
β”‚   β”‚   └── products
β”‚   β”‚       β”œβ”€β”€ get_all
β”‚   β”‚       └── get_by_id
β”‚   β”‚           β”œβ”€β”€ v1
β”‚   β”‚           β”‚   β”œβ”€β”€ dtos
β”‚   β”‚           β”‚   β”œβ”€β”€ endpoints
β”‚   β”‚           β”‚   β”œβ”€β”€ handler
β”‚   β”‚           β”‚   └── model
β”‚   β”‚           └── v2
β”‚   β”œβ”€β”€ core
β”‚   β”‚   β”œβ”€β”€ constants
β”‚   β”‚   β”œβ”€β”€ contracts
β”‚   β”‚   β”œβ”€β”€ errors
β”‚   β”‚   β”œβ”€β”€ helpers
β”‚   β”‚   β”œβ”€β”€ middlewares
β”‚   β”‚   └── models
β”‚   β”œβ”€β”€ data
β”‚   β”œβ”€β”€ infra
β”‚   β”‚   β”œβ”€β”€ bulk-factory
β”‚   β”‚   β”œβ”€β”€ scheduler
β”‚   β”‚   └── states
β”‚   β”œβ”€β”€ inits
β”‚   └── view
β”œβ”€β”€ cmd
β”œβ”€β”€ conf
β”œβ”€β”€ docs
β”œβ”€β”€ logs
β”œβ”€β”€ cgfx
β”œβ”€β”€ server
└── sqlc
  • app: Contains the main application code.
    • apis: API related code.
      • coupons: API endpoints and handlers for coupons.
      • products: API endpoints and handlers for products.
        • get_all: Endpoint to get all products.
        • get_by_id: Endpoint to get a product by ID.
          • v1: Version 1 of the get_by_id endpoint.
            • dtos: Data Transfer Objects for v1.
            • endpoints: Endpoint definitions for v1.
            • handler: Handlers for v1.
            • model: Models for v1.
          • v2: Version 2 of the get_by_id endpoint.
    • core: Core functionalities and utilities.
      • constants: Constant values used across the application.
      • contracts: Interface definitions and contracts.
      • errors: Error handling and definitions.
      • helpers: Helper functions and utilities.
      • middlewares: Middleware functions.
      • models: Data models and schemas.
    • data: Data access layer.
    • grpc: Grpc server implementation, and grpc client client setup.
    • infra: Infrastructure related code.
      • bulk-factory: Bulk processing utilities.
      • scheduler: Task scheduling utilities.
      • states: State management utilities.
    • inits: Initialization scripts and configurations.
    • view: View layer code.
  • cmd: Command line interface related code.
  • conf: Configuration files.
  • docs: Documentation files.
  • cgfx: Code generation frameworks like entity framework, sqlc, gqlgen.
  • logs: Error & access logs.
  • server: Server related code.
  • sqlc: SQL code and database migrations.

About

πŸƒ Template for building microservice using golang πŸš€, Also consisting various architechtural πŸ›οΈ design pattern.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages