72 lines
2.0 KiB
Markdown
72 lines
2.0 KiB
Markdown
# walkies
|
|
|
|
A web-based application for an animal shelter to manage volunteer scheduling, time off, check-in/check-out, and notifications.
|
|
|
|
## Requirements
|
|
|
|
- [Go](https://golang.org/) 1.21+
|
|
- [Node.js](https://nodejs.org/) 18+
|
|
- [Task](https://taskfile.dev/) (`brew install go-task` or see [install docs](https://taskfile.dev/installation/))
|
|
- [Docker](https://www.docker.com/) (optional, for containerised deployment)
|
|
|
|
## Development
|
|
|
|
Run `task` to list all available tasks.
|
|
|
|
### Quick start (two terminals)
|
|
|
|
**Terminal 1 — backend:**
|
|
```bash
|
|
task web:build # build frontend once so the Go server has static files
|
|
task go:run # starts API server on :8080
|
|
```
|
|
|
|
**Terminal 2 — frontend dev server:**
|
|
```bash
|
|
task web:dev # hot-reload dev server on :3000, proxies /api/v1 → :8080
|
|
```
|
|
|
|
Then open [http://localhost:3000](http://localhost:3000).
|
|
|
|
### With live backend reload
|
|
|
|
Install [air](https://github.com/air-verse/air) for hot-reloading the Go server:
|
|
|
|
```bash
|
|
go install github.com/air-verse/air@latest
|
|
task web:build
|
|
task dev:backend
|
|
```
|
|
|
|
### Common tasks
|
|
|
|
| Task | Description |
|
|
|------|-------------|
|
|
| `task build` | Build frontend and Go binary |
|
|
| `task go:test` | Run Go tests |
|
|
| `task web:test` | Run frontend tests |
|
|
| `task go:lint` | Run `go vet` |
|
|
| `task tidy` | Tidy Go modules |
|
|
| `task clean` | Remove build artifacts |
|
|
|
|
## Docker
|
|
|
|
```bash
|
|
task docker:up # build image and start container
|
|
task docker:logs # tail logs
|
|
task docker:down # stop
|
|
```
|
|
|
|
## Configuration
|
|
|
|
The server is configured via environment variables:
|
|
|
|
| Variable | Default | Description |
|
|
|----------|---------|-------------|
|
|
| `PORT` | `8080` | HTTP listen port |
|
|
| `DATABASE_DSN` | `walkies.db` | SQLite file path |
|
|
| `JWT_SECRET` | `change-me-in-production` | HMAC signing key — **change this** |
|
|
| `STATIC_DIR` | `./web/build` | Path to compiled React app |
|
|
|
|
Copy `.env.example` to `.env` to set these locally (the server reads environment variables directly; use a process manager or Docker to inject them).
|