A simple, secure, and efficient REST API for tracking personal expenses. Built with FastAPI for high performance and easy documentation.
- 🔐 Secure Authentication: JWT-based registration and login system.
- 💸 Expense Management: Add, view, edit, and delete your personal expenses.
- 📊 Smart Recommendations: Get summary reports of your spending by category.
- 📂 CSV Export: Download your expense history for external analysis.
- ⚡ Fast & Async: Powered by FastAPI and SQLAlchemy.
Follow these steps to get the project up and running on your local machine.
- Python 3.9+
- pip (Python package manager)
-
Clone the repository
git clone https://github.com/yourusername/expense-tracker-api.git cd expense-tracker-api -
Create a virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Configure Environment Create a
.envfile in the root directory (or use the existing one):DATABASE_URL=sqlite:///./expense_tracker.db SECRET_KEY=your-secret-key-here ACCESS_TOKEN_EXPIRE_DAYS=7
Start the development server with live reload:
uvicorn app.main:app --reloadThe API will be available at http://localhost:8000.
FastAPI provides automatic interactive documentation. Once the server is running, visit:
- Swagger UI: http://localhost:8000/docs - Test endpoints directly in your browser.
- ReDoc: http://localhost:8000/redoc - Alternative documentation view.
When adding an expense, use one of the following categories:
Food🍔Transport🚗Bills💡Shopping🛍️Healthcare🏥Entertainment🎬Others📦
expense-tracker-api/
├── app/
│ ├── routes/ # API endpoints (Auth, Expenses, Export)
│ ├── auth.py # JWT & Security logic
│ ├── database.py # Database connection (SQLite)
│ ├── main.py # App entry point
│ ├── models.py # SQLAlchemy Database Models
│ └── schemas.py # Pydantic Schemas for validation
├── .env # Environment variables
├── requirements.txt # Python dependencies
└── README.md # Project documentation
This project is open-source and available under the MIT License.
Made with ❤️ by [Abdullah Al Noman Prince]