From 23a7b6ad536308c08a8047c791bfaa262e3f9907 Mon Sep 17 00:00:00 2001 From: Julian Tabel Date: Sat, 7 Feb 2026 19:44:19 +0100 Subject: [PATCH] Update project config for Go tool and port change Add Go to .tool-versions, update .gitignore for Go build output and cache, document seed data regeneration in README, and change API port from 8000 to 8080 in docker-compose. Co-Authored-By: Claude Opus 4.6 --- ...er-338l--verify-fetch-pokeapipy-rewrite.md | 22 ++++++++++++ ...okeapi-data-submodule-to-latest-version.md | 4 +-- ...acker-k60g--rewrite-fetch-pokeapi-in-go.md | 11 ++++++ .gitignore | 6 ++++ .tool-versions | 1 + README.md | 34 ++++++++++++++++++- docker-compose.yml | 4 +-- 7 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 .beans/nuzlocke-tracker-338l--verify-fetch-pokeapipy-rewrite.md create mode 100644 .beans/nuzlocke-tracker-k60g--rewrite-fetch-pokeapi-in-go.md diff --git a/.beans/nuzlocke-tracker-338l--verify-fetch-pokeapipy-rewrite.md b/.beans/nuzlocke-tracker-338l--verify-fetch-pokeapipy-rewrite.md new file mode 100644 index 0000000..ebae498 --- /dev/null +++ b/.beans/nuzlocke-tracker-338l--verify-fetch-pokeapipy-rewrite.md @@ -0,0 +1,22 @@ +--- +# nuzlocke-tracker-338l +title: Verify fetch_pokeapi.py rewrite +status: in-progress +type: task +created_at: 2026-02-07T15:08:10Z +updated_at: 2026-02-07T15:08:10Z +--- + +All code changes are complete. Run verification: +1. Run the script to completion +2. Verify output (pokemon.json has forms, correct IDs, etc.) +3. Verify cache speedup on second run +4. Frontend build check + +## Checklist +- [ ] Run fetch_pokeapi.py to completion +- [ ] Verify pokemon.json has more entries with forms (megas, gmax, regionals) +- [ ] Verify pokeapi_id/national_dex split is correct +- [ ] Verify route/encounter JSON files +- [ ] Verify cache speedup on second run +- [ ] Frontend build passes \ No newline at end of file diff --git a/.beans/nuzlocke-tracker-6aje--update-pokeapi-data-submodule-to-latest-version.md b/.beans/nuzlocke-tracker-6aje--update-pokeapi-data-submodule-to-latest-version.md index e4dfdf9..8b334ae 100644 --- a/.beans/nuzlocke-tracker-6aje--update-pokeapi-data-submodule-to-latest-version.md +++ b/.beans/nuzlocke-tracker-6aje--update-pokeapi-data-submodule-to-latest-version.md @@ -1,11 +1,11 @@ --- # nuzlocke-tracker-6aje title: Update PokeAPI data submodule to latest version -status: todo +status: completed type: task priority: high created_at: 2026-02-06T10:53:45Z -updated_at: 2026-02-07T13:39:12Z +updated_at: 2026-02-07T14:35:41Z --- The local PokeAPI data repository we use as a submodule is outdated. It's missing data for newer Pokemon forms and potentially newer games. diff --git a/.beans/nuzlocke-tracker-k60g--rewrite-fetch-pokeapi-in-go.md b/.beans/nuzlocke-tracker-k60g--rewrite-fetch-pokeapi-in-go.md new file mode 100644 index 0000000..302b753 --- /dev/null +++ b/.beans/nuzlocke-tracker-k60g--rewrite-fetch-pokeapi-in-go.md @@ -0,0 +1,11 @@ +--- +# nuzlocke-tracker-k60g +title: Rewrite fetch_pokeapi in Go +status: completed +type: feature +priority: normal +created_at: 2026-02-07T15:38:58Z +updated_at: 2026-02-07T15:44:25Z +--- + +Rewrite the Python PokeAPI fetching tool in Go with custom HTTP client, disk caching, and zero external dependencies. Replace aiopoke dependency that crashes on newer PokeAPI fields. \ No newline at end of file diff --git a/.gitignore b/.gitignore index 575f98e..5eed95c 100644 --- a/.gitignore +++ b/.gitignore @@ -60,5 +60,11 @@ temp/ *.tmp *.temp +# PokeAPI fetch cache +.pokeapi_cache/ + +# Go build output +tools/fetch-pokeapi/fetch-pokeapi + # Local config overrides *.local diff --git a/.tool-versions b/.tool-versions index ecddae3..16653a3 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,3 @@ nodejs 24.13.0 python 3.14.3 +golang 1.25.7 diff --git a/README.md b/README.md index fff11d3..a06e36d 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,8 @@ docker compose exec api alembic -c /app/alembic.ini upgrade head ### Seed the Database +The seeder reads from pre-generated JSON files in `backend/src/app/seeds/data/` (committed to the repo) and loads them into PostgreSQL. No external API access is needed — everything runs from local files inside the container. + ```bash docker compose exec api python -m app.seeds ``` @@ -41,4 +43,34 @@ To seed and verify the data was loaded correctly: docker compose exec api python -m app.seeds --verify ``` -This loads game data, Pokemon, routes, and encounter tables for FireRed, LeafGreen, Emerald, HeartGold, and SoulSilver. \ No newline at end of file +This loads game data, Pokemon, routes, and encounter tables for FireRed, LeafGreen, Emerald, HeartGold, and SoulSilver. + +### Regenerating Seed Data + +The seed JSON files don't normally need regenerating. If you need to update them (e.g., to pull in new PokeAPI data), run the Go fetch tool against a local PokeAPI instance: + +1. Start a local PokeAPI (e.g., using [pokeapi/pokeapi](https://github.com/PokeAPI/pokeapi)): + + ```bash + # In a separate directory + git clone https://github.com/PokeAPI/pokeapi.git && cd pokeapi + docker compose up + ``` + + This serves the API at `http://localhost:8000/api/v2` by default. + +2. Run the fetch tool (requires Go 1.22+): + + ```bash + cd tools/fetch-pokeapi && go run . + ``` + + Set `POKEAPI_URL` if your instance is at a different address: + + ```bash + POKEAPI_URL=http://localhost:9000/api/v2 go run . + ``` + + Use `--clear-cache` to discard cached API responses and re-fetch everything. + +3. Review and commit the updated JSON files in `backend/src/app/seeds/data/`. \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 455e3d0..8e0cb9c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,7 @@ services: context: ./backend dockerfile: Dockerfile ports: - - "8000:8000" + - "8080:8000" volumes: - ./backend/src:/app/src:cached - ./backend/alembic.ini:/app/alembic.ini:cached @@ -27,7 +27,7 @@ services: - ./frontend/public:/app/public:cached - ./frontend/index.html:/app/index.html:cached environment: - - VITE_API_URL=http://localhost:8000 + - VITE_API_URL=http://localhost:8080 depends_on: - api restart: unless-stopped