/money_splitter

Split bills with friends. App based around splitwise functionality.

Primary LanguageGo

Money Splitter App

App to split money between friends and family. Based on the Splitwise app.


Table of Contents


Installation and Setup Instructions

  • Ensure go is installed on your machine
  • Next, clone this repository and cd into it
  • Copy the contents of .env.example into a new file called .env and fill in the required values

Pre-requisites

It is recommended to use docker to run the app. If you don't have docker installed, you can install it from here

Running on your machine

  1. Go
  2. Make
  3. PostgreSQL
  4. Redis

Running the app

You can use docker to run the app or run it directly on your machine.

Running with Docker

  • Run ./start.sh to start the server
  • Ensure to run chmod +x start.sh if you get a permission error
  • Ensure that the docker-compose plugin is in the same path mentioned in the start.sh file

Running on your machine

  • Run make run to start the server

API Documentation

Health Check

GET /health_check

A simple API to test out whether the server is up and running.

GET /health_check_auth

Headers:
Authorization: <token>

A simple API to test out whether you are authorized.

Authentication

Register

POST /auth/register

body: {
  name: string
  "email": string,
  "password": string
  }
}

Endpoint to register a new user. Ensures that the user with same email is not already registered and then creates a new user with a Status Accepted response.

{
  "id": string
}

Login

POST /auth/login

body: {
  "email": string,
  "password": string
}

Endpoint to login a user. Returns a JWT token which can be used to authenticate the user for other APIs.

{
  "token": string
}

Logout

POST /auth/logout

Endpoint to log user out. Deletes JWT token from redis db to invalidate token.

{
  "message": "ok"
}

Group

New Group

POST /group/newGroup

{
  "group_name": string,
  "simplify_txn": bool
}

Endpoint to create new group. Returns newly created group ID.

{
  "id": string
}

Todo

  • Add jwt redis authentication
  • Add refresh token functionality
  • Endpoints to
    • Create a group
    • Add a user to a group
    • Manage and view expenses
    • View balances