devmode
This commit is contained in:
parent
0535cd1aad
commit
ebd50740f0
6 changed files with 249 additions and 17 deletions
83
README.md
83
README.md
|
@ -376,5 +376,88 @@ The application uses SQLite with the following schema:
|
|||
|
||||
## Development
|
||||
|
||||
### Local Development
|
||||
|
||||
To run in development mode with automatic reloading, you can use tools like
|
||||
`air` or `realize`.
|
||||
|
||||
#### Using the Development Script
|
||||
|
||||
The project includes a development script that runs both backend and frontend with hot reloading:
|
||||
|
||||
```bash
|
||||
# Start development environment
|
||||
./dev.sh
|
||||
```
|
||||
|
||||
This will:
|
||||
- Start the Go backend with Air for hot reloading
|
||||
- Start the React frontend with Vite for hot reloading
|
||||
- Proxy API requests from frontend to backend
|
||||
- Clean up processes on exit
|
||||
|
||||
### Docker Development
|
||||
|
||||
For a consistent development environment using Docker with hot reloading:
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
- Docker and Docker Compose installed
|
||||
- Ports 8080 and 5173 available
|
||||
|
||||
#### Quick Start
|
||||
|
||||
```bash
|
||||
# Start development environment with Docker
|
||||
./dev-docker.sh
|
||||
```
|
||||
|
||||
This will:
|
||||
- Build a development container with all dependencies
|
||||
- Mount your source code for hot reloading
|
||||
- Start both backend (Air) and frontend (Vite) with hot reloading
|
||||
- Make the application available at:
|
||||
- Backend: http://localhost:8080
|
||||
- Frontend: http://localhost:5173
|
||||
|
||||
#### Manual Docker Commands
|
||||
|
||||
```bash
|
||||
# Build and start the development container
|
||||
docker-compose -f docker-compose.dev.yml up --build
|
||||
|
||||
# Stop the development container
|
||||
docker-compose -f docker-compose.dev.yml down
|
||||
|
||||
# View logs
|
||||
docker-compose -f docker-compose.dev.yml logs -f
|
||||
|
||||
# Rebuild the container
|
||||
docker-compose -f docker-compose.dev.yml up --build --force-recreate
|
||||
```
|
||||
|
||||
#### Development Features
|
||||
|
||||
The Docker development environment includes:
|
||||
|
||||
- **Hot Reloading**: Both Go backend and React frontend reload automatically on code changes
|
||||
- **Volume Mounts**: Your local code is mounted into the container for live editing
|
||||
- **Dependency Management**: All dependencies are pre-installed in the container
|
||||
- **Consistent Environment**: Same environment across all developers
|
||||
- **Easy Cleanup**: Simple commands to start/stop the development environment
|
||||
|
||||
#### File Watching
|
||||
|
||||
The development container uses:
|
||||
- **Air** for Go backend hot reloading (watches `.go` files)
|
||||
- **Vite** for React frontend hot reloading (watches all frontend files)
|
||||
- **inotify-tools** for efficient file system watching
|
||||
|
||||
#### Troubleshooting
|
||||
|
||||
If you encounter issues:
|
||||
|
||||
1. **Port conflicts**: Ensure ports 8080 and 5173 are not in use
|
||||
2. **Permission issues**: The container runs with appropriate permissions
|
||||
3. **Hot reload not working**: Check that your files are being watched by the respective tools
|
||||
4. **Container won't start**: Check Docker logs with `docker-compose -f docker-compose.dev.yml logs`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue