A beautiful, coffee-themed todo list application with database persistence, running totals, and automatic end-of-day processing.
- ☕ Coffee Shop Aesthetic: Warm brown tones and cozy design
- 📝 Task Management: Add tasks with amounts, toggle completion status
- 💰 Running Total: Automatically calculates total from completed tasks
- ⏰ End-of-Day Processing: Automatically deducts 50% of unfinished tasks at 11:59 PM
- 🏠 Home Server Integration:
/next_jobendpoint for external polling - 📱 Mobile Responsive: Works great on all devices
- 💾 Persistent Storage: SQLite database keeps your data safe
-
Create a virtual environment:
python3 -m venv venv source venv/bin/activate -
Install dependencies:
pip install -r requirements.txt
-
Run the application:
uvicorn main:app --reload --host 0.0.0.0 --port 8000
-
Open in browser: Navigate to
http://localhost:8000
GET /- Main todo list interface
POST /api/tasks- Create a new task- Body:
{"task_name": "Task name", "amount": 10.50}
- Body:
GET /api/tasks- Get all tasksPUT /api/tasks/{id}/toggle- Toggle task completion statusGET /api/total- Get current running total
GET /next_job- Get next uncompleted task for processing- Returns:
{"task": "task name", "amount": "10.50"}or{}
- Returns:
POST /complete_job- Mark a task as complete- Form data:
task_name=<task name>
- Form data:
-
Create a new Web Service on Render
-
Connect your GitHub repository
-
Configure the service:
- Build Command:
pip install -r requirements.txt - Start Command:
uvicorn main:app --host 0.0.0.0 --port $PORT - Environment: Python 3
- Build Command:
-
Add Environment Variable (optional):
- Key:
DATABASE_URL - Value:
sqlite:///./todos.db
- Key:
-
Deploy!
-
Create a PostgreSQL database on Render
-
Update the Web Service:
- Add the PostgreSQL database as an environment variable
- Render will automatically set
DATABASE_URL
-
Update requirements.txt to include PostgreSQL driver:
psycopg2-binary==2.9.9 -
Redeploy
- Persistence: SQLite data will be lost when the service restarts on free tier. Use PostgreSQL for production.
- Disk Storage: Render free tier has ephemeral storage - database will reset on each deployment.
- Scheduled Tasks: The end-of-day processing runs at 11:59 PM server time (UTC).
- Add Task: User creates a task with a name and amount
- Process Task: Task appears in the list, home server can poll
/next_jobto get it - Complete Task: Either toggle checkbox in UI or call
/complete_jobfrom home server - Running Total: Completed task amounts are added to running total
- End of Day: At 11:59 PM, unfinished tasks trigger 50% deduction from running total
Tasks Table:
id: Primary keytask_name: Task descriptionamount: Task amount/valueis_done: Completion statuscreated_at: Creation timestampcompleted_at: Completion timestamp
DailyTotals Table:
id: Primary keydate: Record datededuction_amount: Amount deductednotes: Reason for deduction
PendingTasks Table:
id: Primary keytask_id: Reference to tasksent_at: When task was sent to home server
Edit the scheduler configuration in main.py:
scheduler.add_job(process_end_of_day, CronTrigger(hour=23, minute=59))Edit the process_end_of_day() function:
deduction = sum(task.amount * 0.5 for task in unfinished_tasks) # Change 0.5 to your percentageModify the CSS in the render_page() function to change the coffee shop theme colors.
- Delete
todos.dbfile and restart to reset the database - Check file permissions if SQLite fails to write
- Verify APScheduler is installed:
pip show apscheduler - Check server logs for scheduler errors
- Ensure firewall allows incoming connections
- Verify the correct URL/port is being used
- Check that
/next_jobendpoint returns expected format
MIT License - Feel free to use and modify!
For issues or questions, please open an issue on GitHub.
Made with ☕ and ❤️