The Expense Tracker API is designed to help users manage their personal expenses efficiently. It allows users to perform CRUD operations on their financial data, enabling them to:
- Track Transactions: Record income and expenses with details such as amount, date, and associated category.
- Organize by Categories: Classify transactions into predefined or custom categories like "Groceries," "Rent," or "Utilities."
- User Management: Securely manage user accounts, ensuring each user's financial data is private and protected.
- RESTful API with proper request validation and error handling.
- Secure data handling with UUIDs and timestamps for tracking entity creation and updates.
- Scalable architecture using Spring Boot, allowing further enhancements like analytics or reporting in the future.
This API serves as a foundational service for building financial management applications or integrating with larger systems.
-
Register User
- POST
/api/users/register
- Request Body:
{ "name": "John Doe", "email": "[email protected]", "password": "securepassword" }
- Response: User details (without password).
- POST
-
Login User
- POST
/api/users/login
- Request Body:
{ "email": "[email protected]", "password": "securepassword" }
- Response: Authentication token (JWT).
- POST
-
Get User Profile
- GET
/api/users/profile
- Headers:
Authorization: Bearer <token>
- Response: User profile details.
- GET
-
Update User Profile
- PUT
/api/users/profile
- Headers:
Authorization: Bearer <token>
- Request Body:
{ "name": "John Updated", "email": "[email protected]" }
- Response: Updated user profile.
- PUT
-
Create a Transaction
-
POST
/api/transactions
-
Headers:
Authorization: Bearer <token>
-
Request Body:
json
Copy code
{ "type": "Expense", "categoryId": 1, "amount": 150.0, "date": "2024-11-30", "description": "Groceries" }
-
Response: Created transaction.
-
-
Get All Transactions
- GET
/api/transactions
- Headers:
Authorization: Bearer <token>
- Query Parameters (optional):
type=Expense
categoryId=1
startDate=2024-11-01&endDate=2024-11-30
- Response: List of transactions.
- GET
-
Get a Single Transaction
- GET
/api/transactions/{id}
- Headers:
Authorization: Bearer <token>
- Response: Transaction details.
- GET
-
Update a Transaction
-
PUT
/api/transactions/{id}
-
Headers:
Authorization: Bearer <token>
-
Request Body:
json
Copy code
{ "type": "Expense", "categoryId": 1, "amount": 200.0, "date": "2024-11-30", "description": "Updated groceries" }
-
Response: Updated transaction.
-
-
Delete a Transaction
- DELETE
/api/transactions/{id}
- Headers:
Authorization: Bearer <token>
- Response: Success message.
- DELETE
-
Get Monthly Summary
- GET
/api/transactions/summary
- Headers:
Authorization: Bearer <token>
- Query Parameters:
month=2024-11
- Response:
{ "totalIncome": 5000.0, "totalExpenses": 3000.0, "balance": 2000.0 }
- GET
-
Create a Category
- POST
/api/categories
- Headers:
Authorization: Bearer <token>
- Request Body:
{ "name": "Food", "description": "Expenses for food and dining" }
- Response: Created category.
- POST
-
Get All Categories
- GET
/api/categories
- Headers:
Authorization: Bearer <token>
- Response: List of categories.
- GET
-
Update a Category
- PUT
/api/categories/{id}
- Headers:
Authorization: Bearer <token>
- Request Body:
{ "name": "Groceries", "description": "Updated description" }
- Response: Updated category.
- PUT
-
Delete a Category
- DELETE
/api/categories/{id}
- Headers:
Authorization: Bearer <token>
- Response: Success message.
- DELETE
-
Export Transactions
- GET
/api/transactions/export
- Headers:
Authorization: Bearer <token>
- Query Parameters: Same as "Get All Transactions".
- Response: CSV file of transactions.
- GET
-
Search Transactions
- GET
/api/transactions/search
- Headers:
Authorization: Bearer <token>
- Query Parameters:
query=groceries
- Response: List of matching transactions.
- GET