Skip to content

Jaisheesh-2006/Cloud-Native-GitOps-SaaS-Platform

Repository files navigation

πŸŽ“ Student Management System

Go React TypeScript Docker Kubernetes Helm ArgoCD

A production-ready, full-stack CRUD application with complete DevOps pipeline

Features β€’ Architecture β€’ Quick Start β€’ DevOps β€’ API


πŸ“‹ Table of Contents


🌟 Overview

A comprehensive Student Management System demonstrating modern software development practices, from full-stack development to enterprise-grade DevOps implementation. This project showcases:

  • Backend: RESTful API built with Go, featuring clean architecture
  • Frontend: Modern React application with TypeScript
  • DevOps: Complete CI/CD pipeline with GitOps deployment to AWS EKS

ArgoCD Dashboard DevOps Pipeline


✨ Features

Application Features

Feature Description
βœ… Create Add students with validated name, age, and email
βœ… Read View all students in a responsive grid layout
βœ… Update Edit student details via modal interface
βœ… Delete Remove students with confirmation dialog
βœ… Validation Backend and frontend form validation
βœ… Error Handling Comprehensive error responses
βœ… CORS Support Cross-origin resource sharing enabled

DevOps Features

Feature Description
🐳 Containerization Multi-stage Docker builds for optimized images
☸️ Kubernetes Production deployment on AWS EKS
πŸ”„ CI/CD Automated pipeline with GitHub Actions
πŸ“¦ Helm Charts Templated Kubernetes manifests
πŸš€ GitOps ArgoCD for declarative deployments
🌐 Ingress NGINX Ingress Controller for routing
πŸ” Code Quality Automated linting with golangci-lint

πŸ— Architecture

High-Level Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                              DEVELOPER WORKFLOW                              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                             β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚   β”‚   Code   │────▢│    GitHub    │────▢│   GitHub     │────▢│  Docker  β”‚  β”‚
β”‚   β”‚   Push   β”‚     β”‚   Repository β”‚     β”‚   Actions    β”‚     β”‚   Hub    β”‚  β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                                                β”‚                     β”‚      β”‚
β”‚                                                β–Ό                     β”‚      β”‚
β”‚                                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”             β”‚      β”‚
β”‚                                    β”‚  Update Helm     β”‚             β”‚      β”‚
β”‚                                    β”‚  Chart Image Tag β”‚             β”‚      β”‚
β”‚                                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β”‚      β”‚
β”‚                                                                     β”‚      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”‚β”€β”€β”€β”€β”€β”€β”˜
                                                                      β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”‚β”€β”€β”€β”€β”€β”€β”
β”‚                              AWS EKS CLUSTER                        β”‚      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”‚β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                     β”‚      β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚      β”‚
β”‚   β”‚    ArgoCD    │────────▢│           Kubernetes Namespace       β”‚β”‚      β”‚
β”‚   β”‚   (GitOps)   β”‚         β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚β”‚      β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚  β”‚   Ingress  β”‚    β”‚   Service    β”‚  β”‚β”‚      β”‚
β”‚          β”‚                 β”‚  β”‚   (NGINX)  │───▢│  (ClusterIP) β”‚  β”‚β”‚      β”‚
β”‚          β”‚                 β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚β”‚      β”‚
β”‚          β–Ό                 β”‚                           β”‚          β”‚β”‚      β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚                           β–Ό          β”‚β”‚      β”‚
β”‚   β”‚  Helm Chart  β”‚         β”‚               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚β”‚      β”‚
β”‚   β”‚   Sync       β”‚         β”‚               β”‚    Deployment    β”‚β—€β”€β”€β”˜β”‚      β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚               β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚    β”‚      β”‚
β”‚                            β”‚               β”‚  β”‚   Pod(s)   β”‚  β”‚    β”‚      β”‚
β”‚                            β”‚               β”‚  β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”‚  β”‚    β”‚      β”‚
β”‚                            β”‚               β”‚  β”‚ β”‚Go + Reactβ”‚ β”‚  β”‚    β”‚      β”‚
β”‚                            β”‚               β”‚  β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚  β”‚    β”‚      β”‚
β”‚                            β”‚               β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚    β”‚      β”‚
β”‚                            β”‚               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚      β”‚
β”‚                            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚
β”‚                                                                           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

