<<<<<<< HEAD
A backend API for managing expenses with full CRUD support, filtering, sorting, search, and pagination.
. ├── expenses
│ ├── controllers.py # Business logic (CRUD + filters)
│ ├── models.py # Database models (SQLAlchemy)
│ ├── router.py # API routes
│ ├── schemas.py # Pydantic validation
│ ├── utils
│ ├── db.py # Database connection
│ ├── setting.py # Configuration (env, DB URL)
│
├── main.py # FastAPI entry point
├── .gitignore
├── venv/ (ignored)
- Create expense
- Get all expenses
- Search by title
- Filter by category
- Sort by amount (asc/desc)
- Pagination support
- Proper error handling (404 if not found)
git clone cd
python -m venv venv
Activate:
Linux/Mac: source venv/bin/activate
Windows: venv\Scripts\activate
pip install -r requirements.txt
uvicorn main:app --reload
Open: http://127.0.0.1:8000
Swagger UI: http://127.0.0.1:8000/docs
POST /expenses
Request Body: { "title": "Milk", "amount": 200, "category": "food" }
GET /expenses
GET /expenses/{id}
PUT /expenses/{id}
Request Body: { "title": "Updated Milk", "amount": 250, "category": "food" }
DELETE /expenses/{id}
| Param | Type | Description |
|---|---|---|
| search | string | Search by title |
| category | string | Filter by category |
| sort | string | asc / desc by amount |
| page | int | Page number |
| limit | int | Items per page |
GET /expenses?search=milk&category=food&sort=asc&page=1&limit=5
[ { "id": 1, "title": "Milk", "amount": 200, "category": "food" } ]
- FastAPI
- SQLAlchemy
- Pydantic
- PostgreSQL
- venv/ is ignored using .gitignore
- pycache is ignored
- Use .env for secrets (never commit)
- JWT Authentication
- Docker support
- User-based expense system
- Analytics dashboard =======
FastAPI-based Expense Tracker API with CRUD operations, filtering, pagination, and SQLAlchemy ORM integration. Designed for learning backend development and API structure.