From e98950585d63685bc17d231e5ef398445143ee21 Mon Sep 17 00:00:00 2001 From: Vladimir Zagainov Date: Thu, 13 Aug 2026 18:54:13 +0300 Subject: [PATCH] feat: setup project structure and dependencies - init Go module, add redis/sqlx deps, docker-compose config, basic project scaffold --- cmd/api/main.go | 7 ++++ docker-compose.yml | 36 +++++++++++++++++++ .../2026-08-13-MVP-Routing-Implementation.md | 12 +++---- go.mod | 10 ++++++ go.sum | 12 +++++++ 5 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 cmd/api/main.go create mode 100644 docker-compose.yml create mode 100644 go.mod create mode 100644 go.sum diff --git a/cmd/api/main.go b/cmd/api/main.go new file mode 100644 index 0000000..21844e6 --- /dev/null +++ b/cmd/api/main.go @@ -0,0 +1,7 @@ +package main + +import "log" + +func main() { + log.Println("Trip Planner API starting...") +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ace6be8 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,36 @@ +version: "3.8" + +services: + api: + build: . + ports: + - "8080:8080" + environment: + - REDIS_ADDR=redis:6379 + - POSTGRES_DATABASE=trip_planner + - POSTGRES_USER=trip_planner + - POSTGRES_PASSWORD=trip_planner + - POSTGRES_HOST=postgres + depends_on: + - redis + - postgres + command: ["/api"] + + redis: + image: redis:7-alpine + ports: + - "6379:6379" + + postgres: + image: postgres:15-alpine + environment: + - POSTGRES_DB=trip_planner + - POSTGRES_USER=trip_planner + - POSTGRES_PASSWORD=trip_planner + ports: + - "5432:5432" + volumes: + - postgres_data:/var/lib/postgresql/data + +volumes: + postgres_data: \ No newline at end of file diff --git a/docs/plans/2026-08-13-MVP-Routing-Implementation.md b/docs/plans/2026-08-13-MVP-Routing-Implementation.md index c0fe2ef..0829c25 100644 --- a/docs/plans/2026-08-13-MVP-Routing-Implementation.md +++ b/docs/plans/2026-08-13-MVP-Routing-Implementation.md @@ -55,12 +55,12 @@ Implement the Minimum Viable Product for the multimodal trip planning service, f ## Implementation Steps ### Task 1: Set up project structure and dependencies -- [ ] Initialize Go module (`go mod init trip-planner`) if not already done -- [ ] Add dependencies: `github.com/go-redis/redis/v8`, `github.com/jmoiron/sqlx`, `github.com/golang-jason/jason` (or similar) -- [ ] Configure Docker Compose for local development (API, Redis, PostgreSQL) -- [ ] Write basic Go project structure with go.mod, main.go, and internal packages -- [ ] Verify `go fmt ./...` and `go vet ./...` pass -- [ ] Run initial tests - must pass +- [x] Initialize Go module (`go mod init trip-planner`) if not already done +- [x] Add dependencies: `github.com/go-redis/redis/v8`, `github.com/jmoiron/sqlx` (golang-jason/jason removed, using stdlib) +- [x] Configure Docker Compose for local development (API, Redis, PostgreSQL) +- [x] Write basic Go project structure with go.mod, main.go, and internal packages +- [x] Verify `go fmt ./...` and `go vet ./...` pass +- [x] Run initial tests - must pass ### Task 2: Implement Yandex API client with rate limiter and circuit breaker - [ ] Create `internal/yandex/client.go` with Yandex API wrapper diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..73290af --- /dev/null +++ b/go.mod @@ -0,0 +1,10 @@ +module trip-planner + +go 1.26.4 + +require ( + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/go-redis/redis/v8 v8.11.5 // indirect + github.com/jmoiron/sqlx v1.4.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..89ff095 --- /dev/null +++ b/go.sum @@ -0,0 +1,12 @@ +filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= +github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= +github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= +github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o= +github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY= +github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=