Skip to content

abdul23lm/go-microservice-skeleton

Repository files navigation

Go Microservice Template

Go Version License: MIT

A production-ready Go project skeleton for building microservices, designed with Clean Architecture, Docker support, and cloud-native practices.

📦 Features

  • Clean Architecture: Separated layers (domain, repositories, services, controllers).
  • Docker Integration: Pre-configured Dockerfile and docker-compose.yml.
  • Kafka Event Streaming: Example producer/consumer setup.
  • GCP Support: Cloud SQL, Pub/Sub, and Storage helpers.
  • Authentication: JWT middleware with role-based access.
  • CI/CD: Jenkins pipeline example for automated testing and deployment.

🚀 Getting Started

Prerequisites

  • Go 1.21+
  • Docker
  • Apache Kafka (local or cloud instance)

Installation

  1. Clone the repository:

    git clone git@github.com:abdul23lm/go-microservice-skeleton.git [your-service]
  2. Navigate to the project directory:

    cd [your-service]

📂 Directory Structure

  • cmd/: Main application entrypoints.
  • config/: Environment configurations.
  • controllers/: HTTP/gRPC handlers.
  • domain/: Core business models and interfaces.
  • repositories/: Database/ORM layer (e.g., PostgreSQL, Firestore).
  • services/: Business logic layer.
  • routes/: API endpoint definitions.
  • middlewares/: Authentication, logging, etc.
  • common/: Shared utilities (logging, errors).
  • clients/: Third-party API clients (e.g., Stripe, GCP).
  • Dockerfile: Container configuration.
  • docker-compose.yml: Local development stack.
  • Makefile: Build/test shortcuts.

🔧 Configuration

Update .env in the config folder with your environment-specific values:

APP_PORT=8080
DB_URL=postgres://user:pass@host:port/dbname
KAFKA_BROKERS=localhost:9092

🐳 Docker Deployment

To run the application locally with Docker:

docker-compose up --build

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages