This project is an expense management system that consists of a Streamlit frontend application, SQL for database and a FastAPI backend server.
This application allows users to manage their daily expenses, view analytics, and interact with a database for storing and retrieving expense data.
- Add or update daily expenses with details like amount, category, and notes.
- Analyze expenses over a date range with visualizations.
- Store expense data in a MySQL database.
- Backend powered by FastAPI for handling requests.
- Frontend built with Streamlit for a user-friendly experience.
- Secure authentication and user management.
- Export expenses as CSV or Excel for record-keeping.
- Backend: FastAPI, Uvicorn
- Frontend: Streamlit
- Database: MySQL
- Other Libraries: Pydantic, Requests
- frontend/: Contains the Streamlit application code.
- backend/: Contains the FastAPI and SQL backend server code.
- tests/: Contains the test cases for both frontend and backend.
- requirements.txt: Lists the required Python packages.
- README.md: Provides an overview and instructions for the project.
- Clone the repository:
git clone https://github.com/mehulcode12/codebasics_expense_tracking_with_sqlServer_FastAPI_Logging_Streamlit_pyDantic.git cd expense-management-system
- Install dependencies:
pip install -r requirements.txt
- Run the SQL server:
Use SQL WorkBench and import the sql file from root directory. make sure you provide proper host and password(as per your system)
- Run the FastAPI server:
uvicorn backend.server:app --reload
- Run the Streamlit app:
(note: use second terminal/cmd to execute this)
streamlit run frontend/app.py
- GET /expenses/{expense_date}: Fetch expenses for a specific date.
- PUT /expenses/{expense_date}: Update expenses for a specific date.
- POST /analytics/: Fetch expense summary for a date range.
- POST /export/: Export expense data as CSV or Excel.
Expense_Tracking/
├── backend/ # Backend folder containing FastAPI server code
│ ├── server.py # FastAPI server entry point
│ ├── server.log # log file
│ ├── db_helper.py # Database helper functions for CRUD operations
│ ├── logging_setup.py # Logging configuration for the backend
│ └── tests/ # Backend test cases
│ ├── test_server.py # Tests for the FastAPI server
│ └── test_db_helper.py # Tests for database helper functions
│
├── frontend/ # Frontend folder containing Streamlit app code
│ ├── app.py # Streamlit app entry point
│ ├── add_update_tab.py # Code for the "Add/Update Expense" tab
│ ├── analytics_category.py # Code for the "View Analytics by Category" tab
│ ├── analytics_month.py # Code for the "View Analytics by Month" tab
│ ├── debugging.py # Code made for debugging and integratoin purpose
│
├── database/ # Folder for database-related scripts and configurations
│ ├── init_db.sql # SQL script to initialize the database and create tables
│ ├── db_config.py # Database connection configuration
│ └── migrations/ # Folder for database migration scripts
│ ├── 001_create_expenses_table.sql
│ └── 002_add_indexes.sql
│
├── tests/ # Root-level folder for integration tests
│ ├── __init__.py # Marks the folder as a Python package
│ └── backend/ # Folder for database migration scripts
│ ├── test_db_helper.sql # Tests database helper functions for fetching and summarizing expense data.
│
│
├── requirements.txt # Python dependencies for the project
├── README.md # Project documentation
To better understand how the application works, here are some screenshots and recordings:
- Screenshots:
- Screen Recording:
- CLick here
Upload your screenshots and recordings to a publicly accessible location and update this section with the links.
This project is licensed under the MIT License - see file for details.
Contributions are welcome!
Need of Contributor:
- Secure authentication and user management.
- Export expenses as CSV or Excel for record-keeping.
Please follow these steps:
- Fork the repository.
- Create a new branch (
feature-branch
). - Commit your changes with clear messages.
- Push the branch and create a Pull Request.
For major changes, open an issue first to discuss proposed modifications.
For any questions or support, reach out to:
- Email: [email protected]
- GitHub Issues: Issue Tracker
This project was inspired by the Codebasics DSAI Bootcamp. It is not entirely my original work but has been extended and customized for additional functionality.