Skip to content

A modern expense tracker API built with FastAPI, SQLite, and JWT.

Notifications You must be signed in to change notification settings

windme2/expense-tracker-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Expense Tracker API 🚀

This expense tracking API, built with FastAPI and SQLite, handles CRUD operations for Users, Categories, and Transactions with JWT authentication.

🛠️ Tech Stack

  • 🐍 Python 3.8+: Programming language for the API.
  • FastAPI 0.104.1: Modern web framework with auto documentation.
  • 🗃️ SQLite: Lightweight database for data storage.
  • 🔐 JWT Auth: Secure token-based authentication.

🗃️ Database Schema

The database consists of three main tables:

👤 Users Table

Column Type Description
id int Auto-generated primary key 🔑
username str Unique username (required) 👤
email str User email address 📧
full_name str User's full name 🧑
hashed_password str Bcrypt hashed password 🔒

📂 Categories Table

Column Type Description
id int Auto-generated primary key 🔑
name str Category name (required) 📛
description str Category description 📝
color str Category color code 🎨
user_id int Foreign key linking to Users 🔗

💰 Transactions Table

Column Type Description
id int Auto-generated primary key 🔑
title str Transaction title (required) 📋
amount float Transaction amount 💵
type str Transaction type (income/expense) 📊
description str Transaction description 📝
date date Transaction date 📅
user_id int Foreign key linking to Users 🔗
category_id int Foreign key linking to Categories 🔗

⚙️ Getting Started

📥 Clone the Repository

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

🔧 Install Dependencies

python manage.py install

🗃️ Set Up Database

The SQLite database will be created automatically when you first run the application.

🧪 Run Tests

python manage.py test

▶️ Run the Application

python manage.py serve

📜 API Documentation

After starting the project, you can access the API documentation via Swagger UI at:
http://localhost:8000/docs

🧪 Test Credentials

  • Username: testuser
  • Password: testpass

🌐 API Endpoints

🔐 Authentication

Method Endpoint Description
POST /api/v1/auth/register Register new user ➕
POST /api/v1/auth/login User login 🔑
GET /api/v1/auth/me Get user profile 👤

📂 Categories

Method Endpoint Description
GET /api/v1/categories Get all categories 📋
POST /api/v1/categories Create a category ➕
PUT /api/v1/categories/{id} Update a category ✏️

💰 Transactions

Method Endpoint Description
GET /api/v1/transactions Get all transactions 📋
POST /api/v1/transactions Create a transaction ➕
PUT /api/v1/transactions/{id} Update a transaction ✏️

🤝 Contributing

Follow these steps to contribute to the project:

  1. Fork the repository
  2. Clone your fork:
git clone https://github.com/windme2/expense-tracker-api.git
cd expense-tracker-api
  1. Create a feature branch:
git checkout -b feature/expense-tracker
  1. Make your changes and commit:
git commit -m "Add feature expense-tracker"
  1. Push to your fork:
git push origin feature/expense-tracker
  1. Create a Pull Request from your fork to our main repository

📄 License

This project is licensed under the MIT License.

About

A modern expense tracker API built with FastAPI, SQLite, and JWT.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published