A full-stack expense tracking application built with FastAPI (Python) and Svelte 5, featuring user authentication, category management, expense tracking, and analytics visualization.
expense-tracker/
āāā backend/
ā āāā app/
ā ā āāā analytics.py # Analytics endpoints
ā ā āāā auth.py # Authentication routes
ā ā āāā categories.py # Category management
ā ā āāā expenses.py # Expense CRUD operations
ā ā āāā users.py # User profile endpoints
ā ā āāā models.py # Database models
ā ā āāā schemas.py # Pydantic schemas
ā ā āāā security.py # Auth utilities
ā ā āāā config.py # Configuration
ā ā āāā db.py # Database connection
ā āāā migrations/ # Alembic migrations
ā āāā pyproject.toml # Python dependencies
āāā frontend/
ā āāā src/
ā ā āāā lib/
ā ā ā āāā api/ # API client functions
ā ā ā āāā components/ # Reusable components
ā ā ā āāā stores/ # Svelte stores
ā ā āāā routes/ # Page components
ā ā āāā router/ # Route guards
ā ā āāā main.ts # App entry point
ā āāā package.json # Node dependencies
āāā docker-compose.yaml # Docker services
Create a .env file in the backend/ directory:
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=postgres
DATABASE_URL=postgresql://postgres:postgres@db:5432/expense_tracker
SECRET_KEY=your-secret-key-here
ACCESS_TOKEN_EXPIRE_MINUTES=30
Create a .env file in the frontend/ directory:
VITE_API_BASE_URL=http://localhost:8000
# Start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down
Services will be available at:
cd backend
# Install dependencies with uv
uv sync
# Run migrations
alembic upgrade head
# Start development server
uvicorn app.main:app --reload
cd frontend
# Install dependencies
npm install
# Start development server
npm run dev
POST /auth/register - Register new userPOST /auth/login - Login and get access tokenGET /categories/ - List all categoriesPOST /categories/ - Create new categoryGET /expenses/ - List expenses (with filters)POST /expenses/ - Create new expenseGET /expenses/{id} - Get single expensePUT /expenses/{id} - Update expenseDELETE /expenses/{id} - Delete expenseGET /analytics/spending-by-date - Daily spending dataGET /analytics/spending-by-category - Category breakdownGET /analytics/spending-by-month - Monthly trendsGET /users/ - Get current user profileid - UUID primary keyusername - Unique usernameemail - Unique emailhashed_password - Argon2 hashed passwordfull_name - Optional full namedisabled - Account statusid - UUID primary keyuser_id - Foreign key to usersname - Category namecolor - Hex color codeid - UUID primary keyuser_id - Foreign key to userscategory_id - Foreign key to categoriesamount - Expense amountdescription - Optional descriptiondate - Expense datecreated_at - Timestampgit checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License.