A lightweight HTTP Server built with FastAPI to manage todo items in a Notion database. It supports creating, listing, and marking tasks as complete, and distinguishes tasks by user.
- Uses Notion Database as a backend
- Supports user-specific filtering via
user_id - Allows date-based filtering (
when) and task completion tracking (completed) - Automatically ensures required Notion properties exist
- Ready for integration into cross-platform todo applications
- Python 3.9+
- FastAPI
- httpx
- python-dotenv
- uvicorn
- pydantic
Install dependencies:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -e .-
Create a Notion integration:
- Go to https://www.notion.so/my-integrations
- Create new integration
- Copy the API key
-
Share your database with the integration:
- Open your todo database in Notion
- Click "..." menu → "Add connections"
- Select your integration
Create a .env file in the project root with the following content:
NOTION_API_KEY=your_secret_notion_token
NOTION_DATABASE_ID=your_database_idpython server.pyBy default, it runs at http://0.0.0.0:8080
GET /Returns basic status and version information.
GET /database/infoReturns property definitions and verifies required fields exist.
POST /todos/all
Content-Type: application/json
{
"user_id": "your-user-id"
}Returns a list of all todo items for the user.
POST /todos/today
Content-Type: application/json
{
"user_id": "your-user-id"
}Returns todos with when set to today.
POST /todos
Content-Type: application/json
{
"task": "Buy groceries",
"when": "2025-01-15", // optional, can be empty string
"user_id": "your-user-id"
}Returns the created task ID.
PUT /todos/{task_id}/completeMarks the given task as complete.
The following properties are required in your Notion database. The service will auto-create them if they are missing:
Task(type:title)Completed(type:checkbox)When(type:date)User(type:rich_text)
- The
whenfield should followYYYY-MM-DDformat (e.g.,"2025-01-15"). - The todo
taskis stored as a JSON string in the Notion title to preserve structured data. - For production deployment, use a production server (e.g. Gunicorn + Uvicorn workers).
MIT License