# Görev Masası — complete small web application

Build a usable Turkish personal task manager, not just an API. Deliver exactly one JSON object with three string-valued keys: app.py, index.html, README.md. Include full files, no Markdown fences or commentary. Python 3.12 standard library + sqlite3 and vanilla HTML/CSS/JS only; no downloads, external packages/CDN, shell commands, subprocesses, outbound network or environment access. No eval/exec/dynamic imports. You may use any ordinary standard library import needed for the task. App code is entirely yours; tests/measurement are external.

Start: python app.py --port NUMBER --db /absolute/path/tasks.sqlite. Bind ONLY 127.0.0.1 at that port; read index.html beside app.py. All persistent writes must be under the database parent. Initialize schema and two synthetic demo accounts only if missing: zeka / deneme-zeka-2026 and yapar / deneme-yapar-2026. Hash passwords with salted PBKDF2-HMAC-SHA256 (>=100000 iterations) or scrypt, no plaintext password in database. Demo password literals may appear in seed code/README. Existing DB must never be reset on startup. No registration needed.

HTTP contract:
* GET /health ->200 {ok:true}; GET / ->200 text/html (login UI).
* POST /api/login JSON {username,password} ->200 {username} and random opaque session cookie named session, HttpOnly, SameSite=Strict, Path=/; wrong password/unknown user ->401 JSON error. Sessions may be memory-only, expire after <=24h, and be invalidated on logout. Password/token not in JSON responses or logs. Each account can have multiple sessions.
* GET /api/me ->200 {username} when logged in; otherwise401.
* POST /api/logout ->200 {ok:true}, invalidate this session and expire cookie. All /api/tasks operations below require login (401 otherwise).
* Task shape exactly id (positive integer), title (trimmed string 1..120 chars), description (string <=1000, default empty), status ('todo','doing','done', default 'todo'), priority ('low','normal','high', default 'normal'). The server assigns owner; never return owner_id/username/password/session in a task. Reject unknown input keys incl id/owner_id, wrong types, invalid enum, oversized/blank title with400 JSON; bool is not integer. Errors must not mutate state.
* POST /api/tasks body title plus optional description/status/priority ->201 task. GET /api/tasks/{id} ->200 task. PUT /api/tasks/{id} replaces user fields, requires title, optional fields reset to defaults ->200 task. DELETE /api/tasks/{id} ->200 {deleted:true}. Missing or other user's id ->404 for all three; never change another user's row.
* GET /api/tasks?q=...&status=...&priority=... ->200 {items:[tasks],total:N}; filters combine AND; q is Unicode casefold substring in title OR description, literal text not SQL wildcard. Empty filters have no effect. Invalid status/priority400. Items newest id first, total is filtered count. URL decoding supported. Only own tasks.
* GET /api/stats ->200 {total:N,todo:N,doing:N,done:N}, only own tasks, independent of filters.
* JSON body limit16384 bytes ->413; malformed JSON/wrong root type400. All API errors JSON {error:string}, no traceback, SQL, filesystem path or credentials. Unsupported method on API path405. Parameterized SQL. Mutating request with Origin header other than the app's actual http://127.0.0.1:PORT must return403 before changing state (login too). Requests without Origin are permitted for CLI tests. Cookie-based identity cannot be overridden via request fields. Do not serve arbitrary filesystem files.

UI contract (Turkish, keyboard usable, responsive at390px): login form labels 'Kullanıcı adı' and 'Parola', button 'Giriş yap'; demo accounts may be documented visibly. On login, show username, 'Çıkış yap', own task list and four counters (total/todo/doing/done). Task form labels 'Başlık','Açıklama','Durum','Öncelik', button 'Kaydet'; choices include visible 'Yapılacak','Sürüyor','Tamamlandı' and 'Düşük','Normal','Yüksek'. Each row has 'Düzenle' (loads form) and 'Sil' (asks confirmation). Form supports canceling edit via 'Vazgeç'. Separate filters: 'Ara','Durum filtresi','Öncelik filtresi'; apply as controls change or via 'Filtrele'. Empty-state and visible success/error feedback; failed operations must not look successful. Render user values as text, never execute stored HTML/JS. No inline HTML event handlers or external assets required. Reload keeps authenticated session and existing tasks; logout returns to login. README documents exact launch command, both demo accounts and how data persists; do not claim production-ready security.

Include a small self-test file? NO, only the three required files. We will test externally. A complete working app with clear simple UI is preferred to decorative complexity.
