Add configuration files and update project documentation

- Introduced .editorconfig for consistent coding styles across the project.
- Added .golangci.yml for Go linting configuration.
- Updated AGENTS.md to clarify project structure and components.
- Enhanced CONTRIBUTING.md with Makefile usage for common tasks.
- Updated Dockerfiles to use Go 1.24 and improved build instructions.
- Refined README.md and deployment documentation for clarity.
- Added testing documentation in testing.md for backend and frontend tests.
- Introduced Makefile for streamlined development commands and tasks.
This commit is contained in:
2026-03-01 01:51:47 +03:00
parent 0466ff3087
commit 6529d7370e
92 changed files with 13411 additions and 8438 deletions

View File

@@ -1,25 +1,25 @@
# Разработка
# Development
## Локальный запуск
## Local setup
### Бэкенд (Go)
### Backend (Go)
Из корня репозитория:
From the repository root:
```bash
go build -o hnh-map ./cmd/hnh-map
./hnh-map -grids=./grids -port=8080
```
Или без сборки:
Or without building:
```bash
go run ./cmd/hnh-map -grids=./grids -port=8080
```
Сервер будет отдавать статику из каталога `frontend/` (нужно предварительно собрать фронт, см. ниже).
The server serves static files from the `frontend/` directory (you need to build the frontend first, see below).
### Фронтенд (Nuxt)
### Frontend (Nuxt)
```bash
cd frontend-nuxt
@@ -27,27 +27,72 @@ npm install
npm run dev
```
В dev-режиме приложение доступно по корню (например `http://localhost:3000/`). Бэкенд должен быть доступен; при необходимости настройте прокси в `nuxt.config.ts` (например на `http://localhost:8080`).
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 (разработка)
### Docker Compose (development)
```bash
docker compose -f docker-compose.dev.yml up
```
Dev-композ поднимает два сервиса:
Or using the Makefile:
- `backend` — Go API на порту `3080` (без сборки/раздачи фронтенд-статики в dev-режиме).
- `frontend` — Nuxt dev-сервер на порту `3000` с live-reload; запросы к `/map/api`, `/map/updates`, `/map/grids` проксируются на бэкенд.
```bash
make dev
```
Используйте [http://localhost:3000/](http://localhost:3000/) как основной URL для разработки интерфейса.
Порт `3080` предназначен для API и backend-эндпоинтов; корень `/` может возвращать `404` в dev-режиме — это ожидаемо.
The dev Compose setup starts two services:
### Сборка образа и prod-композ
- `backend` — Go API on port `3080` (no frontend static serving in dev mode).
- `frontend` — Nuxt dev server on port `3000` with live-reload; requests to `/map/api`, `/map/updates`, `/map/grids` are proxied to the backend.
Use [http://localhost:3000/](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.
### Building the image and production Compose
```bash
docker build -t hnh-map .
docker compose -f docker-compose.prod.yml up -d
```
В prod фронт собран в образ и отдаётся бэкендом из каталога `frontend/`; порт 8080.
Or using the Makefile:
```bash
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
```bash
make test
```
Or directly:
```bash
go test ./...
```
For frontend tests (if configured):
```bash
cd frontend-nuxt
npm test
```
See [docs/testing.md](testing.md) for details on the test suite.