md
A backend API built with Django for managing personal finances, including budgets and transactions.
- Budget Management: Create, read, update, and delete budgets.
- Transaction Tracking: Record income and expenses with detailed information.
- User Authentication (Future): Secure user accounts for personalized finance tracking (planned feature).
- RESTful API: Designed with a RESTful architecture for easy integration with front-end applications.
- Python 3.8+: The project is built with Python 3.
- Django 5.0+: A high-level Python web framework.
- pip: Python package installer.
- Virtualenv (Recommended): For creating isolated Python environments.
-
Clone the repository:
git clone https://github.com/abdulrahmanx9/Finance-Tracker-API.git cd Finance-Tracker-API -
Create a virtual environment (Recommended):
python3 -m venv venv source venv/bin/activate # On Linux/macOS # venv\Scripts\activate # On Windows
-
Install dependencies:
pip install -r requirements.txt # Create requirements.txt first, see belowTo create
requirements.txt, you can usepip freeze > requirements.txtafter installing django. However, given the provided file structure, the required dependencies are only Django. To do this:pip install Django pip freeze > requirements.txt -
Apply Migrations:
python manage.py migrate
-
Run the development server:
python manage.py runserver
The API will be accessible at
http://localhost:8000/.
While detailed API documentation is under development, here's a basic example:
-
Retrieve all budgets (example):
GET /budgets/(Needs implementation inurls.pyandviews.py).Example using
curl:curl http://localhost:8000/budgets/
(Assumes a
Budgetmodel and corresponding views and URLs are defined.)
API Endpoints (To be Implemented):
| Endpoint | Method | Description |
|---|---|---|
/budgets/ |
GET | List all budgets |
/budgets/ |
POST | Create a new budget |
/budgets/{id}/ |
GET | Retrieve a specific budget by ID |
/budgets/{id}/ |
PUT | Update a specific budget |
/budgets/{id}/ |
DELETE | Delete a specific budget |
/transactions/ |
GET | List all transactions |
/transactions/ |
POST | Create a new transaction |
/transactions/{id}/ |
GET | Retrieve a specific transaction by ID |
/transactions/{id}/ |
PUT | Update a specific transaction |
/transactions/{id}/ |
DELETE | Delete a specific transaction |
Note: The API endpoints provided are a suggestion based on RESTful principles and require implementation in the Django project.
The project settings are configured in app/app/settings.py. You can modify settings such as:
SECRET_KEY: Important for security, especially in production. Change this!DEBUG: Set toTrueduring development andFalsein production.ALLOWED_HOSTS: Configure allowed hostnames for deployment.DATABASES: Configure the database connection settings. By default, it uses SQLite.
Environment Variables:
Consider using environment variables for sensitive information like SECRET_KEY and database credentials, especially for deployment. Libraries like python-dotenv can help manage environment variables.
Contributions are welcome! Please follow these guidelines:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Write clear and concise commit messages.
- Submit a pull request with a detailed description of your changes.
- Adhere to the project's coding style (e.g., PEP 8).
- Include tests for new features and bug fixes.