Skip to content

f0rthsp4ce/refinance

Repository files navigation

refinance

logo

refined financial system for a hackerspace. simple by design.

architecture

entity

anything that can send or receive money: human, donate-box, rent, utility.

transaction

move X from A to B. supports all currencies.

  • non-confirmed
  • confirmed

balance

sum of all transactions. both confirmed and not. separated.

tags

mark entities and transactions for quick search.

security

  • X-Token header is used for authentication.
  • you may request a new token any time: POST /tokens/send with name, id or telegram_id of your entity — anything you remember.
  • token (link) will be sent to telegram_id of the entity. newly generated tokens do NOT revoke old ones.

token — jwt string with entity id & timestamp inside. basically base64(sign(json(id=123, date=now()))).

run

production

put secrets into secrets.env. see secrets.env.example as a reference.

docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d

API: http://0.0.0.0:8000/docs UI: http://0.0.0.0:9000

development

run backend & frontend with live code reload:

docker compose -f docker-compose.yml -f docker-compose.dev.yml up

open http://localhost:8000/docs and http://localhost:9000

create local environment with all dependencies:

pipenv install --dev
  • open any .py file in vscode
  • choose newly created env as python interpreter (bottom right button)
  • now vscode intellisense will work correctly for all packages

if you need to change the Pipfile:

pipenv requirements --exclude-markers --dev > requirements.txt
cp requirements.txt ui
cp requirements.txt api

to run api tests:

pipenv shell
cd api
pytest

todo

  • base classes
  • errors
  • unit tests
  • complex search
  • pagination
  • tags
  • transactions
  • balances
  • balance cache
  • date range search
  • recurrent payments
  • donation categories
  • migrations (not alembic?)
  • logging
  • docker
  • grafana, statistics
  • authentication?
  • permissions?
  • pytest ci

tests notice

tests are mostly autogenerated by llm, given the route and schema. human review would be beneficial.

license

MIT