Skip to content

stargate91/expense-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Expense Tracker API

A simple yet functional FastAPI project for tracking daily expenses using a SQLite database.
You can create, view, update, and delete expenses and categories, and also retrieve a summary of your spending.


Features

  • Track individual expenses
  • Categorize your expenses
  • Filter expenses by date and category
  • Get spending summaries (total amount, average cost, count)
  • Fully RESTful API structure with clear schema validation
  • Built with modular, production-ready FastAPI architecture

Tech Stack


How to Run

1. Clone the project

git clone https://github.com/stargate91/expense-tracker-api.git
cd expense-tracker-api

2. (Optional) Create virtual environment

python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

3. Install dependencies

pip install -r requirements.txt

4. Run the API

uvicorn expense_tracker_api.main:app --reload

5. Explore the API

Visit http://127.0.0.1:8000/docs
Interactive documentation (Swagger UI) is available for testing endpoints.


Endpoints Overview

Method Endpoint Description
GET /expenses List expenses (with filters)
GET /expenses/{id} Get a specific expense
POST /expenses Create a new expense
PUT /expenses/{id} Update an expense
DELETE /expenses/{id} Delete an expense
GET /categories List all categories
GET /categories/{id} Get a specific category
POST /categories Create a new category
PUT /categories/{id} Update a category
DELETE /categories/{id} Delete a category
GET /summary Get summary of expenses (filtered)

Project Structure

expense_tracker_api/
├── main.py                # FastAPI app entry point
├── routes/
│   ├── expenses.py        # Expense endpoints
│   ├── categories.py      # Category endpoints
│   └── summary.py         # Summary endpoint
├── models.py              # SQLAlchemy ORM models
├── schemas.py             # Pydantic models for validation
├── database.py            # SQLite DB connection + Base
├── dependencies.py        # Dependency injection (DB session)
├── __init__.py
requirements.txt           # Project dependencies
.gitignore
README.md

Roadmap / To-Do

  • Add SQLite + SQLAlchemy integration
  • Add user authentication (JWT or session-based)
  • Add CSV export
  • Create desktop GUI (Tkinter or PyQT)
  • Dockerize the application

Version

v0.2 – Switched from in-memory to persistent SQLite DB, added summary endpoint, modularized architecture.


Author

Made by a Python learner to practice REST APIs, FastAPI, and SQLAlchemy.
Thanks for checking it out! 😊

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages