Expense Tracker System will keep track of Income-Expense on a day to day basics.
- Spring Boot
- Spring Security
- Spring Data JPA
- JWT
- MySQL Database
- Hibernate
- Maven
- Spring Boot Devtools
Java 1.8 or greater, Spring boot 2.0 or greater, Maven, IntelliJ or Eclipse
Follow the step below to get the application up and running on your local machine for development and testing purpose.
- Git clone project in your local machine https://github.com/ravisahani2893/expense-tracker
- Import the project in Eclipse.
- Create database with name
expense_tracker
in MySQL Workbench. - Run the application.
- Once application is up and running.Execute below queries.
INSERT INTO roles(name) VALUES('ROLE_USER');
INSERT INTO roles(name) VALUES('ROLE_MODERATOR');
INSERT INTO roles(name) VALUES('ROLE_ADMIN');
- Access the application by url http://localhost:9001 in any web browser.
- User Registration
API : {{url}}/api/auth/signup
Request:
{
"username":"testuser",
"email":"testuser@gmail.com",
"password":"123456"
}
Response:
{
"message": "User registered successfully!"
}
- User Login
API : {{url}}/api/auth/signin
Request:
{
"username":"testuser",
"password":"123456"
}
Response:
{
"id": 3,
"username": "testuser",
"email": "testuser@gmail.com",
"roles": [
"ROLE_USER"
],
"accessToken": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0ZXN0dXNlciIsImlhdCI6MTY1Mjg4MDk4NiwiZXhwIjoxNjUyOTY3Mzg2fQ.xMy8xN9cv7YTkDJ0zPZMo_INpDMZqdKnYAhgLTLfYHB-VWtmdhqOQ1kh-5yx6P6Wwc_QyM1JA_j8zksd4o5OWw",
"tokenType": "Bearer"
}
- Create Category
API : {{url}}/api/category
Headers:
{
"Authorization":"Bearer {{token}}"
}
Request:
{
"name":"Health Care"
}
Response:
{
"id": 6,
"name": "Health Care",
"createdAt": "2022-05-18T13:38:58.527+00:00",
"updatedAt": "2022-05-18T13:38:58.527+00:00",
"active": true
}
- List Category
API : {{url}}/api/category
Headers:
{
"Authorization":"Bearer {{token}}"
}
Response:
{
"userId": 3,
"categories": [
{
"id": 6,
"name": "Health Care",
"createdAt": "2022-05-18T13:38:59.000+00:00",
"updatedAt": "2022-05-18T13:38:59.000+00:00",
"active": true
}
]
}
- Create Payment Type
API : {{url}}/api/paymenttype
Headers:
{
"Authorization":"Bearer {{token}}"
}
Request:
{
"type":"UPI"
}
Response:
{
"id": 6,
"type": "UPI",
"createdAt": "2022-05-18T13:43:28.901+00:00",
"updatedAt": "2022-05-18T13:43:28.901+00:00",
"active": true
}
- List Payment Type
API : {{url}}/api/paymenttype
Headers:
{
"Authorization":"Bearer {{token}}"
}
Response:
[
{
"id": 6,
"type": "UPI",
"createdAt": "2022-05-18T13:43:29.000+00:00",
"updatedAt": "2022-05-18T13:43:29.000+00:00",
"active": true
}
]
- Create Expense
API : {{url}}/api/expense
Headers:
{
"Authorization":"Bearer {{token}}"
}
Request:
{
"amount":100,
"expenseDescription":"Health Product",
"paymentId":6,
"categoryId":6
}
Response:
{
"id": 5,
"category": {
"id": 6,
"name": "Health Care",
"createdAt": "2022-05-18T13:38:59.000+00:00",
"updatedAt": "2022-05-18T13:38:59.000+00:00",
"active": true
},
"payment": {
"id": 6,
"type": "UPI",
"createdAt": "2022-05-18T13:43:29.000+00:00",
"updatedAt": "2022-05-18T13:43:29.000+00:00",
"active": true
},
"expenseAmount": 100,
"expenseDescription": "Health Product",
"createdAt": "2022-05-18T13:47:35.915+00:00",
"updatedAt": "2022-05-18T13:47:35.915+00:00"
}
- List User Expense
API : {{url}}/api/expense
Headers:
{
"Authorization":"Bearer {{token}}"
}
Response:
[
{
"id": 5,
"expenseAmount": 100.00,
"expenseDescription": "Health Product",
"categoryName": "Health Care",
"paymentType": "UPI",
"createdAt": "2022-05-18",
"updatedAt": "2022-05-18"
}
]
- List User Expense by Date Filter
API : {{url}}/api/expense?fromDate=2022-05-01&toDate=2022-05-20
Headers:
{
"Authorization":"Bearer {{token}}"
}
Response:
[
{
"id": 5,
"expenseAmount": 100.00,
"expenseDescription": "Health Product",
"categoryName": "Health Care",
"paymentType": "UPI",
"createdAt": "2022-05-18",
"updatedAt": "2022-05-18"
}
]
- List User Current Month Expense
API : {{url}}/api/expense/currentmonth
Headers:
{
"Authorization":"Bearer {{token}}"
}
Response:
[
{
"id": 5,
"expenseAmount": 100.00,
"expenseDescription": "Health Product",
"categoryName": "Health Care",
"paymentType": "UPI",
"createdAt": "2022-05-18",
"updatedAt": "2022-05-18"
}
]
- List User Expense By Category
API : {{url}}/api/expense/currentmonth
Headers:
{
"Authorization":"Bearer {{token}}"
}
Response:
[
{
"id": 5,
"expenseAmount": 100.00,
"expenseDescription": "Health Product",
"categoryName": "Health Care",
"paymentType": "UPI",
"createdAt": "2022-05-18",
"updatedAt": "2022-05-18"
}
]
- List User Expense By Category and Date Filter
API : {{url}}/api/expense/category/6?fromDate=2022-05-01&toDate=2022-05-20
Headers:
{
"Authorization":"Bearer {{token}}"
}
Response:
[
{
"id": 5,
"expenseAmount": 100.00,
"expenseDescription": "Health Product",
"categoryName": "Health Care",
"paymentType": "UPI",
"createdAt": "2022-05-18",
"updatedAt": "2022-05-18"
}
]
- List User Current Month Expense By Category
API : {{url}}/api/expense/currentmonth/category/6
Headers:
{
"Authorization":"Bearer {{token}}"
}
Response:
[
{
"id": 5,
"expenseAmount": 100.00,
"expenseDescription": "Health Product",
"categoryName": "Health Care",
"paymentType": "UPI",
"createdAt": "2022-05-18",
"updatedAt": "2022-05-18"
}
]