Initial commit

This commit is contained in:
diyaa
2026-11-11 20:25:21 +01:00
commit 311f19f9d2
48 changed files with 1391 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
# Documentation index
| File | Content |
| --- | --- |
| [brief.md](brief.md) | What the website and the public API are, who uses them, features, scope |
| [architecture.md](architecture.md) | Stack, data zones, data model, API design, server and Traefik facts |
| [decisions.md](decisions.md) | Decisions made and open questions; source licenses table |
| [source-research.md](source-research.md) | Source licensing research, coverage gaps, and Content API verification status |
| [risks.md](risks.md) | Risks and how to handle them |
| [legal.md](legal.md) | Operator, legal status, data-source rules |
| [tasks/README.md](tasks/README.md) | Task index; one file per task |
Date of this documentation: 2026-11-11.
+206
View File
@@ -0,0 +1,206 @@
# Architecture
## Stack
| Part | Choice |
| --- | --- |
| Website | Next.js (TypeScript), server-side rendering for reading pages |
| API | NestJS (TypeScript) |
| Database | PostgreSQL with full-text search |
| Deployment | Docker Compose on the owner's server behind Traefik |
| Domain | `quran.diyaa.de` (website and API on one host; API under `/api`) |
Package manager is not chosen yet (see `decisions.md`).
## Two data zones
```text
Quran Foundation Content Sync --> qf_* tables --> website pages (server-side only)
Open licensed sources ----------> open_* tables --> website fallback + public API
```
- `qf_*`: content synced from Quran Foundation. Used only by the website's own server-side rendering. Never returned by the public API.
- `open_*`: content from sources whose license allows redistribution with attribution. Used by the public API and as a fallback for the website.
- The two zones have separate tables, separate import code and separate modules. `api/src/public/` must never reference `qf_*`. `scripts/check-invariants.sh` checks this.
- T-002 terms check, 2026-11-11: [Quran Foundation developer terms](https://api-docs.quran.com/legal/developer-terms/) permit display to end users within the application, subject to their conditions, including via a private backend. Redistribution as data through another public API requires a separate signed commercial license. This is a terms review, not a verification of the project's account or access.
## Quran Foundation access
- OAuth2 `client_credentials`. Token URLs: `https://prelive-oauth2.quran.foundation/oauth2/token` and `https://oauth2.quran.foundation/oauth2/token`. Token lifetime 3600 s.
- API hosts: `https://apis-prelive.quran.foundation` and `https://apis.quran.foundation`, path prefix `/content/api/v4`. Headers `x-auth-token` and `x-client-id`.
- Prelive has only surahs 1 and 2. Production has the full dataset. Never mix prelive and production tokens or caches.
- Offline data comes only from Content Sync (`GET /resources/sync`, bootstrap, snapshots, sync tokens, mutation types). Sync at least every 7 days. The Quran text must not be modified.
- The [terms](https://api-docs.quran.com/legal/developer-terms/) limit storage of content not covered by Content Sync to one week, subject to the stated font and Mushaf image exceptions; if connectivity is unavailable for more than seven days, sync promptly when it returns.
- Tafsir rows may cover verse ranges (`start_verse_id` / `end_verse_id`). Verse recitation ids and chapter recitation ids are separate namespaces.
- Credentials live only in the server `.env`. Browser code never sees them.
- Findings from the public Quran.com API are not verified against the Content API: no Arabic translation; tafsir only in Arabic, English, Russian, Bengali, Urdu, Kurdish; none in German, Spanish, Turkish. Verify in T-002.
## Data model (proposed)
Content tables exist once per zone (`qf_` or `open_` prefix):
| Table | Main fields |
| --- | --- |
| chapters | id, names (per language), revelation place, verses count |
| verses | verse_key (`2:255`), chapter id, verse number, text_arabic (exact), text_search (normalized, separate column) |
| translations_meta | resource id, language, author, source, license |
| translations | resource id, verse_key, text |
| tafsirs_meta | resource id, language, author, source, license |
| tafsirs | resource id, start_verse_key, end_verse_key, text |
| reciters | id, name, style, source, license |
| audio_files | reciter id, kind (verse or chapter), verse_key or chapter id, url, duration |
API tables:
| Table | Main fields |
| --- | --- |
| api_clients | id, owner email, created_at, status |
| api_keys | id, client id, key prefix, key hash, created_at, last_used_at, revoked_at, plan |
| usage_counters | key id, day, request count |
Reader data (favorites, bookmarks, notes, folders, last read) is stored in the browser (IndexedDB or localStorage), not in PostgreSQL. Each record has a UUID and an updatedAt so a later account sync stays possible.
## Search
- Arabic: a separate normalized column (marks and tatweel removed; alef variants folded). Display always uses the original text. Decide whether to fold ى/ي and ة/ه (open question).
- Translations: PostgreSQL full-text search with the right language configuration per language.
- Surah names: a small table of names and spellings per language.
## Public API (proposed)
Base: `https://quran.diyaa.de/api/v1`. Auth: header `X-API-Key: <key>`. JSON only. Every translation or tafsir response carries `author`, `source` and `license`.
| Method and path | Returns |
| --- | --- |
| `GET /chapters` | list of chapters |
| `GET /chapters/{id}` | one chapter |
| `GET /verses/{verse_key}` | one verse with optional `translations` |
| `GET /chapters/{id}/verses` | verses of a chapter, paged |
| `GET /translations` | available translations with author and license |
| `GET /tafsirs` | available tafsirs |
| `GET /tafsirs/{id}/{verse_key}` | tafsir entry covering the verse |
| `GET /reciters` | reciters |
| `GET /audio/{reciter_id}/{chapter_id}` | audio file info |
| `GET /search?q=&lang=` | search results |
- Rate limits per key (placeholder: 60 requests per minute and 10,000 per day; to decide).
- Keys are random and high entropy; only a hash (with a server pepper) is stored; the key is shown once.
- Errors use a stable JSON shape with a code. Responses include rate-limit headers.
- OpenAPI document is generated and published on the developer page.
## Website pages
`/` home, `/surah/{n}` reader, `/search`, `/library` (favorites, bookmarks, notes, from the browser), `/reciters`, `/settings`, `/developers` (API docs and key request), `/about` (sources and authors).
## Server (verify before use)
Verification on 2026-11-11: connected via the existing `d-server` SSH alias and queried DNS. The provider firewall is still unverified, so T-001 remains in progress. Results are a snapshot and must be checked again before deployment.
| Item | Observed result |
| --- | --- |
| Host | `ubuntu`, Ubuntu 24.04.5 LTS; `d-server` connects as root to `194.164.60.161` on port 22 |
| DNS | `diyaa.de` resolves to `194.164.60.161`; `quran.diyaa.de` returned NOERROR with no A or AAAA answer. The previous claim that it resolves through a wildcard is not currently true. |
| Host firewall | `ufw` is inactive. TCP ports 22, 80, 443 and 2222 were listening on all IPv4 and IPv6 addresses; Docker rules forward 2222 to a container. Listening does not establish provider-side reachability. |
| Provider firewall | Not checked; provider account access is needed. |
| Reverse proxy | Running container `traefik`, image `traefik:v3.6.25`; its configuration and data are mounted from `/srv/traefik/config` and `/srv/traefik/data`. |
| Docker network | `traefik-public` is a bridge network and Traefik is connected to it; `traefik-net` was absent. |
| Entrypoints | `web` on :80 redirects to HTTPS; `websecure` on :443. |
| Certificate resolver | `le`, HTTP challenge through `web`; storage `/letsencrypt/acme.json`, mounted from `/srv/traefik/data`. |
| Capacity | Root filesystem: 232G total, 212G available; memory: 7.7 GiB total, 5.9 GiB available; no swap. |
Differences from the August 2026 assumptions below: hostname and OS, DNS, host firewall and extra listening port, Traefik paths, network name, and resolver name/storage. The proxy version family and entrypoints match. The deployment example below is a historical template: update its network and resolver references during T-007 after rechecking the server.
Previous assumptions (August 2026):
| Item | Value |
| --- | --- |
| Host | `diya-server`, Debian 12, SSH alias `d-server` |
| Public IP | 194.164.60.161 |
| DNS | `*.diyaa.de` points to the IP; `quran.diyaa.de` resolves via the wildcard |
| Firewall | ufw: 22, 80, 443 only (also check the provider's firewall) |
| Reverse proxy | Traefik v3.6 in `/opt/traefik/` |
| Docker network | `traefik-net` (external, bridge) |
| Entrypoints | `web` (:80, redirects to https), `websecure` (:443) |
| Certificate resolver | `myresolver` (Let's Encrypt HTTP challenge, `/opt/traefik/acme.json`) |
Verify with:
```bash
dig +short quran.diyaa.de
docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}'
docker network ls | grep traefik-net
docker inspect traefik --format '{{.Config.Image}}'
ls /opt
ufw status
```
## Deployment layout
| Field | Value |
| --- | --- |
| Folder | `/opt/quran-web` |
| Website container and router | `quran-web`, internal port 3000 |
| API container and router | `quran-api`, internal port 8080 |
| Database container | `quran-db`, private network `quran-internal`, not on `traefik-net` |
| Networks | web and API join `traefik-net` and `quran-internal`; the database only `quran-internal` |
| Ports | no `ports:` on any service |
| Env | `.env` only on the server; `.env.example` in git |
Traefik labels (template; router and service names must be unique on the whole server):
```yaml
services:
quran-web:
build: ./web
container_name: quran-web
restart: unless-stopped
env_file: .env
networks: [traefik-net, quran-internal]
labels:
- "traefik.enable=true"
- "traefik.http.routers.quran-web.rule=Host(`quran.diyaa.de`)"
- "traefik.http.routers.quran-web.entrypoints=websecure"
- "traefik.http.routers.quran-web.tls.certresolver=myresolver"
- "traefik.http.services.quran-web.loadbalancer.server.port=3000"
quran-api:
build: ./api
container_name: quran-api
restart: unless-stopped
env_file: .env
networks: [traefik-net, quran-internal]
labels:
- "traefik.enable=true"
- "traefik.http.routers.quran-api.rule=Host(`quran.diyaa.de`) && PathPrefix(`/api`)"
- "traefik.http.routers.quran-api.priority=100"
- "traefik.http.routers.quran-api.entrypoints=websecure"
- "traefik.http.routers.quran-api.tls.certresolver=myresolver"
- "traefik.http.services.quran-api.loadbalancer.server.port=8080"
quran-db:
image: postgres:16
container_name: quran-db
restart: unless-stopped
env_file: .env
networks: [quran-internal]
volumes:
- quran-pgdata:/var/lib/postgresql/data
networks:
traefik-net:
external: true
quran-internal:
volumes:
quran-pgdata:
```
The API uses the global prefix `/api`, so no path stripping is needed. A "Cannot GET /" or 404 with a valid certificate means Traefik works and the app has no such route: debug the app.
## Security
- Secrets only in the server `.env`.
- Security headers and a strict Content Security Policy; no third-party scripts, fonts or CDNs.
- CORS: the public API allows cross-origin reads only for GET.
- Rate limiting at the API; request size limits; no reader activity in logs.
- Database backups with a tested restore (T-029).
+50
View File
@@ -0,0 +1,50 @@
# Brief
## Idea
A Quran website at `quran.diyaa.de` for reading, listening and studying, and a public developer API served by the same server. The website is built first. The API is given to other developers with an API key.
## Operator
Private person (Diya). Free to use. Donations are possible later (mechanism not decided).
## Audience
- Readers: people who read the Quran verse by verse with a translation, a tafsir and audio.
- Developers: people who want Quran data through an API with a key.
## Languages
German, English, Spanish, Arabic, Turkish at launch. More later, including non-Latin scripts such as Russian. Adding a language must need data and strings only, no code changes.
## Website features
1. Surah list and verse-by-verse reader: Arabic text with one translation underneath.
2. Translation choice per language; the translator name is always visible.
3. Tafsir in a separate panel for the current verse; if a language has no tafsir, the panel says so clearly.
4. Audio player: the reader chooses the reciter and the surah; repeat of a verse or range; sleep timer; optional offline use is not planned for v1.
5. Favorites (surahs, reciters, translations, tafsirs), bookmarks (saved verses), notes in plain text with one-level folders. Stored only in the reader's browser; there is no login.
6. Search over the Arabic text (diacritics ignored) and the selected translation, plus surah names in several languages and spellings.
7. Daily reminder: depends on what the web allows without an account (open question, T-019).
8. Right-to-left layout for Arabic with left-to-right translations on the same page. Dark mode, responsive layout, keyboard and screen-reader support.
## Public API
- For developers, with an API key and request limits.
- Serves only openly licensed data (see `docs/architecture.md`, data zones).
- Documented with OpenAPI and a developer page on the site.
## Out of scope for v1
- Reader accounts and server-side sync of favorites and notes.
- Highlighting the current verse during audio, playback speed.
- Tafsir search and verse-number search.
- Mushaf page images.
- Any machine-made translation or tafsir.
## Success criteria
- A reader can open any surah, read it with a translation, open the tafsir if one exists, and play it with a chosen reciter.
- Search finds Arabic words typed without diacritics and words in the selected translation.
- A developer can get a key and read open data from the API within the documented limits.
- The site loads fast and works on phones and in right-to-left mode.
+62
View File
@@ -0,0 +1,62 @@
# Decisions
## Decided
| ID | Decision | Date | Reason |
| --- | --- | --- | --- |
| W-001 | Start with the website; it serves the public API | 2026-11-11 | Owner's choice |
| W-002 | Website features match the full reading feature set (reader, tafsir, audio, favorites, bookmarks, notes, search) | 2026-11-11 | Owner's choice |
| W-003 | No reader login for now; favorites, bookmarks and notes stay in the browser | 2026-11-11 | Owner's choice |
| W-004 | Data comes from two zones: Quran Foundation for the website, open licensed sources for the public API | 2026-11-11 | Owner's choice; Quran Foundation terms limit redistribution |
| W-005 | Public API is for developers with an API key and request limits | 2026-11-11 | Owner's choice |
| W-006 | Next.js website with a NestJS + PostgreSQL API, Docker Compose behind Traefik | 2026-11-11 | Owner's choice |
| W-007 | One domain: `quran.diyaa.de`; API under `/api` | 2026-11-11 | Owner's choice |
| W-008 | Initial languages: German, English, Spanish, Arabic, Turkish; more later | 2026-11-11 | Owner's choice |
| W-009 | Translations and tafsir come only from named sources; no AI translation | 2026-11-11 | Correctness of religious text |
| W-010 | Legal topics are out of scope for now | 2026-11-05 | Owner's decision |
| W-011 | Free to use, donations possible; operator is a private person | 2026-11-11 | Owner's choice |
## Open questions
1. Package manager: npm, pnpm or yarn.
2. Which openly licensed sources for text, translations, tafsir and audio (T-002, T-003). The license must allow redistribution through an API.
3. First reciters for the website (from the Content API and from open sources).
4. Developer signup: how does a developer get a key without a reader login (email with verification, or manual keys from the owner)?
5. Rate-limit values and whether there are paid or higher tiers.
6. Daily reminder on the web: web push needs a service worker and permission; decide whether to offer it (T-019).
7. Design feel: calm and simple, traditional, or modern; Arabic font choice and size options.
8. Riwaya (reading) and whether to add Mushaf page images later.
9. Donation mechanism and where it appears.
10. Arabic search folding: whether to treat ى/ي and ة/ه as equal.
11. Which data the server stores about API developers (minimum: email, key hash, counters).
12. Deadline or launch target.
## Sources and licenses (research in T-002; selection in T-003)
A source may enter the public API only when this table is complete for it.
| Source | Content | License | Redistribution allowed | Attribution text | Link | Date checked |
| --- | --- | --- | --- | --- | --- | --- |
| Tanzil Project | Arabic Quran text, v1.1 | CC BY 3.0, with source's explicit verbatim-only terms | Verbatim copying and distribution allowed; API use must preserve text and required notices | `Tanzil Quran Text, Copyright (C) 2007-2021 Tanzil Project, CC BY 3.0`; link to tanzil.net and reproduce the complete notice as required | [Text license](https://tanzil.net/docs/Text_License), [download](https://tanzil.net/download/) | 2026-11-11 |
| ClearQuran, Talal Itani | English translation, God and Allah editions | CC BY-ND 4.0 plus the copyright holder's additional permissions | Yes, including commercial distribution; keep wording unchanged and include credit. Source expressly permits conversion and selected verses. | `Translation by Talal Itani, ClearQuran.com`; link where possible, and provide license information | [Downloads and license](https://clearquran.com/download/) | 2026-11-11 |
| QuranEnc | Translation catalog, including Spanish by Muhammad Isa García | Source-specific republication conditions, not a standard open license | Republishing allowed subject to conditions; suitability of a verse-by-verse API and each selected edition's attribution/rights needs confirmation before import | Identify the publisher and QuranEnc.com, include the version and transcript information; also show the translator | [API and terms](https://quranenc.com/en/home/api/), [Spanish catalog](https://quranenc.com/api/v1/translations/list/es) | 2026-11-11 |
These are research candidates, not default selections or blanket approval for all material hosted by each source. See [source research](source-research.md) for conditions, coverage, and unresolved questions.
## Translations (fill in T-003)
| Language | Resource | Author | Zone (qf or open) | Reason |
| --- | --- | --- | --- | --- |
| de | | | | |
| en | | | | |
| es | | | | |
| ar | | | | |
| tr | | | | |
Notes carried over: the public Quran.com catalog lists no Arabic translation and tafsir only in a few languages. For Arabic readers an Arabic tafsir can be offered and labeled as tafsir; for German, Spanish and Turkish the tafsir button can be hidden and the translation shown alone. Confirm against the real data first.
## Reciters (fill in T-003)
| Reciter | Style | Source | File type | License | Notes |
| --- | --- | --- | --- | --- | --- |
| (none yet) | | | | | |
+26
View File
@@ -0,0 +1,26 @@
# Legal
## Operator
Private person (Diya). The site is free; donations are possible later.
## Status
On 2026-11-05 the owner decided legal topics are out of scope for this work. No legal research is done and no legal text is written here. Nothing below is legal advice, and nothing here has been verified against the live laws or terms.
## Engineering rules that stay in force
These are technical rules that come from the data providers' terms and from good practice; they are not legal work.
- The public API serves only sources recorded in `decisions.md` with a license that allows redistribution and with their attribution text.
- Quran Foundation content stays in the internal zone and is never returned by the public API. Content Sync only; sync at least every 7 days; the Quran text is never modified.
- Quran Foundation credentials stay on the server.
- Every translation and tafsir shows its author and source.
- Store only what is needed about API developers; no analytics or tracking.
- Before any feature that handles personal data, payments, tracking or accounts is shipped, the owner is asked first.
## Open items
Each item is also a task in `docs/tasks/`.
- Reopen legal questions before opening the API to other people (T-030): operator identification on the site, privacy information for API developers, terms for API use, donation rules. Not started; the owner decides when.
+16
View File
@@ -0,0 +1,16 @@
# Risks
| Risk | Impact | Handling |
| --- | --- | --- |
| Public API serves Quran Foundation data by mistake | Breaks the source rules | Separate tables and modules; invariant check; tests on the public module |
| No openly licensed source for tafsir or audio in some languages | Public API has gaps | Document the gaps in the API; website can still show them from the internal zone |
| API abuse or scraping | Server load, cost | Keys, rate limits, request size limits, revocation |
| Wrong or altered Quran text | Serious religious and trust problem | Never alter text; checksums per verse after import; compare counts (6,236 verses); review by a person |
| Wrong translation attribution | Trust problem | Author and source stored with every translation and shown everywhere |
| Quran Foundation credentials leak | Account loss | Server `.env` only; never in browser code or logs; rotate on suspicion |
| Content Sync not run for more than 7 days | Breaks the source rules | Scheduled job and an alert when the last sync is old |
| Server state differs from the notes | Deploy fails | Verify first (T-001) |
| One server for site, API and database | Downtime affects everything | Backups, restart policy, monitoring; accept for a private project |
| Arabic search misses variants | Poor search | Test with real examples; decide folding rules |
| Right-to-left and left-to-right mixed on one page | Broken layout | Test the reader in all five languages |
| Web reminders are unreliable without an account | Feature may not work | Decide scope in T-019; do not promise it |
+31
View File
@@ -0,0 +1,31 @@
# Source research
Checked 2026-11-11 for T-002. These findings do not select defaults; T-003 makes those choices. No content has been imported.
## Arabic text
- [Tanzil text license](https://tanzil.net/docs/Text_License) permits verbatim copying and distribution, identifies CC BY 3.0, requires the source and a link, and requires its full copyright notice in copies and appropriate reproduction in files containing substantial portions. The same terms explicitly prohibit changing the text; preserve this restriction even though the CC label alone might suggest otherwise.
- Maintainer: Tanzil Project. Its [download page](https://tanzil.net/download/) identifies version 1.1, published February 2021, with selectable text types and output formats. Record the exact text type and download options at import; check coverage and integrity against the downloaded release. This license applies to the text, not automatically to translations.
## Translations and tafsir
- [ClearQuran](https://clearquran.com/download/), maintained by translator Talal Itani, provides English God and Allah editions in plain text, EPUB, Word and PDF. The page identifies CC BY-ND 4.0 and an additional permission from the copyright holder to reformat, convert, quote selected verses and combine content, provided no words are changed, added or removed and the specified credit is included. Commercial distribution is expressly permitted. Verify completeness and exact edition at import. Audio on the page is English translation narration, not evidence of licensed Arabic recitations; named voice and coverage still need checking.
- [QuranEnc's API terms](https://quranenc.com/en/home/api/) permit downloading and republishing translations subject to no modification, addition or deletion, publisher/source attribution, version and transcript information, reporting notes, updating to the latest version, and restrictions on inappropriate advertisements. The catalog exposes JSON by language and translation, with verse and footnote data; the [Spanish catalog](https://quranenc.com/api/v1/translations/list/es) lists Muhammad Isa García's translation, version 1.0.2, with SQLite, PDF and EPUB downloads. QuranEnc maintains the service; identify the publisher and author for each edition. Confirm that serving individual verses and footnotes with all required information satisfies its conditions, and verify each edition's rights and completeness before using it in the public API. Direct requests from this environment returned HTTP 403; the Spanish catalog was accessed through the web reader. Other language catalogs and their completeness remain unverified.
- [Tanzil's translation page](https://tanzil.net/trans/) lists German, English, Spanish, Turkish and Arabic tafsir resources, but states that its translations are for non-commercial use and restricts redistribution of its list. Do not infer that the Arabic text license covers these translations, or admit them to the public API on that basis. Arabic entries include tafsir, not an Arabic translation.
## Language and content gaps
| Area | Status |
| --- | --- |
| German | No verified, API-ready open translation or tafsir identified. QuranEnc coverage and edition rights still need checking. |
| English | ClearQuran translation is a candidate; completeness and exact import format still need checking. No verified open tafsir. |
| Spanish | QuranEnc lists a named translation; conditions for the planned API and completeness need checking. No verified open tafsir. |
| Arabic | Tanzil text is a candidate with verbatim-only conditions. No verified API-ready open tafsir; do not label tafsir as translation. |
| Turkish | No verified, API-ready open translation or tafsir identified. QuranEnc coverage and edition rights still need checking. |
| Arabic recitation audio | No recording with verified redistribution rights, reciter attribution, and complete coverage identified. A website or dataset license does not automatically license third-party recordings. |
## Quran Foundation
- [Developer terms](https://api-docs.quran.com/legal/developer-terms/), last updated 2026-10-11, permit displaying content within the end-user application, including via a developer-controlled backend, subject to the terms. Distribution as raw data or through another API requires a separate signed commercial license. Content Sync copies must be updated at least every seven days when connectivity permits; non-Sync content has a one-week storage limit subject to specified exceptions. Do not put QF content in the public API.
- [Content Sync documentation](https://api-docs.quran.com/docs/tutorials/content-sync/getting-started/) describes translations, tafsir, verse and chapter recitations, and chapter audio timing records. [Chapter audio documentation](https://api-docs.quran.com/docs/content_apis_versioned/4.0.0/chapter-reciter-audio-file/) describes file size in bytes, format, URLs, and optional timing data in milliseconds; timing data may be absent and legacy durations can be negative. These are documented schema capabilities, not verified coverage for any particular reciter or language.
- Production catalog availability per language, reciters, actual timings, file sizes, and sample content have **not** been checked against the authenticated Content API. On 2026-11-11 the planned server file `/opt/quran-web/.env` was absent; no credential values were read. Access requires an authorized backend client; prelive and production credentials and caches must remain separate. Check approved scopes and catalogs without exposing credentials, then record the environment and date. Do not infer Content API availability from Quran.com or documentation examples.
+58
View File
@@ -0,0 +1,58 @@
# Tasks
One file per task. Status values: `todo`, `in progress`, `done`. Mark `done` only when verified. Update the task file and this index together.
## Phase 0: Verification and decisions
| ID | Title | Status |
| --- | --- | --- |
| [T-001](T-001-verify-server-state.md) | Verify the server and DNS | in progress |
| [T-002](T-002-research-open-sources.md) | Research openly licensed Quran sources | in progress |
| [T-003](T-003-choose-data-sources.md) | Choose translations and reciters | todo |
| [T-004](T-004-api-design.md) | Design the public API | todo |
| [T-005](T-005-decide-open-questions.md) | Decide the open product questions | todo |
## Phase 1: Foundation
| ID | Title | Status |
| --- | --- | --- |
| [T-006](T-006-scaffold-repo.md) | Create the web and api projects | todo |
| [T-007](T-007-compose-and-traefik.md) | Docker Compose and Traefik files | todo |
| [T-008](T-008-database-schema.md) | Database schema and migrations | todo |
| [T-009](T-009-open-data-import.md) | Import the open-source data | todo |
| [T-010](T-010-qf-content-sync.md) | Quran Foundation Content Sync (internal zone) | todo |
## Phase 2: Reading
| ID | Title | Status |
| --- | --- | --- |
| [T-011](T-011-surah-list.md) | Surah list page | todo |
| [T-012](T-012-reader.md) | Verse-by-verse reader | todo |
| [T-013](T-013-translation-selection.md) | Translation selection and author display | todo |
| [T-014](T-014-tafsir-panel.md) | Tafsir panel | todo |
| [T-015](T-015-search.md) | Search | todo |
| [T-016](T-016-i18n-rtl.md) | Localization and right-to-left | todo |
| [T-017](T-017-audio-player.md) | Audio player | todo |
| [T-018](T-018-local-library.md) | Favorites, bookmarks and notes in the browser | todo |
| [T-019](T-019-daily-reminder.md) | Daily reminder (decide and build if possible) | todo |
## Phase 3: Public API
| ID | Title | Status |
| --- | --- | --- |
| [T-020](T-020-api-keys.md) | API keys | todo |
| [T-021](T-021-rate-limits.md) | Rate limits and usage counters | todo |
| [T-022](T-022-public-endpoints.md) | Public API endpoints | todo |
| [T-023](T-023-openapi-docs.md) | OpenAPI document and developer page | todo |
| [T-024](T-024-usage-logging.md) | Minimal logging and abuse monitoring | todo |
## Phase 4: Release
| ID | Title | Status |
| --- | --- | --- |
| [T-025](T-025-security-pass.md) | Security pass | todo |
| [T-026](T-026-accessibility-performance.md) | Accessibility and performance pass | todo |
| [T-027](T-027-backups.md) | Backups and restore test | todo |
| [T-028](T-028-deploy-and-verify.md) | Deploy to quran.diyaa.de and verify | todo |
| [T-029](T-029-launch-checklist.md) | Launch checklist | todo |
| [T-030](T-030-legal-revisit.md) | Reopen the legal question before opening the API to others | todo |
+21
View File
@@ -0,0 +1,21 @@
# T-001: Verify the server and DNS
| Field | Value |
| --- | --- |
| Status | in progress |
| Phase | Phase 0: Verification and decisions |
| Depends on | - |
## Description
Check the facts in docs/architecture.md (Server) on the real server: DNS for quran.diyaa.de, Traefik version, network traefik-net, entrypoints, certificate resolver, firewall, free disk and memory. The server may have been rebuilt since August 2026.
## Done when
Results with the date written in docs/architecture.md; every difference listed and the owner told.
## Notes
Commands are listed in docs/architecture.md. Also check the provider's own firewall.
2026-11-11: DNS and host checks are recorded in `docs/architecture.md`. The provider firewall remains unverified because access to the provider account was not available. Do not mark this task done until it has been checked.
+21
View File
@@ -0,0 +1,21 @@
# T-002: Research openly licensed Quran sources
| Field | Value |
| --- | --- |
| Status | in progress |
| Phase | Phase 0: Verification and decisions |
| Depends on | - |
## Description
Find sources for the Arabic text, translations (de, en, es, ar, tr), tafsir and audio whose license allows redistribution through an API. For each: license text, redistribution and attribution rules, format, completeness, who maintains it. Also verify against the Quran Foundation Content API what is available per language (tafsir, audio, timings, file sizes) and whether showing that content on the website is covered by its terms.
## Done when
docs/decisions.md Sources table filled with license, link, date checked and attribution text; gaps per language listed.
## Notes
Do not rely on memory for licenses; read the live pages and record the date. Public Quran.com findings are not verified against the Content API.
2026-11-11: Initial source research and unresolved coverage are recorded in `docs/decisions.md` and `docs/source-research.md`. Production Content API catalogs, actual audio coverage and provider-specific permissions remain unverified. Finish those checks and close the listed source gaps before marking this task done.
+19
View File
@@ -0,0 +1,19 @@
# T-003: Choose translations and reciters
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 0: Verification and decisions |
| Depends on | T-002 |
## Description
Pick one well-known translation per language (de, en, es, ar, tr) and the first reciters. Decide per item whether it lives in the qf or the open zone.
## Done when
Translations and Reciters tables in docs/decisions.md filled with resource, author, zone and reason.
## Notes
No AI translation. The owner can change defaults later.
+19
View File
@@ -0,0 +1,19 @@
# T-004: Design the public API
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 0: Verification and decisions |
| Depends on | T-002 |
## Description
Turn the proposed API in docs/architecture.md into a final design: endpoints, response shapes, paging, error format, versioning, key format and header, rate-limit headers, CORS.
## Done when
Final API design in docs/architecture.md and an OpenAPI skeleton agreed with the owner.
## Notes
Every translation or tafsir response carries author, source and license.
+19
View File
@@ -0,0 +1,19 @@
# T-005: Decide the open product questions
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 0: Verification and decisions |
| Depends on | - |
## Description
Close the open questions in docs/decisions.md: package manager, developer signup, rate limits, reminder scope, design feel, riwaya, donations, Arabic folding, stored developer data, deadline.
## Done when
Each question is answered and moved into the Decided table with a reason.
## Notes
Discuss with the owner one question at a time.
+19
View File
@@ -0,0 +1,19 @@
# T-006: Create the web and api projects
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 1: Foundation |
| Depends on | T-005 |
## Description
Create web/ (Next.js, TypeScript) and api/ (NestJS, TypeScript) with lockfiles and the npm scripts build, lint, typecheck and test. Set the global API prefix /api and a health endpoint.
## Done when
make build PACKAGE_ONLY=1 and make test pass on a clean checkout.
## Notes
Package manager from T-005. Placeholders in COMMANDS_AGENT.md replaced.
+19
View File
@@ -0,0 +1,19 @@
# T-007: Docker Compose and Traefik files
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 1: Foundation |
| Depends on | T-001, T-006 |
## Description
Create deploy/docker-compose.yml with quran-web, quran-api and quran-db following docs/architecture.md, Dockerfiles for web and api, and deploy/.env.example. No ports: on any service.
## Done when
Compose file validates (docker compose config); invariant check passes; labels match the template.
## Notes
Router and service names must be unique on the server. Do not deploy here (T-028).
+19
View File
@@ -0,0 +1,19 @@
# T-008: Database schema and migrations
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 1: Foundation |
| Depends on | T-006, T-003 |
## Description
Create the qf_ and open_ content tables, the API tables and indexes with migrations. Separate import code per zone.
## Done when
Migrations run on a fresh database; tests cover creation and the zone separation.
## Notes
Follow docs/architecture.md data model.
+19
View File
@@ -0,0 +1,19 @@
# T-009: Import the open-source data
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 1: Foundation |
| Depends on | T-008, T-003 |
## Description
Write the import for the chosen open sources into open_ tables with author, source and license stored. Verify the Arabic text: 114 chapters and 6,236 verses, no changes to the text.
## Done when
Import is repeatable; counts and checksums verified; a sample of verses compared by a person.
## Notes
The Quran text is never altered; normalization only in the search column.
+19
View File
@@ -0,0 +1,19 @@
# T-010: Quran Foundation Content Sync (internal zone)
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 1: Foundation |
| Depends on | T-008, T-002 |
## Description
Implement bootstrap, snapshots, incremental sync, token handling and a scheduled sync at least every 7 days into qf_ tables. Keep prelive and production tokens and caches separate. Show the last sync time in an internal status endpoint.
## Done when
First sync fills qf_ tables; a second sync applies only changes; tests cover the mutation types; an alert exists when the last sync is older than 7 days.
## Notes
Credentials only from the server env. Never print token or secret values.
+19
View File
@@ -0,0 +1,19 @@
# T-011: Surah list page
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 2: Reading |
| Depends on | T-009 |
## Description
Home page and surah list with names in the five languages.
## Done when
All 114 chapters listed, links work, layout correct in right-to-left and left-to-right.
## Notes
None yet.
+19
View File
@@ -0,0 +1,19 @@
# T-012: Verse-by-verse reader
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 2: Reading |
| Depends on | T-009, T-011 |
## Description
Reader page /surah/{n}: each verse with the exact Arabic text and one translation underneath. Right-to-left Arabic with left-to-right translation on the same page.
## Done when
All surahs render from the database; Arabic text matches the source exactly; keyboard and screen-reader checked.
## Notes
Never alter the Quran text.
+19
View File
@@ -0,0 +1,19 @@
# T-013: Translation selection and author display
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 2: Reading |
| Depends on | T-012, T-003 |
## Description
Let the reader pick a translation per language and always show the author and source.
## Done when
Choice persists in the browser; author visible on every page that shows a translation.
## Notes
None yet.
+19
View File
@@ -0,0 +1,19 @@
# T-014: Tafsir panel
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 2: Reading |
| Depends on | T-012, T-002 |
## Description
Show the tafsir for the current verse in a side or bottom panel. Handle ranges (one entry can cover several verses). Languages without tafsir show a clear message or hide the button.
## Done when
Works with real data; empty states shown correctly.
## Notes
Depends on which languages have tafsir (T-002).
+19
View File
@@ -0,0 +1,19 @@
# T-015: Search
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 2: Reading |
| Depends on | T-009 |
## Description
Search over the normalized Arabic column and the selected translation with PostgreSQL full-text search, plus surah names in several languages and spellings.
## Done when
Tests with real Arabic, German, Spanish and Turkish examples; results open the verse in the reader.
## Notes
Normalization is only for searching. Not in v1: tafsir search, verse-number search.
+19
View File
@@ -0,0 +1,19 @@
# T-016: Localization and right-to-left
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 2: Reading |
| Depends on | T-012 |
## Description
Interface strings for German, English, Spanish, Arabic and Turkish; language switcher; right-to-left layout; a language registry so a sixth language needs data and strings only.
## Done when
Site runs in all five languages; layout checked in each; adding a test language needs no code change.
## Notes
Check fonts and text segmentation for non-Latin scripts later.
+19
View File
@@ -0,0 +1,19 @@
# T-017: Audio player
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 2: Reading |
| Depends on | T-009, T-003 |
## Description
Web player with the reciter chosen by the reader, surah selection, next surah, repeat of a verse or range and a sleep timer. Media Session controls for lock screen and keys.
## Done when
Plays a surah with a chosen reciter on desktop and phone browsers; repeat and timer verified.
## Notes
Not in v1: verse highlighting, playback speed, offline download.
+19
View File
@@ -0,0 +1,19 @@
# T-018: Favorites, bookmarks and notes in the browser
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 2: Reading |
| Depends on | T-012 |
## Description
Favorites (surahs, reciters, translations, tafsirs), several bookmarks with optional names, an automatic last-read position, plain-text notes on a verse and one-level folders. Store in IndexedDB with UUID and updatedAt per record. Provide export and import of this data as a file.
## Done when
Data persists across reloads; export and import round-trip; clear message that data lives only in this browser.
## Notes
No login. Records keep UUID and updatedAt so a later account sync is possible.
+19
View File
@@ -0,0 +1,19 @@
# T-019: Daily reminder (decide and build if possible)
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 2: Reading |
| Depends on | T-005 |
## Description
Decide whether a web reminder is feasible without an account (web push with a service worker and permission, or an installable page). Build it only if the decision says yes.
## Done when
Decision recorded in docs/decisions.md; if built, the notification arrives on a real browser and the permission is asked only when the reader turns it on.
## Notes
Do not promise reliable delivery.
+19
View File
@@ -0,0 +1,19 @@
# T-020: API keys
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 3: Public API |
| Depends on | T-004, T-008 |
## Description
Create, show once, hash (with a server pepper), rotate and revoke API keys. Signup flow decided in T-005.
## Done when
A key works until revoked; only the hash is stored; tests cover creation, use, rotation, revocation.
## Notes
None yet.
+19
View File
@@ -0,0 +1,19 @@
# T-021: Rate limits and usage counters
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 3: Public API |
| Depends on | T-020 |
## Description
Per-key limits per minute and per day, usage counters, rate-limit headers and clear error responses.
## Done when
Limits enforced and tested; headers present; counters visible to the owner.
## Notes
Values from T-005.
+19
View File
@@ -0,0 +1,19 @@
# T-022: Public API endpoints
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 3: Public API |
| Depends on | T-004, T-009, T-020 |
## Description
Implement the endpoints in docs/architecture.md under api/src/public/, reading only open_ tables. Attribution fields on every response.
## Done when
All endpoints return correct data; tests prove no qf_ data is reachable; invariant check passes.
## Notes
None yet.
+19
View File
@@ -0,0 +1,19 @@
# T-023: OpenAPI document and developer page
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 3: Public API |
| Depends on | T-022 |
## Description
Generate the OpenAPI document and build the /developers page with examples, limits, attribution requirements and how to get a key.
## Done when
A developer can follow the page and make a successful request.
## Notes
None yet.
+19
View File
@@ -0,0 +1,19 @@
# T-024: Minimal logging and abuse monitoring
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 3: Public API |
| Depends on | T-021 |
## Description
Log only what is needed to run and defend the API (key id, route, status, time). No reader activity, no IP storage beyond what rate limiting needs. Basic alerts for spikes and errors.
## Done when
Logs reviewed for secrets and personal data; alert fires in a test.
## Notes
None yet.
+19
View File
@@ -0,0 +1,19 @@
# T-025: Security pass
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 4: Release |
| Depends on | T-022 |
## Description
Security headers, strict Content Security Policy, CORS, request limits, dependency audit, secrets scan, error pages that leak nothing.
## Done when
Checklist run with the date and results; no secrets in git history.
## Notes
None yet.
@@ -0,0 +1,19 @@
# T-026: Accessibility and performance pass
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 4: Release |
| Depends on | T-018, T-017 |
## Description
Screen reader, keyboard, contrast, Dynamic text size, dark mode, right-to-left; Lighthouse and real-phone checks; caching of static data.
## Done when
Written results with devices and browsers; issues fixed or listed.
## Notes
None yet.
+19
View File
@@ -0,0 +1,19 @@
# T-027: Backups and restore test
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 4: Release |
| Depends on | T-007 |
## Description
Scheduled PostgreSQL backups stored off the server and a tested restore.
## Done when
A restore on a clean database succeeds and is recorded with the date.
## Notes
None yet.
+19
View File
@@ -0,0 +1,19 @@
# T-028: Deploy to quran.diyaa.de and verify
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 4: Release |
| Depends on | T-025, T-027 |
## Description
Only when the owner asks. Deploy the compose stack to /opt/quran-web, wait for the certificate, check the site and the API.
## Done when
curl -I https://quran.diyaa.de returns 200 or 302; GET /api/health works; the certificate is valid; results recorded.
## Notes
A 404 with a valid certificate means Traefik works and the app lacks the route.
+19
View File
@@ -0,0 +1,19 @@
# T-029: Launch checklist
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 4: Release |
| Depends on | T-028 |
## Description
Check sources and attributions on /about, the license table, the sync job, backups, monitoring, and that the public API serves no qf_ data in production.
## Done when
Checklist filled with the date; owner confirms launch.
## Notes
None yet.
+19
View File
@@ -0,0 +1,19 @@
# T-030: Reopen the legal question before opening the API to others
| Field | Value |
| --- | --- |
| Status | todo |
| Phase | Phase 4: Release |
| Depends on | - |
## Description
Only if the owner decides to give API keys to other people or publish widely: reopen docs/legal.md.
## Done when
The owner has decided what to do. Until then nothing is done and the task stays open.
## Notes
Owner decision of 2026-11-05: legal topics are not handled in this project.