Automatic deployment of React preview environments.
2.4K
A lightweight, standalone, and self-hosted tool to automatically deploy and serve preview environments for every branch of your React/Vite applications.
Fully powered by Node.js and Express, this project replaces complex infrastructures with a simple "plug & play" Docker container. It natively supports multiple repositories through a JSON configuration file.
projects.json configuration.index.html for client-side routing (React Router, Vue Router).npm run build and outputting a dist/ folder.You can configure the server using environment variables for a single project, or a projects.json file for multiple projects.
| Variable | Description | Required |
|---|---|---|
REPO_URL | HTTPS URL of your Git repository. | Yes |
GIT_TOKEN | Personal Access Token (PAT) for private repositories. | No |
BRANCH_REGEX | Regex to filter branches (e.g., ^feature/). | No |
INTERVAL_SECONDS | Polling interval in seconds (default: 120). | No |
docker run -d \
-e REPO_URL="https://github.com/your-account/your-app.git" \
-p 8080:80 \
--name react-preview \
react-preview-nodeCreate a projects.json file on your host machine to track multiple repositories.
[
{
"REPO_URL": "https://github.com/your-account/app-one.git",
"GIT_TOKEN": "your_token",
"BRANCH_REGEX": "^(master|feature)"
},
{
"REPO_URL": "https://github.com/your-account/app-two.git"
}
]Run the container by mounting this file:
docker run -d \
-v $(pwd)/projects.json:/projects.json \
-p 8080:80 \
--name react-preview \
react-preview-nodeThe application automatically routes projects based on the repository name extracted from the REPO_URL:
http://your-domain.com/[PROJECT_NAME]/[BRANCH_NAME]/Content type
Image
Digest
sha256:5c5dc9b51…
Size
54.4 MB
Last updated
7 months ago
docker pull ocelus/react-preview