This repository is a MERN-style practice project focused on Docker and Kubernetes concepts. The app consists of:
client/: React + TypeScript frontend built with Vite and served with Nginx in Dockerbackend/: Express API backend serving fake user data in Docker
- Practice Dockerizing frontend and backend services
- Exercise container build and run workflows
- Prepare for Kubernetes deployment of a multi-service stack
client/Dockerfile— multi-stage build that compiles the React app and serves it with Nginx.env— containsVITE_SERVER_URL=http://localhost:8080src/— React application source filespublic/— static assetsnginx.conf— Nginx config with SPA fallback
backend/Dockerfile— builds a Node/Express imageserver.js— starts the Express serverapp.js— Express app with CORS enabled and API routesdata/users.json— sample user data returned by the API
cd client
npm install
npm run devThe Vite frontend uses VITE_SERVER_URL=http://localhost:8080 to call the backend.
cd client
npm run buildBuild the frontend image:
cd client
docker build -t react-frontend .Run the frontend container:
docker run -d --name frontend -p 3000:3000 react-frontendThen open http://localhost:3000.
cd backend
npm install
npm startBuild the backend image:
cd backend
docker build -t server .Run the backend container:
docker run -d --name backend -p 8080:8080 serverGET /api/v1/getuser— returns user dataGET /health— health check
This repository is intended for Kubernetes practice, even if Kubernetes manifests are not present yet.
A typical Kubernetes workflow for this project would include:
- building Docker images for
frontendandbackend - pushing images to a registry
- creating
DeploymentandServicemanifests for each service - optionally using an
IngressorIngressRoutefor HTTP access - testing the app in a local Kubernetes cluster such as Minikube, Kind, or Docker Desktop
From the project root, use the following commands to start the app in a local Minikube cluster:
minikube start
minikube addons enable ingress
sudo minikube tunnel
kubectl apply -f k8s/
kubectl get pods,svc,ingress
minikube service ingress-nginx-controller -n ingress-nginx --urlThe last command will print a localhost URL such as http://127.0.0.1:58214/. Open that URL in the browser to access the frontend. The API is available at the same host under /api/v1/getuser.
- The frontend is configured to fetch backend data from
http://localhost:8080. - CORS is enabled in the backend via
app.use(cors()), so browser requests from the frontend are allowed. - If you add Kubernetes manifests, update the README with the actual manifest names and deploy commands.