This project uses React, TypeScript, and Vite to create a fast and modern frontend development environment. It also includes instructions for running the application inside a Docker container with live reload support using mounted volumes.
- ⚡️ Fast development with Vite
- ⚛️ React + TypeScript support
- 🔁 Hot Module Replacement (HMR)
- 🐳 Dockerized development environment
- ✅ ESLint rules for clean code
npm install
Update the dev script to allow access from external hosts (required inside Docker):
docker build -t react-docker .
docker run -p 5173:5173 react-docker
Explanation:
-p 5173:5173
maps host port 5173 to container port 5173 (Vite default port)
To develop with hot reload from your local filesystem:
docker run -p 5173:5173 \
-v "${pwd}:/app" \
-v /app/node_modules \
react-docker
docker run -p 5173:5173 -v "${pwd}:/app" -v /app/node_modules react-docker
Explanation:
-v "${pwd}:/app"
mounts your current local directory into/app
inside the container (so changes on your machine immediately reflect in the container)-v /app/node_modules
creates an anonymous volume fornode_modules
inside the container (this prevents overwritingnode_modules
from your local machine, which might be incompatible with the container)
docker tag react-docker visitha2001/react-docker
docker push visitha2001/react-docker
.
├── src/ # React + TypeScript source files
├── public/ # Static assets
├── package.json
├── tsconfig.json
├── vite.config.ts
└── Dockerfile
- @vitejs/plugin-react — uses Babel for Fast Refresh
- @vitejs/plugin-react-swc — uses SWC for Fast Refresh
- Vite runs on port 5173 by default
- Make sure to use
vite --host
to make the dev server accessible from outside the container
MIT