An open API service indexing awesome lists of open source software.

https://github.com/xdcobra/gofiber-starter-stack

πŸš€ Production-ready Go Fiber microservices template with Docker Compose, HA Redis clustering, MySQL, Prometheus monitoring, and Grafana visualization.
https://github.com/xdcobra/gofiber-starter-stack

boilerplate docker docker-compose go gofiber golang gorm grafana high-availability monitoring mysql orm prometheus redis sentinel template

Last synced: 3 months ago
JSON representation

πŸš€ Production-ready Go Fiber microservices template with Docker Compose, HA Redis clustering, MySQL, Prometheus monitoring, and Grafana visualization.

Awesome Lists containing this project

README

          

# 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](./services/README.md)**

```bash
# 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](./charts/README.md)**

```bash
# 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](LICENSE) file for details.

---

## πŸ™ Acknowledgments

- [Go Fiber](https://gofiber.io/) - Fast HTTP framework
- [GORM](https://gorm.io/) - Go ORM library
- [Redis](https://redis.io/) - In-memory data store
- [Prometheus](https://prometheus.io/) - Monitoring system
- [Grafana](https://grafana.com/) - Data visualization
- [Loki](https://grafana.com/oss/loki/) - Log aggregation
- [Helm](https://helm.sh/) - Kubernetes package
- [Go Swagger](https://github.com/gofiber/swagger) - Swagger for GoFiber

---

## πŸ“ž Support

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