- Added email field to user profile API and frontend components for better user identification. - Implemented PATCH /map/api/me endpoint to update user email, enhancing user experience. - Introduced useGravatarUrl composable for generating Gravatar URLs based on user email. - Updated profile and layout components to display user avatars using Gravatar, improving visual consistency. - Enhanced development documentation to guide testing of navbar and profile features.
2.8 KiB
Development
Local setup
Backend (Go)
From the repository root:
go build -o hnh-map ./cmd/hnh-map
./hnh-map -grids=./grids -port=8080
Or without building:
go run ./cmd/hnh-map -grids=./grids -port=8080
The server serves static files from the frontend/ directory (you need to build the frontend first, see below).
Frontend (Nuxt)
cd frontend-nuxt
npm install
npm run dev
In dev mode the app is available at root (e.g. http://localhost:3000/). The backend must be reachable; configure the proxy in nuxt.config.ts if needed (e.g. to http://localhost:8080).
Docker Compose (development)
docker compose -f docker-compose.dev.yml up
Or using the Makefile:
make dev
The dev Compose setup starts two services:
backend— Go API on port3080(no frontend static serving in dev mode).frontend— Nuxt dev server on port3000with live-reload; requests to/map/api,/map/updates,/map/gridsare proxied to the backend.
Use http://localhost:3000/ as the primary URL for UI development.
Port 3080 is for API and backend endpoints; the root / may return 404 in dev mode — this is expected.
Testing navbar and profile: With no users in the database, log in as admin using the bootstrap password (e.g. HNHMAP_BOOTSTRAP_PASSWORD=admin in docker-compose.dev) to create the first admin user. You can then use that account to verify the navbar avatar and profile page. For Gravatar, use OAuth (e.g. Google) or set email later on the profile page once that feature is available.
Gravatar (avatar by email): Gravatar URLs are built on the frontend using the md5 package (client-side MD5 of the user's email). No backend endpoint is used; the frontend composable useGravatarUrl (see Phase 5+ of the navbar/avatar plan) will use this dependency.
Building the image and production Compose
docker build -t hnh-map .
docker compose -f docker-compose.prod.yml up -d
Or using the Makefile:
make build
In production the frontend is built into the image and served by the backend from the frontend/ directory; port 8080.
Makefile targets
| Target | Description |
|---|---|
make dev |
Start Docker Compose development environment |
make build |
Build production Docker image |
make test |
Run Go tests (go test ./...) |
make lint |
Run Go and frontend linters |
make fmt |
Format all code (Go + frontend) |
make generate-frontend |
Build frontend static output into frontend/ |
make clean |
Remove build artifacts |
Running tests
make test
Or directly:
go test ./...
For frontend tests (if configured):
cd frontend-nuxt
npm test
See docs/testing.md for details on the test suite.