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.7.0.tar.gz (976.6 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.7.0-py3-none-any.whl (184.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dinary-0.7.0.tar.gz
Algorithm Hash digest
SHA256 69133b3a5f3c76f220c5a85be1659dade13c4fa8af5d9ac4be390ccc3c8546e4
MD5 e7aca634e404500f2f0df57d97c506c7
BLAKE2b-256 7f28a0faab5cfe9b7aafe37d8e533f15983f0bd93bca375a04656a0baa1ef6d8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dinary-0.7.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.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d942c71314fc53bbf57689a8d4285c64fc422c6a3e4177e3c3404daf688c1ca7
MD5 cf1b4d5c4a9d5a101847549e9f80d5e4
BLAKE2b-256 0d892471743f33f1aebbbec7164419b9653d00aaabb2cad7b07e27729d921e14

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