MCPcopy Index your code
hub / github.com/dorianim/money-balancer

github.com/dorianim/money-balancer @v1.3.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.3.0 ↗ · + Follow
236 symbols 459 edges 67 files 3 documented · 1% updated 3y agov1.3.0 · 2023-02-02★ 1598 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

money-balancer

Have you ever been on a group trip and lost track of who paid for what and who owes money to whom? If so, money balancer is the perfect tool for you! It helps you to keep track of who paid for what and calculates your balance with all of your friends. A demo is available here but it may be reset at any time.

Screenshots

Screenshot 1 Screenshot 2

Usage

Using docker-compose:

version: "3"
services:
  money-balancer:
    image: ghcr.io/dorianim/money-balancer
    restart: unless-stopped
    ports:
      - 8000:8000
    volumes:
      - ./data:/data
    environment:
      - MONEYBALANCER_JWT_SECRET=some_super_secret_secret

Using docker:

docker run -p8000:8000 -e MONEYBALANCER_JWT_SECRET=some_super_secret_secret -v $(pwd)/data:/data ghcr.io/dorianim/money-balancer

You can then access money-balancer on http://localhost:8000. The API documentation can be found at http://localhost:8000/api/v1.

Config options

General

  • MONEYBALANCER_JWT_SECRET: a random value for the JWT signature

Authentication

Local

  • MONEYBALANCER_AUTH_LOCAL_ENABLED: enable local username/password authentication

Proxy

Proxy authentication can be used with services like Authelia and Authentik

  • MONEYBALANCER_AUTH_PROXY_ENABLED: enable proxy authentication
  • MONEYBALANCER_AUTH_PROXY_HEADERS_USERNAME: header containing the username (e.g. X-authentik-username)
  • MONEYBALANCER_AUTH_PROXY_HEADERS_NICKNAME: header containing the nickname (e.g. X-authentik-name)

If you want to use another sign on method, you may only protect the route /api/v1/auth/proxy.

For example in Authentik, you may use this as the unauthenticated paths:

^([^p]|p(p|r(p|o(p|xp)))*([^pr]|r([^op]|o([^px]|x[^py]))))*(p(p|r(p|o(p|xp)))*(r(o?|ox))?)?$

(excludes everything that contains proxy, generated with this tool)

How debts are split up:

  • amount / debtors
  • the potential rest is assigned to people who have to overpay
  • who has to overpay is determined by how often they have overpaid in the past in this specific group

Development

You need cargo and yarn installed on your system. You can build everything using

cargo build

This will create a static binary in target/debug/money-balancer which you can run.

Extension points exported contracts — how you extend this code

UserToFullUser (Interface)
(no doc) [1 implementers]
src/routes/user.rs
ExpandMoreProps (Interface)
(no doc)
client/src/components/ExpandMoreButton.tsx
StoredContext (Interface)
(no doc)
client/src/utils/ContextWrapper.tsx
ReducedContextType (Interface)
(no doc)
client/src/data/MoneyBalancerApi.tsx
ErrorData (Interface)
(no doc)
client/src/data/Context.tsx
ContextType (Interface)
(no doc)
client/src/data/Context.tsx

Core symbols most depended-on inside this repo

_error
called by 12
client/src/data/MoneyBalancerApi.tsx
loggedIn
called by 10
client/src/data/MoneyBalancerApi.tsx
clone
called by 10
src/services/group.rs
register
called by 8
client/src/serviceWorkerRegistration.ts
_authorizedFetch
called by 8
client/src/data/MoneyBalancerApi.tsx
to
called by 6
src/model/user.rs
_fetch
called by 5
client/src/data/MoneyBalancerApi.tsx
routes
called by 5
src/routes/auth.rs

Shape

Method 86
Function 81
Class 44
Enum 13
Interface 12

Languages

Rust67%
TypeScript33%

Modules by API surface

src/services/group.rs30 symbols
client/src/data/MoneyBalancerApi.tsx24 symbols
src/routes/user.rs13 symbols
src/services/authentication.rs12 symbols
src/routes/group.rs12 symbols
src/routes/auth.rs10 symbols
src/services/configuration.rs9 symbols
src/services/user.rs8 symbols
src/routes/client.rs6 symbols
client/src/data/Types.tsx6 symbols
src/main.rs5 symbols
migration/src/m20220912_000003_create_group_member_table.rs5 symbols

For agents

$ claude mcp add money-balancer \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact