# routine-server Small PostgreSQL-backed HTTP service for one-off tasks and daily, weekly, or monthly routine tasks. The server generates future task occurrences and can send due reminders through the Telegram Bot API. The server stores an obligatory public title, an optional client-encrypted payload, and the public age recipients of registered devices. It never receives an age identity and Telegram always uses the public title. ## Configuration | Variable | Default | Purpose | | --- | --- | --- | | `ROUTINE_BIND` | `127.0.0.1:8090` | HTTP listen address | | `ROUTINE_DATABASE_URL` | local `routine-server` database | PostgreSQL/libpq connection string | | `ROUTINE_API_TOKEN` | unset | Optional bearer token for every route except `/health` | | `ROUTINE_GENERATION_DAYS` | `62` | Number of future days to materialize | | `ROUTINE_WORKER_INTERVAL_SECONDS` | `60` | Generation/reminder polling interval | | `ROUTINE_TELEGRAM_BOT_TOKEN` | unset | Telegram bot token | | `ROUTINE_TELEGRAM_CHAT_ID` | unset | Telegram target chat | Telegram delivery is enabled only when both Telegram variables are present. Times use the service's local timezone and `HH:MM` format. ## API Create a weekly routine: ```sh curl -X POST http://127.0.0.1:8090/v1/routines \ -H 'Content-Type: application/json' \ -d '{ "public_title": "Exercise", "section": "evening", "priority": "should", "schedule": {"kind": "weekly", "weekdays": [1, 3, 5]}, "reminder_time": "18:00" }' ``` Create a monthly routine that moves day 31 to a shorter month's final day: ```json { "public_title": "Review finances", "section": "work", "priority": "must", "schedule": { "kind": "monthly", "days": [31], "clamp_to_last_day": true } } ``` Routes: ```text GET /health GET /v1/tasks?date=YYYY-MM-DD GET /v1/tasks/overdue?before=YYYY-MM-DD GET /v1/tasks/archived POST /v1/tasks PUT /v1/tasks/{id} POST /v1/tasks/{id}/complete POST /v1/tasks/{id}/archive POST /v1/tasks/{id}/restore POST /v1/tasks/{id}/reschedule DELETE /v1/tasks/{id} (archived tasks only) GET /v1/routines POST /v1/routines GET /v1/encryption/devices GET /v1/encryption/recipients POST /v1/encryption/devices POST /v1/encryption/devices/{id}/revoke ``` Weekly days use ISO numbers: Monday is `1`, Sunday is `7`. When private data is present, `encrypted_payload`, `encryption_version`, and `content_id` must all be set. `encrypted_payload` is an ASCII-armored age file containing the client's versioned JSON document. Only active device recipients are returned for encryption. Revocation affects new payloads; it cannot make ciphertext that a device already received unreadable.