docs: PRD v1.0 + CLAUDE.md projectinstructies
- WetGit-PRD-v1.0 in docx en pdf (Product Requirements Document) - CLAUDE.md met stack/endpoints/deploy/troubleshooting voor AI-assistenten die met de repo werken
This commit is contained in:
parent
d3536c74a4
commit
2b0f858b46
3 changed files with 104 additions and 0 deletions
104
CLAUDE.md
Normal file
104
CLAUDE.md
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
# WetGIT — Nederlandse wetgeving als code
|
||||
|
||||
## Project
|
||||
|
||||
Elke Nederlandse wet als Markdown-bestand, elke wijziging als Git-commit. Data van officiële BWB (Basis Wettenbestand) XML bronnen.
|
||||
|
||||
## Stack
|
||||
|
||||
- **Python 3.12+** (pyproject.toml, setuptools)
|
||||
- **FastAPI** — API + web frontend (module: `wetgit.api.app:app`)
|
||||
- **Meilisearch v1.12** — full-text search
|
||||
- **Qdrant v1.13** — semantic search (Mistral embeddings)
|
||||
- **Forgejo** — self-hosted git (git.wetgit.nl)
|
||||
- **Redis** — Celery broker
|
||||
- **Nginx** — reverse proxy (3 vhosts: wetgit.nl, api.wetgit.nl, git.wetgit.nl)
|
||||
- **Codeberg** — public mirror (codeberg.org/wetgit, daily push)
|
||||
|
||||
## API Endpoints
|
||||
|
||||
```
|
||||
GET /health → status, version, count
|
||||
GET /api/v1/regelingen → lijst (filter: ?type=wet&status=geldend)
|
||||
GET /api/v1/regelingen/{bwb_id} → metadata
|
||||
GET /api/v1/regelingen/{bwb_id}/tekst → volledige Markdown
|
||||
GET /api/v1/regelingen/{bwb_id}/artikelen → artikellijst
|
||||
GET /api/v1/regelingen/{bwb_id}/artikelen/{nr} → artikel detail
|
||||
GET /api/v1/regelingen/{bwb_id}/versies → historische versies (git log)
|
||||
GET /api/v1/regelingen/{bwb_id}/diff → diff (?van=DATE&tot=DATE)
|
||||
GET /api/v1/regelingen/{bwb_id}/domeinen → compliance-domein classificatie
|
||||
GET /api/v1/regelingen/{bwb_id}/referenties → cross-referenties
|
||||
GET /api/v1/zoeken → search (?q=term&mode=keyword|semantic|hybrid)
|
||||
GET /api/v1/domeinen → lijst van compliance-domeinen
|
||||
GET /api/v1/feed.xml → Atom feed van wijzigingen
|
||||
GET /api/docs → Swagger UI
|
||||
```
|
||||
|
||||
Rate limiting: 60 req/min default, 30 req/min voor zoeken (slowapi).
|
||||
|
||||
## Deployment
|
||||
|
||||
```bash
|
||||
# Full deploy
|
||||
ansible-playbook ansible/site.yml
|
||||
|
||||
# Selective
|
||||
ansible-playbook ansible/site.yml --tags app # code + deps + services
|
||||
ansible-playbook ansible/site.yml --tags docker # Docker stack
|
||||
ansible-playbook ansible/site.yml --tags nginx # nginx vhosts + SSL
|
||||
ansible-playbook ansible/site.yml --tags forgejo # Forgejo + Redis + cron
|
||||
|
||||
# Dry-run
|
||||
ansible-playbook ansible/site.yml --check --diff
|
||||
```
|
||||
|
||||
Server: dt-prod-01 via Tailscale (100.98.29.89), user: deploy.
|
||||
Vault password: `ansible/.vault_pass`
|
||||
|
||||
**Important:** Data lives at `/opt/wetgit/app/rijk/` (env var `WETGIT_GIT_REPOS_DIR=/opt/wetgit/app`).
|
||||
|
||||
## Shared server rules
|
||||
|
||||
This server is shared with **dt-platform**. Do NOT:
|
||||
- Modify global nginx.conf or system packages
|
||||
- Use ports 8001 (dt-chatbot) or 8200 (grimoire)
|
||||
- Touch /opt/dt-chatbot, /opt/grimoire, /opt/dt-skills-portal
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
# Enter nix shell (provides Python + dependencies)
|
||||
nix develop
|
||||
|
||||
# Run tests
|
||||
pytest
|
||||
|
||||
# Run locally
|
||||
uvicorn wetgit.api.app:app --reload
|
||||
|
||||
# Lint
|
||||
ruff check src/
|
||||
black --check src/
|
||||
```
|
||||
|
||||
## Key directories
|
||||
|
||||
```
|
||||
src/wetgit/ # Application code
|
||||
api/ # FastAPI routes, search, models
|
||||
web/ # Jinja2 templates + static
|
||||
pipeline/ # BWB parser, SRU client, sync, indexer
|
||||
ai/ # Summaries, semantic search, alerts, domains, crossref
|
||||
cli/ # CLI tool
|
||||
tasks.py # Celery app (sync, reindex, alerts)
|
||||
ansible/ # Deployment playbooks
|
||||
roles/ # wetgit-forgejo, wetgit-app, wetgit-nginx
|
||||
group_vars/wetgit/ # main.yml (vars), vault.yml (secrets)
|
||||
PRD/ # Product Requirements Document
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Port 8002 bezet na deploy:** `ssh deploy@100.98.29.89 "sudo fuser -k 8002/tcp && sudo systemctl restart wetgit"`
|
||||
- **Meilisearch crasht:** Check image version — v1.12 data is incompatibel met v1.13
|
||||
- **Ansible check-mode faalt op wetgit-web.conf:** Verwacht — file wordt niet echt geschreven in check-mode
|
||||
BIN
PRD/WetGit-PRD-v1.0.docx
Normal file
BIN
PRD/WetGit-PRD-v1.0.docx
Normal file
Binary file not shown.
BIN
PRD/WetGit-PRD-v1.0.pdf
Normal file
BIN
PRD/WetGit-PRD-v1.0.pdf
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue