https://github.com/kweeuhree/personal-budgeting-backend
A GO backend for a personal budgeting app
https://github.com/kweeuhree/personal-budgeting-backend
aiven go mysql onrender-deploy
Last synced: over 1 year ago
JSON representation
A GO backend for a personal budgeting app
- Host: GitHub
- URL: https://github.com/kweeuhree/personal-budgeting-backend
- Owner: kweeuhree
- Created: 2024-11-14T19:05:16.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-06T16:33:15.000Z (over 1 year ago)
- Last Synced: 2025-02-06T17:25:47.696Z (over 1 year ago)
- Topics: aiven, go, mysql, onrender-deploy
- Language: Go
- Homepage: https://personal-budgeting-backend.onrender.com/
- Size: 31.4 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# 🏦 Personal Budgeting App
This repository contains a budget tracker that allows a user to create a budget and add categorized expenses.
## 🪧 Overview
The Personal Budgeting App is a RESTful API service that processes budget and expense data, updating the budget accordingly.
The application is deployed on Render and may take up to 50 seconds to resume operation after periods of inactivity. It uses MySQL as its storage solution, hosted through the Aiven service.
#### Third-Party Packages
- The `scs/mysqlstore` package is used for session storage in MySQL.
- The `scs/v2` package is used for session management and handling.
- The `mysql` package is used interfacing with MySQL databases.
- The `httprouter` package is used for fast and efficient routing.
- The `alice` package is used for clear and readable middleware chaining.
- The `uuid` package is used to generate unique ids.
- The `nosurf` package is used for CSRF protection middleware.
- The `crypto` package is used for password hashing and verification.
## 🔍 Prerequisites
- Go 1.22.5
- Windows, macOS, or Linux operating system
## ▶️ Usage
The application can be interacted with through the deployed [React application](https://personal-budgeting.onrender.com/).
## 💡API Specification
See a [Redocly page](https://kweeuhree.github.io/personal-budgeting-backend/) for an interactive overview.
### Endpoint: CSRF Token
- Path: `/api/csrf-token`
- Method: `GET`
- Response: JSON containing a CSRF token.
Description:
Returns a JSON object with a CSRF token generated by the server.
Example Response:
```json
{
"csrf_token": "7cpnevxmIFjaS0yr6msraJistWmqySe/6JPE2ELapCtRyJ+Eg/iZ75ErPoRecEADW5q6jYMzMZjx83RKz+tFIg=="
}
```
### Endpoint: User Signup
- Path: `/api/users/signup`
- Method: `POST`
- Payload: JSON with user credentials.
- Response: JSON containing user id, user email and a flash message.
Description:
Takes in a JSON with user credentials and returns a JSON object with a uuid-generated userId, registered user email, and a flash message.
Example Response:
```json
{
"userId": "7fb1377b-b223-49d9-a31a-5a02701dd310",
"email": "hello@world.dev",
"flash": "Your signup was successful. Please log in."
}
```
### Endpoint: User Login
- Path: `/api/users/login`
- Method: `POST`
- Payload: JSON with user credentials.
- Response: JSON containing user details and a flash message.
Description:
Takes in a JSON with user credentials and returns a JSON object with the userId, user email, user name, user budget(if exists) and a flash message.
Example Response:
```json
{
"userId": "7fb1377b-b223-49d9-a31a-5a02701dd310",
"email": "hello@world.dev",
"displayName": "Go Dev",
"budget": {
{
"budgetId": "5fb1355b-l113-49d9-h57s-0a11301dh57s",
"checkingBalance": "1000",
"savingsBalance": "5000",
"budgetTotal": "6000",
"budgetRemaining": "6000",
"totalSpent": "2000"
}
},
"flash": "Login successful!"
}
```