Skip to content

XDcobra/gofiber-starter-stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

48 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

GoFiber Starter Stack

๐Ÿš€ A production-ready Go Fiber microservices template with multiple deployment options, featuring Redis clustering, MySQL database, comprehensive monitoring, and observability solutions.


๐ŸŽฏ What This Repository Offers

This repository provides a complete microservices stack built with Go Fiber that can be deployed using either:

  • ๐Ÿณ Docker Compose - For local development and simple deployments
  • โ˜ธ๏ธ Kubernetes with Helm - For production-ready cloud deployments

๐ŸŒŸ Key Features

  • Go Fiber API Gateway - High-performance HTTP framework with built-in middleware
  • Redis Cluster - Master-slave replication with Redis Sentinel for high availability
  • MySQL Database - Relational database with GORM ORM integration
  • Comprehensive Monitoring Stack:
    • Prometheus - Metrics collection and monitoring
    • Grafana - Data visualization and dashboards
    • Loki & Promtail - Log aggregation and querying (Kubernetes only)
  • Redis Insight - Redis GUI for database management
  • Go Swagger Documentation - Auto-generated API documentation
  • Prometheus Auto Service Discovery - Automatic service monitoring (Kubernetes only)

๐Ÿš€ Quick Start

Choose your deployment method:

๐Ÿณ Docker Compose (Local Development)

Perfect for local development, testing, and simple deployments.

๐Ÿ“– Click here for Docker Compose Documentation

# Quick start with Docker Compose
git clone https://github.com/XDcobra/gofiber-starter-stack.git
cd gofiber-starter-stack
make docker-start

โ˜ธ๏ธ Kubernetes with Helm (Production)

Enterprise-ready deployment with advanced features like log aggregation and auto service discovery.

๐Ÿ“– Click here for Kubernetes/Helm Documentation

# Quick start with Kubernetes
git clone https://github.com/XDcobra/gofiber-starter-stack.git
cd gofiber-starter-stack/charts/gofiber-starter-stack
helm install gofiber-starter-stack .

๐Ÿ—๏ธ Architecture Overview

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   API Gateway   โ”‚    โ”‚     Grafana     โ”‚    โ”‚   Prometheus    โ”‚
โ”‚   (Go Fiber)    โ”‚    โ”‚   (Port 3000)   โ”‚    โ”‚   (Port 9090)   โ”‚
โ”‚   (Port 8000)   โ”‚    โ”‚                 โ”‚    โ”‚                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚                       โ”‚                       โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚              Redis Cluster                      โ”‚
         โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
         โ”‚  โ”‚  Master โ”‚ โ”‚  Slave  โ”‚ โ”‚Sentinel1โ”‚ โ”‚Sentinel2โ”‚ โ”‚
         โ”‚  โ”‚ (6379)  โ”‚ โ”‚ (6379)  โ”‚ โ”‚ (26379) โ”‚ โ”‚ (26380) โ”‚ โ”‚
         โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
         โ”‚                    โ”‚                    โ”‚         โ”‚
         โ”‚              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”‚
         โ”‚              โ”‚Sentinel3โ”‚         โ”‚Redis    โ”‚     โ”‚
         โ”‚              โ”‚(26381)  โ”‚         โ”‚Insight  โ”‚     โ”‚
         โ”‚              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ”‚(5540)   โ”‚     โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚              MySQL Database                     โ”‚
         โ”‚              (Port 3306)                        โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚              Loki & Promtail                   โ”‚
         โ”‚              (Kubernetes Only)                 โ”‚
         โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”           โ”‚
         โ”‚  โ”‚  Loki   โ”‚ โ”‚Promtail1โ”‚ โ”‚Promtail2โ”‚           โ”‚
         โ”‚  โ”‚ (3100)  โ”‚ โ”‚         โ”‚ โ”‚         โ”‚           โ”‚
         โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜           โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“‹ Prerequisites

For Docker Compose

  • Docker and Docker Compose
  • Go 1.24.4 or higher
  • Git

For Kubernetes/Helm

  • Kubernetes cluster (minikube, kind, or cloud provider)
  • Helm 3.x
  • kubectl configured
  • Ingress controller (nginx-ingress recommended)

๐Ÿ”ง API Endpoints

Health Check

  • GET / - API health check

Redis Operations

  • GET /redis/ping - Redis connection test
  • GET /redis/get - Get value from Redis
  • POST /redis/post - Set value in Redis

MySQL Operations

  • GET /mysql/get/:id - Get record by ID
  • POST /mysql/post - Create new record

Documentation & Monitoring

  • GET /swagger/* - Swagger API documentation
  • GET /metrics - Prometheus metrics endpoint

๐Ÿ” Security Features

Both deployment methods include:

  • Authentication for monitoring dashboards (Prometheus, Grafana)
  • Database security with configurable credentials
  • Service isolation and network security
  • Environment-based configuration management

๐Ÿ“Š Monitoring & Observability

Docker Compose

  • Prometheus metrics collection
  • Grafana dashboards
  • Basic logging

Kubernetes/Helm

  • Enhanced monitoring with auto service discovery
  • Centralized logging with Loki & Promtail
  • Advanced dashboards and alerting
  • Service mesh ready architecture

๐Ÿš€ Production Deployment

Docker Compose

  • Suitable for small to medium deployments
  • Easy to set up and maintain
  • Good for development and testing environments

Kubernetes/Helm

  • Enterprise-grade scalability and reliability
  • Auto-scaling and load balancing
  • Advanced monitoring and logging
  • Multi-environment support (dev, staging, prod)

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ™ Acknowledgments


๐Ÿ“ž Support

If you have any questions or need help, please open an issue on GitHub.

About

๐Ÿš€ Production-ready Go Fiber microservices template with Helm Chart & Docker Compose, HA Redis clustering, MySQL, Prometheus monitoring, Grafana visualization and Log aggregation with Loki & Promtail

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors