1.8 KiB
1.8 KiB
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.
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:
curl -X POST http://127.0.0.1:8090/v1/routines \
-H 'Content-Type: application/json' \
-d '{
"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:
{
"title": "Review finances",
"section": "work",
"priority": "must",
"schedule": {
"kind": "monthly",
"days": [31],
"clamp_to_last_day": true
}
}
Routes:
GET /health
GET /v1/tasks?date=YYYY-MM-DD
POST /v1/tasks
POST /v1/tasks/{id}/complete
POST /v1/tasks/{id}/reschedule
DELETE /v1/tasks/{id}
GET /v1/routines
POST /v1/routines
Weekly days use ISO numbers: Monday is 1, Sunday is 7.