CI/CD Pipeline Flow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Build  │───▢│  Test   │───▢│ Code Quality │───▢│  Push   │───▢│  Update  β”‚
β”‚   Go    β”‚    β”‚  Suite  β”‚    β”‚   Linting    β”‚    β”‚ Docker  β”‚    β”‚  Helm    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                                       β”‚
                                                                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                           ArgoCD Auto-Sync                                β”‚
β”‚                    (Detects Helm values.yaml change)                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                                       β”‚
                                                                       β–Ό
                                                              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                                              β”‚   Deploy to  β”‚
                                                              β”‚   AWS EKS    β”‚
                                                              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ›  Tech Stack

Backend

Technology Purpose
Go 1.24 Primary backend language
net/http HTTP server and routing
SQLite Lightweight embedded database
go-playground/validator Request validation
cleanenv Configuration management

Frontend

Technology Purpose
React 18 UI component library
TypeScript Type-safe JavaScript
Vite Next-generation build tool
Axios HTTP client
CSS3 Styling with animations

DevOps & Infrastructure

Technology Purpose
Docker Containerization with multi-stage builds
Kubernetes Container orchestration
AWS EKS Managed Kubernetes service
Helm 3 Kubernetes package manager
ArgoCD GitOps continuous delivery
GitHub Actions CI/CD automation
NGINX Ingress Kubernetes ingress controller
golangci-lint Go code quality analysis

πŸš€ Quick Start

Prerequisites

Tool Version Purpose
Go 1.24+ Backend development
Node.js 18+ Frontend development
Docker Latest Containerization
kubectl Latest Kubernetes CLI
Helm 3.x Kubernetes deployments

Local Development

Option 1: Run Separately

Terminal 1 - Backend:

# Clone the repository
git clone https://github.com/Jaisheesh-2006/Golang-rest-api.git
cd Golang-rest-api

# Run the Go backend
go run ./cmd/students-api/main.go

Backend available at: http://localhost:8080

Terminal 2 - Frontend:

cd students-frontend
npm install
npm run dev

Frontend available at: http://localhost:3000

Option 2: Docker

# Build and run with Docker
docker build -t student-management-app .
docker run -p 8080:8080 -v $(pwd)/storage:/app/storage student-management-app

Application available at: http://localhost:8080

Option 3: Docker Compose

docker-compose up --build

πŸ”„ DevOps Pipeline

GitHub Actions CI/CD

The CI/CD pipeline is defined in .github/workflows/ci.yaml and consists of 4 stages:

Pipeline Stages

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        CI/CD PIPELINE                           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                                β”‚
β”‚  β”‚   BUILD     β”‚  β€’ Checkout code                               β”‚
β”‚  β”‚             β”‚  β€’ Set up Go 1.24                              β”‚
β”‚  β”‚             β”‚  β€’ Build binary                                β”‚
β”‚  β”‚             β”‚  β€’ Run unit tests                              β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜                                                β”‚
β”‚         β”‚                                                       β”‚
β”‚         β–Ό                                                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                                β”‚
β”‚  β”‚ CODE        β”‚  β€’ Run golangci-lint                           β”‚
β”‚  β”‚ QUALITY     β”‚  β€’ Static analysis                             β”‚
β”‚  β”‚             β”‚  β€’ Best practices check                        β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜                                                β”‚
β”‚         β”‚                                                       β”‚
β”‚         β–Ό                                                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                                β”‚
β”‚  β”‚   PUSH      β”‚  β€’ Build Docker image                          β”‚
β”‚  β”‚   DOCKER    β”‚  β€’ Multi-stage build                           β”‚
β”‚  β”‚             β”‚  β€’ Push to Docker Hub                          β”‚
β”‚  β”‚             β”‚  β€’ Tag: github.run_id                          β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜                                                β”‚
β”‚         β”‚                                                       β”‚
β”‚         β–Ό                                                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                                β”‚
β”‚  β”‚  UPDATE     β”‚  β€’ Update Helm values.yaml                     β”‚
β”‚  β”‚  HELM       β”‚  β€’ Commit new image tag                        β”‚
β”‚  β”‚             β”‚  β€’ Push to repository                          β”‚
β”‚  β”‚             β”‚  β€’ Triggers ArgoCD sync                        β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                                β”‚
β”‚                                                                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Required GitHub Secrets

Secret Description
DOCKER_HUB_USERNAME Docker Hub username
DOCKER_HUB_TOKEN Docker Hub access token
TOKEN GitHub PAT for pushing Helm updates

