How rushikeshghodke/authsys-local-minikube works
1. Purpose and system boundary
Auth-Sys is a container-ready full-stack authentication system: a React client manages registration, login, profile, password, and avatar workflows; an Express API owns authentication and persistence; MySQL stores user identity/session state; Cloudinary is the optional avatar object store. Main application entry points are frontend/src/main.jsx and backend/index.js.
2. Client application and session state
The Vite/React SPA renders the application shell and page-level auth/profile experiences. AuthContext is the client-side identity/session boundary; pages and navigation consume it to control authenticated UI and invoke API operations.
• frontend/src/App.jsx
• frontend/src/context/AuthContext.jsx
• frontend/src/utils/api.js
Control flow: browser loads the Vite-built SPA, routes through landing/login/register/home/profile views, and sends requests to the configured /api/v1 backend. Authentication material is expected to be handled through JWTs and HTTP-only cookies, rather than exposing token management broadly in page components.
3. API server and route boundary
The Node.js/Express server exposes health and versioned REST endpoints, with auth routes mounted beneath /api/v1/auth. It is the trust boundary between browser input and protected user data.
• backend/index.js
• backend/routes/auth.routes.js
• backend/controllers/auth.controller.js
Route handlers implement registration, login/logout, refresh, current-user retrieval, password change, profile update, and avatar update. Async/error response conventions centralize controller failures and API result shapes.
4. Authentication and upload pipeline
Protected operations pass through JWT verification before reaching controllers. Registration/login validate identity, hash/check passwords with bcrypt, create/sign JWT access and refresh state, and persist refresh-token/session data. Avatar mutation crosses a multipart boundary before external upload.
• backend/middlewares/auth.middleware.js
• backend/middlewares/multer.middleware.js
• backend/utils/cloudinary.js
Control flow: request → route middleware (JWT or Multer as applicable) → controller → MySQL and, for avatars, Cloudinary → standardized API/cookie response. Cloudinary credentials are an external-service boundary and should remain server-side.
5. Persistence model
MySQL is the authoritative state store for users, password hashes, avatar URLs, and refresh tokens. The backend database adapter is the sole application-facing database integration point; schema initialization is separate from runtime server startup.
• backend/db/index.js
• backend/db/schema.sql
This creates a material consistency boundary: auth-token issuance, password changes, profile updates, and logout/refresh behavior depend on durable user-row updates.
6. Runtime packaging and deployment
Frontend and backend have independent Docker images; production frontend is served through Nginx according to the stated runtime model. Kubernetes manifests deploy frontend, backend, and MySQL as separately addressable workloads, exposing them through Services and ingress.
• frontend/Dockerfile
• backend/Dockerfile
• k8s/ingress.yaml
The MySQL deployment is stateful through persistent-volume and claim resources; backend configuration/secrets inject database, JWT, CORS, and Cloudinary settings.
• k8s/mysql-pv.yaml
• k8s/mysql-pvc.yaml
• k8s/backend-secret.yaml
7. Helm distribution
The repository also packages the three deployable tiers as Helm charts, allowing independently parameterized releases with Deployment, Service, Ingress, and HPA templates.
• helm-repo/authsys-frontend-chart/Chart.yaml
• helm-repo/authsys-backend-chart/Chart.yaml
• helm-repo/authsys-db-chart/Chart.yaml
Main entry points: auth.controller.js Auth controller · ingress.yaml Kubernetes workloads · auth.routes.js Auth routes · schema.sql MySQL
Components 18
Client SPA
- Browser
- React application shell
frontend/src/App.jsx - Auth context · Provides identity state and auth operations to pages.
frontend/src/context/AuthContext.jsx - API client · Targets the versioned backend API.
frontend/src/utils/api.js
Auth API
- Express server · Owns health and versioned REST endpoints.
backend/index.js - Auth routes · Mounted under /api/v1/auth.
backend/routes/auth.routes.js - JWT verification
backend/middlewares/auth.middleware.js - Multipart upload
backend/middlewares/multer.middleware.js - Auth controller · Handles registration, sessions, profiles, passwords, and avatars.
backend/controllers/auth.controller.js
State & storage
- Database adapter · Sole application-facing database integration point.
backend/db/index.js - MySQL · Stores users, password hashes, avatars, and refresh tokens.
backend/db/schema.sql - Cloudinary · Optional server-side object storage boundary.
backend/utils/cloudinary.js
Deployment
- Frontend image · Production SPA is served by Nginx.
frontend/Dockerfile - Backend image
backend/Dockerfile - Kubernetes workloads · Separately deploys frontend, backend, and MySQL behind Services and ingress.
k8s/ingress.yaml - MySQL persistent storage · Makes the database workload stateful.
k8s/mysql-pvc.yaml - Backend secrets · Injects database, JWT, CORS, and Cloudinary settings.
k8s/backend-secret.yaml - Helm tier charts · Separately parameterizes frontend, backend, and database releases.
helm-repo/authsys-backend-chart/Chart.yaml
Connections 19
- Browser → React application shell: loads SPA
- React application shell → Auth context: uses
- Auth context → API client: invokes
- API client → Express server: /api/v1 requests · JWTs are carried in HTTP-only cookies.
- Express server → Auth routes: mounts
- Auth routes → JWT verification: protected requests
- Auth routes → Multipart upload: avatar uploads
- JWT verification → Auth controller: verified requests
- Multipart upload → Auth controller: multipart files
- Auth routes → Auth controller: public auth requests
- Auth controller → Database adapter: users and refresh state
- Database adapter → MySQL: durable reads/writes
- Auth controller → Cloudinary: avatar upload
- Frontend image → Kubernetes workloads: frontend workload
- Backend image → Kubernetes workloads: backend workload
- Kubernetes workloads → MySQL: database workload
- MySQL persistent storage → MySQL: persistent data
- Backend secrets → Kubernetes workloads: injects backend config
- Helm tier charts → Kubernetes workloads: packages releases