A FastAPI-based backend service for managing expenses and tracking costs among friends.
- Expense Management: Create, view, and delete expenses
- Friend Management: Manage a list of friends who share expenses
- Monthly Summaries: Generate monthly expense reports with settlement calculations
- Balance Tracking: Calculate who owes what to whom
- Python 3.8+
- pip
-
Clone the repository
-
Install dependencies:
pip install -r requirements.txt
-
Start the server:
python -m app.main
Or use the provided script:
./start.sh
The API will be available at http://localhost:8000
Build and run with Docker:
docker build -t cost-tracker-api .
docker run -p 8000:8000 cost-tracker-apiOnce running, visit:
- Interactive API docs:
http://localhost:8000/docs - ReDoc documentation:
http://localhost:8000/redoc
expense-tracker-backend/
├── app/
│ ├── api/routes/ # API endpoint definitions
│ ├── core/ # Core configuration and storage
│ ├── models/ # Pydantic data models
│ ├── services/ # Business logic layer
│ └── main.py # FastAPI application setup
├── data/ # Data storage (JSON files)
├── tests/ # Test files
└── requirements.txt # Python dependencies
POST /expenses- Create a new expenseGET /expenses- Get all expensesDELETE /expenses/{id}- Delete an expense
GET /friends- Get list of friends
GET /summary/{year}/{month}- Get monthly expense summary
Edit app/core/config.py to configure:
- Friends list
- CORS origins
- Storage settings
python -m pytest tests/pip install -r requirements-dev.txtThe application uses JSON file storage in the data/ directory. Expenses are automatically saved and loaded on startup.