Skip to main content

Server for [Dinary - your dinar diary](https://github.com/andgineer/dinary). Track expenses, scan receipts, analyze spending with AI

Project description

Build Status Coverage

Dinary

Track expenses, scan receipts, analyze spending with AI

Documentation

Dinary

Local development

The PWA is a Vue 3 + Pinia app under webapp/, built with Vite into _static/ (gitignored). FastAPI serves the built assets from the same origin as the API, so on http://127.0.0.1:8000 you see the same PWA the production VM serves.

Install uv and Node.js 22+, then:

uv sync

# One-time: copy .deploy/.env from the template (.deploy/ is gitignored).
cp -r .deploy.example .deploy

# Build the Vue PWA into _static/ (gitignored). Run this:
#   * the very first time,
#   * after pulling commits that touch webapp/,
#   * after editing anything under webapp/ yourself.
# ``--skip-install`` skips ``npm ci`` (use after the first full build for
# faster iteration). The full build runs ``npm ci`` + ``vite build`` and
# writes data/.deployed_version + _static/version.json.
uv run inv build-static                 # full build (npm ci + vite build)
uv run inv build-static --skip-install  # faster: skips npm ci

# Run the FastAPI server. Same migration path as prod ``systemctl restart``:
#   * starts uvicorn on http://127.0.0.1:8000 with auto-reload,
#   * the FastAPI lifespan calls ``ledger_repo.init_db()`` which runs
#     yoyo migrations against the existing data/dinary.db (or creates
#     a fresh schema if no DB is there yet).
# As a safety net, ``inv dev`` will also run ``inv build-static`` itself
# if _static/index.html is missing — but always run the build explicitly
# whenever you change webapp/ so the served PWA matches your source.
uv run inv dev

To exercise migrations against a realistic dataset, replace data/dinary.db with a fresh prod snapshot before starting:

uv run inv restore-primary
uv run inv dev

Pass --reset only when you want a clean slate — it wipes data/dinary.db (plus its WAL/SHM sidecars), creates the schema from scratch, and re-seeds the hardcoded 3D taxonomy (groups / categories / events / tags). Use it for first-time bootstrap or after changing seed_config.py. It is not the right way to test that migrations apply cleanly to existing data:

uv run inv dev --reset

After editing anything under webapp/, rebuild _static/:

uv run inv build-static                # full rebuild (npm ci + vite build)
uv run inv build-static --skip-install # faster local rebuild after first run

While iterating on Vue/JS, you can run the Vite dev server with HMR (it proxies /api calls to FastAPI on port 8000):

npm --prefix webapp run dev   # http://127.0.0.1:5173

Note: vite dev does not register a service worker, so offline and PWA behavior must be tested against a real _static/ build (run uv run inv build-static, then hit FastAPI on port 8000).

inv dev disables Google-Sheets logging by default so test expenses you create while debugging don't leak into the prod logging spreadsheet (the env var from .deploy/.env is overridden just for this process). Pass --sheet-logging if you specifically want to exercise the drain loop end-to-end.

To point local dev at a copy of prod data instead of an empty DB:

uv run inv backup                         # snapshot prod into ~/Library/dinary/<ts>/
cp ~/Library/dinary/<ts>/data/dinary.db data/
uv run inv dev                            # NOT --reset; keep the snapshot

Credentials are read from ~/.config/gspread/service_account.json (standard gspread location). Don't have a service account key yet? See Google Sheets Setup.

Run tests

inv test

Pre-commit hooks

Use pre-commit for code quality:

pre-commit install

Scripts

Install invoke preferably with uv tool:

uv tool install invoke

For a list of available scripts run:

invoke --list

Deploy to Oracle Cloud

Configure .deploy/.env (see .deploy.example/.env), then:

inv setup-server    # one-time: install deps, clone, create systemd services, upload creds
inv deploy          # pull latest code and restart
inv status --remote # check service status
inv logs --remote   # tail server logs

See Oracle Cloud deployment guide for details.

Reports

Created with cookiecutter using template

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dinary-0.8.0.tar.gz (982.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dinary-0.8.0-py3-none-any.whl (184.1 kB view details)

Uploaded Python 3

File details

Details for the file dinary-0.8.0.tar.gz.

File metadata

  • Download URL: dinary-0.8.0.tar.gz
  • Upload date:
  • Size: 982.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dinary-0.8.0.tar.gz
Algorithm Hash digest
SHA256 8d6c0ab20e02eb3523e9a96e7be56948d3e4044e55953055dfe744a162d531e8
MD5 f47133c28e8dbd7d1f6bcde4f1ae68ce
BLAKE2b-256 aab5ee004fbca5707642028693e464c8d71318fac55d22bcb7f521769c8ee515

See more details on using hashes here.

File details

Details for the file dinary-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: dinary-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 184.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dinary-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb3e24cb74dca59b87807dc296612396b529e224ad03b52c998ff3cb591d2d36
MD5 965e4c9457cab153f36982ce341c00db
BLAKE2b-256 d98e5f01fbd27b339a86d408cf94c55e81286ce7b1a33fdfea1a2021ab08733b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page