This repository contains the backend code for a simplified Splitwise clone. The project focuses on implementing basic expense-sharing functionalities without a frontend. Below is an overview of the project and setup instructions.
- User management
- Group creation and management
- Expense creation and tracking
- Splitting expenses between group members
- Calculating balances owed or owed-to by users
- Caching for improved performance using Redis
- Programming Language: Go (Golang)
- Web Framework: Gin
- Database: PostgreSQL
- Caching: Redis
- Dependency Management: Go modules
Make sure you have the following installed:
- Go (v1.23 or higher recommended)
- PostgreSQL
- Redis
-
Clone the repository:
git clone https://github.com/kaankulac/gin-splitwise.git cd gin-splitwise -
Install dependencies:
go mod tidy
-
Set up your configuration using the provided config/local.yaml file in the root directory. You can modify this file to include your specific settings for the database and Redis.
server: port: 8080 db: dataSourceName: postgres://postgres:123123@localhost:5432/splitwise?sslmode=disable redis: host: localhost port: 6379
-
Start the server:
go run cmd/server/main.go
The server will be running at http://localhost:8080 by default.
Here is a brief overview of the main endpoints:
POST /users/signup: RegisterPOST /users/login: LoginGET /users/profile: Get user profilePUT /users/profile: Update user profile
POST /groups: Create a new groupPUT /groups/:groupId: Update groupDELETE /groups/:groupId: Delete groupPOST /groups/members: Add a new group memberPOST /groups/:groupId/leave: Leave group
GET /expenses/:groupId: Get expenses by Group IDPOST /expenses: Create a new expense to a groupDELETE /expenses/:expenseId: Delete expensePOST /expenses/:expenseId/pay: Pay expense
- Ensure that PostgreSQL and Redis are running before starting the server.
This project is licensed under the MIT License. See the LICENSE file for details.