A starter template for React, supercharged for seamless multi-platform deployments.
🚀 Why use this template?
✅ Solid Foundation: Based on GitHub’s official Primer React template.
✅ Universal Deployment: Pre-configured for one-click deployment to Vercel, Netlify, GitHub Pages, and Docker Hub.
✅ Modern CI/CD Pipeline: One commit triggers one build and one deploy. Each Pull Request generates preview environments accessible on Vercel, Netlify, and GitHub Pages.
✅ Modern Development Environment: Fully compatible with GitHub Codespaces or local development in VSC.
✅ Bot Usage: Keep dependencies always up to date with Dependabot, and (coming soon) code your features using Gemini CLI or Open Hands agents .
Ce README est également disponible en Français 🇫🇷 ici: 👉 docs/README_fr.md
- ✅ Modern Stack Template: React 19 + Vite + Primer.
- ✅ Standard Routing: Uses
react-router-domfor full control and maximum flexibility. - ✅ Simplified Deployment: Includes
vercel.jsonandnetlify.tomlconfig files. - ✅ CI/CD Workflow: Ready-to-use GitHub Action to build and deploy on GitHub Pages.
Click Use this template > Create a new repository.
Choose your project name and visibility.
⚠️ GitHub Pages does not work with free private repositories.
-
With CodeSpaces:
<> Code>Codespacestab >Create codespace on main -
With local VSC:
git clone https://github.com/YOUR_USER/YOUR_REPO.git cd YOUR_REPOOpen VSC and launch a terminal, then:
npm install npm run dev
Once your repo is created, GitHub will generate a first commit titled “Initial commit” and push it to main. This push automatically triggers the deploy.yml workflow.
This action runs 4 jobs:
- Build the React code.
- Deploy to production on GitHub Pages.
- Deploy a preview on GitHub Pages.
- Build a container and upload it to Docker Hub.
For the first commit, since your repository is not yet configured, the Docker job fails, and the preview job is skipped (only triggered on Pull Requests).
Therefore, the "Deploy & Preview" workflow fails, which is expected until you configure your GitHub repo to unlock all the features of r3edge-primer-react.
This template uses a deployment strategy with a dedicated gh-pages branch.
This is the most robust way to handle both production and temporary preview environments for Pull Requests.
Concept of the gh-pages branch:
- Your
mainbranch holds the source code of your app (React, JSX, etc.). - The
gh-pagesbranch contains the compiled, ready-to-serve website (pure HTML, CSS, JS). - The GitHub Actions workflow compiles
mainand automatically pushes the result togh-pages.
Required Actions:
- Go to your repo’s settings:
Settings>Pages. - In
Build and deployment, underSource, selectDeploy from a branch. - Configure:
- Branch:
gh-pages - Folder:
/(root)
- Branch:
- Click Save.
This tells GitHub to serve the content of gh-pages as your website.
The workflow needs secrets to connect to external services like Docker Hub.
- Go to:
Settings>Secrets and variables>Actions. - Add the following repository secrets:
DOCKERHUB_USERNAME: Your Docker Hub username.DOCKERHUB_TOKEN: A Docker Hub personal access token withRead & Writepermissions.
The GITHUB_TOKEN is automatically provided by GitHub and requires no setup.
This template is ready for deployment on Vercel and Netlify.
- Create a new project on Vercel or Netlify.
- Connect your GitHub repo.
- These platforms automatically detect the config files (
vercel.jsonornetlify.toml) and apply the correct build settings (npm run build) and output directory (dist).
Important Note for Vercel:
By default, Vercel attempts to build every branch, includinggh-pages.
This fails sincegh-pagescontains a pre-built site, not source code.To fix this:
- Go to
Settings>Gitin your Vercel project.- Find Ignored Build Step.
- Paste this command:
if [[ "$VERCEL_GIT_COMMIT_REF" == "gh-pages" ]] ; then exit 0; else exit 1; fi- Save. This cleanly cancels builds for
gh-pageswithout error.
PR previews are automatically supported by Vercel and Netlify, no extra setup needed.
- Vercel: Lifecycle tied to the Git branch. Deleting the branch after merging a PR deletes all previews.
- Netlify: Lifecycle tied to the PR itself. Closing or merging the PR deletes the preview.
- GitHub Pages (our solution): No automatic cleanup. Preview folders (e.g.,
/pr-preview/pr-123/) persist even after PR closure. This is intentional for history keeping but can be modified to include cleanup if needed.
- Push on
main: Triggers production deployment. - Pull Request to
main: Triggers preview deployment.
- Deploy to GitHub Pages: The site updates on its main branch.
- Production URL: https://dsissoko.github.io/r3edge-primer-react/
- Publish to Docker Hub: A new Docker
latestimage is built and pushed.
- Each Pull Request automatically gets a preview version deployed at a unique URL.
- The workflow posts a comment in the PR with the direct preview link for instant visual review. Example: https://dsissoko.github.io/r3edge-primer-react/pr-preview/pr-19/.
- Docker: Installed and running.
- Docker Hub Auth: A Docker Hub account, logged in via terminal.
-
Create your config file:
cp docker/.env.example docker/.env
Edit
docker/.envto include your Docker Hub username. -
Login to Docker Hub:
docker login
- Make the build script executable:
chmod +x docker/build.sh
- Run the script:
./docker/build.sh
docker run -p 8080:80 -e BACKEND_API_URL="https://your-app.domain.com/api" yourusername/r3edge-primer-react:latestOpen http://localhost:8080.
✅ This app relies on:
- Node 20 (Docker build)
- React 19.1 + React DOM 19
- Vite 7 +
@vitejs/plugin-react - Primer React 37 &
@primer/octicons-react - React Router DOM 7
- Styled-components 5
- ESLint 9 + PostCSS 10
- Nginx (production server)
- Unit test examples (Vitest + React Testing Library)
- AI bots Open Hands and Gemini CLI
📫 Maintained by @dsissoko – This project is an evolution of the official Primer React template.


