This project is a modern, production-ready boilerplate for building and deploying a React frontend application. It features a lightning-fast development environment with Bun, a highly optimized containerization workflow with Docker/Podman, and a scalable deployment strategy using Kubernetes and Helm.
This boilerplate is built on a set of modern, high-performance tools chosen to create a streamlined and efficient workflow.
| Stage | Tool | Why |
|---|---|---|
| Dev/Build | Bun | No npm, fast TypeScript-native builds |
| Packaging | Docker (multi-stage) | Compact final image (~20MB) |
| Deployment | Helm + Kubernetes | Declarative, scalable, and cloud-native |
| Runtime | NGINX | Serve static React build, not a Node server |
- Frontend: React 18 with TypeScript and a beautiful UI built with Tailwind CSS.
- Development: Extremely fast development, testing, and package management powered by Bun.
- Containerization: Optimized, multi-stage
Dockerfilefor small, secure production images. Compatible with both Docker and Podman. - Deployment: Declarative deployments to any Kubernetes cluster using a production-ready Helm chart.
- Code Quality: Well-structured and refactored code with a component-based architecture.
Before you begin, ensure you have the following tools installed on your system:
- Bun: For local development and package management.
- Podman or Docker: For building and pushing container images.
- kubectl: For interacting with your Kubernetes cluster.
- Helm: For managing Kubernetes deployments.
- make: For easily running the commands defined in the
Makefile.
There are two primary ways to run this application: locally for development or deployed to a Kubernetes cluster.
For local development, you can run the application with hot-reloading using Bun's built-in development server.
-
Install Dependencies:
bun install
-
Start the Development Server:
bun run dev
The application will be available at http://localhost:5173.
To deploy the application to a Kubernetes cluster, you will need access to a container registry (like Docker Hub, GHCR, etc.) that your cluster can pull images from.
-
Configure the Registry in
values.yaml: Opencharts/frontend/values.yamland update theimage.repositoryto point to your container registry and repository. -
Build and Push the Image: Use the
makecommands to build and push your image. You will need to be logged into your container registry (podman login your-registry.io).# Build the container image make podman-build # Tag the image with your repository and a version podman tag localhost/react-bun-k8s:latest your-registry.io/your-repo:latest # Push the image podman push your-registry.io/your-repo:latest
-
Deploy with Helm: Use the
helm-upgradecommand from theMakefile. This will install or upgrade the release in thewebnamespace, creating it if it doesn't exist.make helm-upgrade
If your repository is private, make sure you have created an
imagePullSecretsin thewebnamespace and configured it in thevalues.yamlfile.
This project includes a Makefile with convenient shortcuts for common tasks.
make podman-build: Builds the container image using Podman.make podman-push IMAGE=...: Pushes a specified image to a registry.make helm-install: Installs the Helm chart.make helm-upgrade: Upgrades the Helm release.make helm-uninstall: Uninstalls the Helm release.make dev: Starts the local development server.make build: Builds the production version of the application.
.github/workflows/: Contains the CI/CD pipeline for automated deployments.charts/frontend/: The Helm chart for deploying the application to Kubernetes.public/: Static assets and the mainindex.htmlfile.src/: The React application source code.components/: Reusable React components.
Dockerfile: Multi-stage Dockerfile for building the production image.nginx.conf: Custom Nginx configuration for serving the React application.Makefile: A set of shortcuts for common development and deployment tasks.
- Server-Side Rendering (SSR): Extend the project to use SSR with Bun for improved performance and SEO.
- GitOps: Integrate with ArgoCD or FluxCD for a fully automated, GitOps-based deployment workflow.
- Alternative Web Server: Swap NGINX for Caddy for automatic HTTPS and a simpler configuration experience.
