Recursive Task Lists API

A REST API for managing recursive task lists, built on Val Town with per-val SQLite and owner-only OAuth authentication.

Authentication

All /api/* endpoints are protected. Only the val owner can access them.

  1. Visit /auth/login to authenticate via Val Town OAuth
  2. After login, your session cookie is set automatically
  3. All subsequent API requests use that cookie

Unauthenticated requests return 401. Non-owner users get 403.

Endpoints

Task Lists

MethodPathDescription
GET/api/task-listsList all task lists
POST/api/task-listsCreate a task list
GET/api/task-lists/:idGet a task list with full recursive task tree
PUT/api/task-lists/:idUpdate title/description
DELETE/api/task-lists/:idDelete a list and all its tasks

Tasks

MethodPathDescription
POST/api/task-lists/:listId/tasksCreate a top-level task (or nested via parent_task_id)
GET/api/tasks/:idGet a task with its subtask tree
PUT/api/tasks/:idUpdate title, description, or mark done
DELETE/api/tasks/:idDelete a task and all subtasks
POST/api/tasks/:id/subtasksAdd a subtask to a task

Data Model

Rendering mermaid diagram...

Example Usage

# Create a task list curl -X POST /api/task-lists \ -H "Content-Type: application/json" \ -d '{"title": "My Project", "description": "Things to do"}' # Add a task curl -X POST /api/task-lists/1/tasks \ -H "Content-Type: application/json" \ -d '{"title": "Setup environment"}' # Add a subtask curl -X POST /api/tasks/1/subtasks \ -H "Content-Type: application/json" \ -d '{"title": "Install dependencies"}' # Mark task as done curl -X PUT /api/tasks/1 \ -H "Content-Type: application/json" \ -d '{"done": true}' # Get full tree curl /api/task-lists/1

Project Structure

main.ts                  # Hono HTTP entrypoint + OAuth wrapper
middleware/auth.ts       # Owner-only auth middleware
database/migrations.ts   # SQLite schema
database/queries.ts      # All DB operations + recursive tree builder
routes/task-lists.ts     # Task list CRUD routes
routes/tasks.ts          # Task CRUD + subtask routes