107 lines
2.5 KiB
Markdown
107 lines
2.5 KiB
Markdown
# Lunchtime
|
|
|
|
Lunchtime is a self-hosted lunch order app with a React frontend, a Python backend, and nginx for reverse proxying.
|
|
|
|
## Getting Started
|
|
|
|
1. Copy and adjust `config.yaml` for your environment.
|
|
2. Create a writable data folder (for SQLite and uploads), for example `.data`.
|
|
3. Start the stack with Docker Compose.
|
|
|
|
Example `compose.yml` (inspired by `src/compose.yml`) using images from the Gitea registry:
|
|
|
|
```yaml
|
|
services:
|
|
nginx:
|
|
image: nginx:alpine
|
|
ports:
|
|
- "8080:8080"
|
|
volumes:
|
|
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
|
depends_on:
|
|
- backend
|
|
- frontend
|
|
restart: unless-stopped
|
|
|
|
backend:
|
|
image: git.sgruber.at/lunchtime/lunchtime-web:backend-latest
|
|
volumes:
|
|
- ./.data:/app/data
|
|
- ./config.yaml:/app/config.yaml:ro
|
|
environment:
|
|
- APP_ENV=production
|
|
- LOG_LEVEL=info
|
|
- DB_PATH=/app/data
|
|
restart: unless-stopped
|
|
|
|
frontend:
|
|
image: git.sgruber.at/lunchtime/lunchtime-web:frontend-latest
|
|
restart: unless-stopped
|
|
```
|
|
|
|
Then run:
|
|
|
|
```bash
|
|
docker compose up -d
|
|
```
|
|
|
|
Open `http://localhost:8080`.
|
|
|
|
## Development
|
|
|
|
### Quick Start with Docker Compose
|
|
|
|
Use the development compose file to run the full stack with hot reload:
|
|
|
|
```bash
|
|
cd src
|
|
docker compose up -d
|
|
```
|
|
|
|
This will start the backend and frontend, proxied through Nginx at `http://localhost:8080`. Also, a Mailpit instance at `http://localhost:8025` can be used for monitoring outgoing mail.
|
|
|
|
### Backend Development
|
|
|
|
The backend is a FastAPI application using SQLite and runs on Python 3.12.
|
|
|
|
**Dockerfile**: `src/backend/Containerfile` - Production build
|
|
|
|
**Development**:
|
|
|
|
```bash
|
|
cd src/backend
|
|
pip install -r requirements.txt
|
|
uvicorn app.main:app --reload
|
|
```
|
|
|
|
Changes to `app/` are automatically detected when running with `--reload`.
|
|
|
|
### Frontend Development
|
|
|
|
The frontend is a React + TypeScript application using Vite.
|
|
|
|
**Dockerfile**:
|
|
|
|
- `src/frontend/Containerfile`: Multi-target build with `dev` and `prod` stages
|
|
|
|
Use the `dev` target for hot reload and the `prod` target for the static production image.
|
|
|
|
**Development**:
|
|
|
|
```bash
|
|
cd src/frontend
|
|
npm install
|
|
npm run dev
|
|
```
|
|
|
|
Open `http://localhost:5173` (or the address shown in the terminal).
|
|
|
|
## Contributing
|
|
|
|
Contributions are welcome! Please follow these guidelines:
|
|
|
|
1. **Choose an existing issue** or create one first to discuss your changes
|
|
2. **Fork the repository** and create a feature branch
|
|
3. **Test your changes** in the development environment using `compose.yml`
|
|
4. **Submit a pull request** linking to the related issue
|