A full-stack expense tracking application built with FastAPI (Python) and Svelte 5, featuring user authentication, category management, expense tracking, and analytics visualization.
- 🔐 User Authentication - Secure registration and login with JWT tokens
- 💰 Expense Management - Create, read, update, and delete expenses
- 🏷️ Category Organization - Organize expenses with custom categories and colors
- 📊 Analytics Dashboard - Visualize spending patterns with charts and graphs
- 🔍 Advanced Filtering - Filter expenses by date range and category
- 📱 Responsive Design - Modern UI built with Tailwind CSS and shadcn-svelte components
- FastAPI - Modern Python web framework
- SQLModel - SQL database ORM with Pydantic integration
- PostgreSQL - Relational database
- JWT - Token-based authentication
- Alembic - Database migrations
- Argon2 - Password hashing
- Svelte 5 - Modern reactive framework with runes
- TypeScript - Type-safe JavaScript
- Tailwind CSS - Utility-first CSS framework
- Chart.js - Data visualization
- shadcn-svelte - Reusable component library
- Vite - Fast build tool
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
- Docker & Docker Compose
- Node.js 18+ (for local frontend development)
- Python 3.12+ (for local backend development)
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=30Create 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 downServices will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
cd backend
# Install dependencies with uv
uv sync
# Run migrations
alembic upgrade head
# Start development server
uvicorn app.main:app --reloadcd frontend
# Install dependencies
npm install
# Start development server
npm run devPOST /auth/register- Register new userPOST /auth/login- Login and get access token
GET /categories/- List all categoriesPOST /categories/- Create new category
GET /expenses/- List expenses (with filters)POST /expenses/- Create new expenseGET /expenses/{id}- Get single expensePUT /expenses/{id}- Update expenseDELETE /expenses/{id}- Delete expense
GET /analytics/spending-by-date- Daily spending dataGET /analytics/spending-by-category- Category breakdownGET /analytics/spending-by-month- Monthly trends
GET /users/- Get current user profile
id- UUID primary keyusername- Unique usernameemail- Unique emailhashed_password- Argon2 hashed passwordfull_name- Optional full namedisabled- Account status
id- UUID primary keyuser_id- Foreign key to usersname- Category namecolor- Hex color code
id- UUID primary keyuser_id- Foreign key to userscategory_id- Foreign key to categoriesamount- Expense amountdescription- Optional descriptiondate- Expense datecreated_at- Timestamp
- Overview statistics (total spent, categories, transactions)
- Recent expenses list
- Quick access to categories
- One-click expense creation
- Complete CRUD operations
- Advanced filtering (date range, category)
- Real-time statistics
- Inline editing and deletion
- Color-coded organization
- Search functionality
- Visual category cards
- Custom color picker
- Daily spending line chart
- Category distribution pie chart
- Monthly trends
- Detailed breakdowns with percentages
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.
- FastAPI - Backend framework
- Svelte - Frontend framework
- shadcn-svelte - UI components
- Chart.js - Charting library
