1. Overview

Replace the stub in database/db.py with a working SQLite implementation.

This step establishes the data layer foundation for the Spendly application.

All future features (authentication, profile, expense tracking) depend on this being correctly implemented.


2. Depends on

Nothing — this is the first step.


3. Routes


4. Database Schema


A. users

Column Type Constraints
id INTEGER Primary key, autoincrement
name TEXT Not null
email TEXT Unique, not null
password_hash TEXT Not null
created_at TEXT Default datetime('now')

B. expenses

Column Type Constraints
id INTEGER Primary key, autoincrement
user_id INTEGER Foreign key → users.id, not null
amount REAL Not null
category TEXT Not null
date TEXT Not null (YYYY-MM-DD format)
description TEXT Nullable
created_at TEXT Default datetime('now')