A full-stack e-commerce application:
- client — React + Vite, built and served via nginx
- api — Node.js / Express
- mongo — MongoDB
A Helm chart (chart/) is included so the app can be deployed to any Kubernetes cluster, with or without ArgoCD.
- A running Kubernetes cluster and
kubectlconfigured against it - Helm 3
- A container registry (Docker Hub, GHCR, etc.) you can push images to
- (Optional) ArgoCD if you want GitOps-style auto-sync
docker build -t <registry>/<repo>:client-latest ./client
docker push <registry>/<repo>:client-latest
docker build -t <registry>/<repo>:api-latest ./api
docker push <registry>/<repo>:api-latestIf you fork this repo and add DOCKERHUB_USERNAME / DOCKERHUB_TOKEN as GitHub Actions secrets, .github/workflows/cd.yml does this automatically on every push to main and bumps chart/values.yaml with the new image tags.
The API reads its sensitive config from a Kubernetes Secret that the chart does not create for you (so credentials never end up in git). Create it once per cluster/namespace:
kubectl create secret generic api-secret \
--from-literal=CONNECTION_STRING="mongodb://<release-name>-mongo:27017/<db-name>" \
--from-literal=JWT_SECRET="<your-secret>" \
--from-literal=STRIPE_SECRET_KEY="<your-stripe-key>"
# optional, for real email delivery instead of the Ethereal test inbox:
# --from-literal=SMTP_HOST=... --from-literal=SMTP_PORT=... \
# --from-literal=SMTP_USER=... --from-literal=SMTP_PASS=... --from-literal=SMTP_FROM=...<release-name>-mongo is the mongo Service the chart creates (e.g. tech-website-mongo if you install the release as tech-website).
Edit chart/values.yaml (or pass --set) so client.image.* and api.image.* reference the registry/tags you pushed in step 1. api.existingSecret defaults to api-secret — change it if you named the secret differently.
helm install tech-website ./chart -n <namespace> --create-namespaceapiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: tech-website
namespace: <argocd-namespace>
spec:
project: default
source:
repoURL: <your fork's git URL>
targetRevision: HEAD
path: chart
destination:
server: https://kubernetes.default.svc
namespace: <namespace>
syncPolicy:
automated:
prune: true
selfHeal: trueWith this in place, every push to main that changes the chart (including the automated tag bump from cd.yml) gets picked up and synced automatically.
The chart's Services are ClusterIP, so forward them locally to try it out:
kubectl port-forward svc/tech-website-client 5173:80 -n <namespace>
kubectl port-forward svc/tech-website-api 3000:3000 -n <namespace>Then open http://localhost:5173.
Note: the client currently hardcodes
http://localhost:3000as its API base URL, and the API's CORS whitelist only allowshttp://localhost:5173/5174(api/app.js). Use those exact local ports when testing. For a real domain/ingress, both of these need to become environment-driven instead of hardcoded.
- Node.js and npm
- A local MongoDB instance (MongoDB Compass is handy for inspecting data)
# in both client/ and api/
npm install
# in api/ only
npm install dotenvCreate a .env file inside the api/ folder with the required configuration (ask a maintainer for the values).
cd client
npm run devcd api
npm start- Everyone works on their own branch before making changes, and pushes that branch when done.
- After pushing, open a pull request on GitHub. Once it's reviewed and checks pass, it gets merged into
main.