https://github.com/ashishbhoi/expense-tracker-postgres
https://github.com/ashishbhoi/expense-tracker-postgres
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ashishbhoi/expense-tracker-postgres
- Owner: ashishbhoi
- Created: 2023-07-10T16:45:23.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-18T04:40:31.000Z (almost 2 years ago)
- Last Synced: 2025-01-22T16:48:12.899Z (4 months ago)
- Language: Java
- Size: 163 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# This is a REST Api Build with Spring Boot using JPA and Lombok
## Features
- User can register and login `POST /api/users/register` `POST /api/users/login`
- User can create, update and delete categories `POST, PUT, DELETE /api/categories`
- User can create, update and delete transactions `POST, PUT, DELETE /api/categories/{category-id}/transactions`
- User can view all categories with total expense `GET /api/categories`
- User can view all transactions `GET /api/categories/{category-id}/transactions`## Security
- JWT is used for authentication and authorization
- User can only access his own data
- User can only access his own categories and transactions
- You can generate a new token using `POST /api/users/login` and use the token in the `Authorization` header with the
value `Bearer ` to access the protected routes.## Protected Routes
- `POST, PUT, DELETE /api/categories/**`
- So you need to use JWT to access these routes.
- To get JWT you refer to the [Security](#security) section.# How to run the application
1. Clone the repository
```bash
git clone https://github.com/ashishbhoi/expense-tracker.git
```2. Set Environment variable
```bash
export JDBC_URL="jdbc:postgresql://:/"
export API_SECRET_KEY=""
export JDBC_USER=""
export JDBC_PASS=""
```
> api secret key can be any string of your choice.> To user other database you need to modify the `build.gradle` file and add the dependency for the database driver.
> Then you just need to change the `JDBC_URL` to your database url and `JDBC_USER` and `JDBC_PASS` to your database
username and password.3. Run the application
```bash
gradle bootRun
```
if you don't have gradle installed, you can use the `gradlew` file in the root directory.
```bash
./gradlew bootRun
```