This expense tracking API, built with FastAPI and SQLite, handles CRUD operations for Users, Categories, and Transactions with JWT authentication.
- 🐍 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.
The database consists of three main tables:
| Column | Type | Description |
|---|---|---|
| id | int |
Auto-generated primary key 🔑 |
| username | str |
Unique username (required) 👤 |
str |
User email address 📧 | |
| full_name | str |
User's full name 🧑 |
| hashed_password | str |
Bcrypt hashed password 🔒 |
| 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 🔗 |
| 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 🔗 |
git clone https://github.com/windme2/expense-tracker-api.git
cd expense-tracker-apipython manage.py installThe SQLite database will be created automatically when you first run the application.
python manage.py testpython manage.py serveAfter starting the project, you can access the API documentation via Swagger UI at:
http://localhost:8000/docs
- Username:
testuser - Password:
testpass
🔐 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 ✏️ |
Follow these steps to contribute to the project:
- Fork the repository
- Clone your fork:
git clone https://github.com/windme2/expense-tracker-api.git
cd expense-tracker-api- Create a feature branch:
git checkout -b feature/expense-tracker- Make your changes and commit:
git commit -m "Add feature expense-tracker"- Push to your fork:
git push origin feature/expense-tracker- Create a Pull Request from your fork to our main repository
This project is licensed under the MIT License.