# AGENTS.md ## Project Quran website at `https://quran.diyaa.de` plus a public developer API. Private owner (Diya), free to use, donations possible. - Type: website / web app (Next.js) with its own API server (NestJS + PostgreSQL), deployed with Docker Compose behind Traefik on the owner's server. - The website is the base of the project. The public API is served by the same server and is given to other developers with an API key. - Languages of the site: German, English, Spanish, Arabic, Turkish. More later, including non-Latin scripts. - Readers do not log in. Favorites, bookmarks and notes stay in the reader's own browser. Read `docs/README.md` for the full index, `docs/brief.md` for what the site does, `COMMANDS_AGENT.md` for the commands, and `docs/tasks/README.md` for the task list. ## Repository map ```text AGENTS.md rules for every agent (this file) COMMANDS_AGENT.md make build / dev / test contract Makefile root commands clean_rebuild.sh clean production build dev_rebuild.sh incremental development build scripts/ shared build flow, invariants, tests web/ Next.js website (created in T-006) api/ NestJS API server (created in T-006) deploy/ docker-compose.yml, Traefik labels, .env.example (created in T-007) docs/ brief, architecture, decisions, risks, legal, tasks ``` ## Working rules 1. **Quran text integrity.** Never alter, normalize in storage, reorder, translate by machine, or "fix" the Arabic text. Normalization is allowed only in a separate search column. The displayed text is exactly what the source delivers. 2. **No AI translations or tafsir.** Every translation and tafsir comes from a named source with a named author. Always show the author and source in the UI and in API responses. 3. **Two data zones, never mixed.** `qf_*` tables hold content from Quran Foundation (internal, used only by the website's own server-side pages). `open_*` tables hold content from openly licensed sources. The public API reads only `open_*`. Code under `api/src/public/` must never import or query `qf_*`. `scripts/check-invariants.sh` enforces this. 4. **Quran Foundation rules.** Offline data comes only from Content Sync, refreshed at least every 7 days. Credentials (`QF_CLIENT_ID`, `QF_CLIENT_SECRET`) live only in the server `.env`, never in git, never in browser code, never in logs. Use the prelive and production environments separately; never mix tokens or caches. 5. **Secrets.** `.env` is git-ignored. Commit only `.env.example` with empty values. Never print secret values in output. 6. **Source licensing.** A source enters the public API only after its license is recorded in `docs/decisions.md` (name, license, link, date checked, whether redistribution and attribution are allowed). 7. **Privacy by default.** No analytics, no tracking scripts, no third-party fonts or CDNs loaded from the browser. Store only what is needed: API key hash, key owner email, request counts. Do not log reader activity. 8. **Verify, do not trust.** Check server facts (`docs/architecture.md` section Server) and API behaviour before relying on them. Record what was verified and when. 9. **No deploy without being asked.** `make build` and `make dev` never deploy. Deploy only when the owner says so. 10. **Legal topics.** The owner decided legal work is out of scope for now (see `docs/legal.md`). Do not start legal work. The data-source and secret rules above are engineering rules and still apply. 11. **Report real results.** Never claim success from compilation alone. Report the commands run and their actual outcomes, including errors. ## Tasks `docs/tasks/` has one file per task (`T-001-short-slug.md`) and an index in `docs/tasks/README.md`. Keep the task file and the index row in sync. Status values: `todo`, `in progress`, `done`. Mark `done` only when verified. IDs are never renumbered. ## Commit rules Format: ```text TYPE - Short summary - First concrete change - Second concrete change - Third concrete change ``` Allowed types: ADDED, IMPROVED, FIXED, CHANGED, REFACTORED, OPTIMIZED, REMOVED, UPDATED, SECURED, TESTED, DOCUMENTED, STYLED, CONFIGURED, RENAMED, MOVED, CLEANED, REVERTED. Rules: - Write commit messages in English. - Use uppercase type names. - Keep the title concise. - Add a blank line before the bullet list. - Describe only the actual changes. - Inspect `git diff --cached` before writing the message. - Do not add AI attribution or `Co-Authored-By`. - Commit automatically as soon as a piece of work is finished, no need to ask first.