Docker Multi-Stage Build

The Dockerfile uses a 3-stage build for optimized image size:

# Stage 1: Build Frontend (Node.js)
FROM node:18-alpine AS frontend-builder
# Builds React app with Vite

# Stage 2: Build Backend (Go)
FROM golang:1.24-alpine AS backend-builder
# Compiles Go binary with CGO disabled

# Stage 3: Runtime (Distroless)
FROM gcr.io/distroless/cc-debian11
# Minimal runtime image (~20MB)

Benefits:

  • πŸ”’ Secure: Distroless base image with no shell
  • πŸ“¦ Small: Final image ~20MB
  • ⚑ Fast: Optimized layer caching

☸️ Kubernetes Deployment

Infrastructure Components

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        AWS EKS Cluster                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚                    NGINX Ingress Controller               β”‚  β”‚
β”‚  β”‚                                                          β”‚  β”‚
β”‚  β”‚  β€’ SSL/TLS termination                                   β”‚  β”‚
β”‚  β”‚  β€’ Path-based routing                                    β”‚  β”‚
β”‚  β”‚  β€’ Load balancing                                        β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                              β”‚                                 β”‚
β”‚                              β–Ό                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚                      Ingress Resource                     β”‚  β”‚
β”‚  β”‚                                                          β”‚  β”‚
β”‚  β”‚  Host: go-web-app.local                                  β”‚  β”‚
β”‚  β”‚  Path: / β†’ go-web-app service:80                         β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                              β”‚                                 β”‚
β”‚                              β–Ό                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚                    Service (ClusterIP)                    β”‚  β”‚
β”‚  β”‚                                                          β”‚  β”‚
β”‚  β”‚  Port: 80 β†’ targetPort: 8080                             β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                              β”‚                                 β”‚
β”‚                              β–Ό                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚                      Deployment                           β”‚  β”‚
β”‚  β”‚                                                          β”‚  β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                  β”‚  β”‚
β”‚  β”‚  β”‚     Pod 1      β”‚  β”‚     Pod N      β”‚                  β”‚  β”‚
β”‚  β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚                  β”‚  β”‚
β”‚  β”‚  β”‚  β”‚ Go + Reactβ”‚  β”‚  β”‚  β”‚ Go + Reactβ”‚  β”‚                  β”‚  β”‚
β”‚  β”‚  β”‚  β”‚   :8080   β”‚  β”‚  β”‚  β”‚   :8080   β”‚  β”‚                  β”‚  β”‚
β”‚  β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚                  β”‚  β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                  β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                                                                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Kubernetes Manifests

Located in k8s/manifests/:

File Description
deployment.yaml Pod specification and replica management
service.yaml ClusterIP service exposing port 80
ingress.yaml NGINX ingress rules for external access

Helm Chart

Located in helm/go-web-app-chart/:

helm/go-web-app-chart/
β”œβ”€β”€ Chart.yaml          # Chart metadata
β”œβ”€β”€ values.yaml         # Configurable values
└── templates/
    β”œβ”€β”€ deployment.yaml # Deployment template
    β”œβ”€β”€ service.yaml    # Service template
    └── ingress.yaml    # Ingress template

Deploy with Helm:

# Install
helm install go-web-app ./helm/go-web-app-chart

# Upgrade
helm upgrade go-web-app ./helm/go-web-app-chart

# Uninstall
helm uninstall go-web-app

ArgoCD GitOps

ArgoCD monitors the Helm chart in the repository and automatically syncs changes to the cluster.

Setup ArgoCD Application:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: go-web-app
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://github.com/Jaisheesh-2006/Golang-rest-api.git
    targetRevision: main
    path: helm/go-web-app-chart
  destination:
    server: https://kubernetes.default.svc
    namespace: default
  syncPolicy:
    automated:
      prune: true
      selfHeal: true

πŸ“‘ API Reference

Base URL: http://localhost:8080/api

Endpoints

Method Endpoint Description Request Body
POST /students Create a student { name, age, email }
GET /students List all students -
GET /students/{id} Get student by ID -
PATCH /students/{id} Update student { name, age, email }
DELETE /students/{id} Delete student -

Request/Response Examples

Create Student:

curl -X POST http://localhost:8080/api/students \
  -H "Content-Type: application/json" \
  -d '{"name": "John Doe", "age": 20, "email": "john@example.com"}'

Response:

{
  "id": 1
}

Get All Students:

curl http://localhost:8080/api/students

Response:

[
  {
    "id": 1,
    "name": "John Doe",
    "age": 20,
    "email": "john@example.com"
  }
]

Validation Rules

Field Rules
name Required, 2-100 characters
age Required, 1-150
email Required, valid email format

πŸ“ Project Structure

Golang-rest-api/
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── ci.yaml                 # GitHub Actions CI/CD pipeline
β”œβ”€β”€ cmd/
β”‚   └── students-api/
β”‚       └── main.go                 # Application entry point
β”œβ”€β”€ config/
β”‚   └── local.yaml                  # Backend configuration
β”œβ”€β”€ helm/
β”‚   └── go-web-app-chart/           # Helm chart
β”‚       β”œβ”€β”€ Chart.yaml
β”‚       β”œβ”€β”€ values.yaml
β”‚       └── templates/
β”‚           β”œβ”€β”€ deployment.yaml
β”‚           β”œβ”€β”€ service.yaml
β”‚           └── ingress.yaml
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── config.go               # Configuration loader
β”‚   β”œβ”€β”€ http/
β”‚   β”‚   └── handlers/
β”‚   β”‚       └── student/
β”‚   β”‚           └── student.go      # HTTP handlers
β”‚   β”œβ”€β”€ storage/
β”‚   β”‚   β”œβ”€β”€ storage.go              # Storage interface
β”‚   β”‚   └── sqlite/
β”‚   β”‚       └── sqlite.go           # SQLite implementation
β”‚   β”œβ”€β”€ types/
β”‚   β”‚   └── types.go                # Data types
β”‚   └── utils/
β”‚       └── responses/
β”‚           └── responses.go        # Response helpers
β”œβ”€β”€ k8s/
β”‚   └── manifests/                  # Raw Kubernetes manifests
β”‚       β”œβ”€β”€ deployment.yaml
β”‚       β”œβ”€β”€ service.yaml
β”‚       └── ingress.yaml
β”œβ”€β”€ storage/
β”‚   └── storage.db                  # SQLite database file
β”œβ”€β”€ students-frontend/              # React frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/             # React components
β”‚   β”‚   β”œβ”€β”€ pages/                  # Page components
β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”‚   └── api.ts              # API client
β”‚   β”‚   └── types/
β”‚   β”‚       └── index.ts            # TypeScript types
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ tsconfig.json
β”‚   └── vite.config.ts
β”œβ”€β”€ Dockerfile                      # Multi-stage Docker build
β”œβ”€β”€ go.mod                          # Go module dependencies
β”œβ”€β”€ go.sum                          # Go dependency checksums
└── README.md                       # This file

βš™οΈ Configuration

Backend Configuration

config/local.yaml:

env: "dev"
storage_path: "storage/storage.db"
http_server:
  address: "localhost:8080"

Environment Variables

Variable Description Default
CONFIG_PATH Path to config file ./config/local.yaml

πŸ”§ Troubleshooting

Issue Solution
Backend won't start Ensure port 8080 is free: lsof -i :8080
Frontend shows "Loading..." Verify backend is running
Docker build fails Check Docker daemon is running
Helm install fails Verify kubectl context: kubectl config current-context
ArgoCD not syncing Check ArgoCD application status in UI
Ingress not working Verify NGINX Ingress Controller is installed
Database errors Delete storage/storage.db and restart

Useful Commands

# Check pod status
kubectl get pods -l app=go-web-app

# View pod logs
kubectl logs -l app=go-web-app -f

# Check ArgoCD sync status
argocd app get go-web-app

# Force ArgoCD sync
argocd app sync go-web-app

# Check ingress
kubectl get ingress go-web-app

πŸ“š Learning Outcomes

This project demonstrates proficiency in:

Development

  • βœ… RESTful API design with Go
  • βœ… React component architecture
  • βœ… TypeScript type safety
  • βœ… Database design with SQLite

DevOps

  • βœ… Docker multi-stage builds
  • βœ… Kubernetes resource management
  • βœ… Helm chart development
  • βœ… CI/CD with GitHub Actions
  • βœ… GitOps with ArgoCD
  • βœ… Ingress configuration
  • βœ… Code quality automation

πŸ‘€ Author

Jaisheesh


πŸ“„ License

This project is open source and available under the MIT License.


⭐ Star this repository if you found it helpful!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors