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.6.0.tar.gz (975.9 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.6.0-py3-none-any.whl (181.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dinary-0.6.0.tar.gz
Algorithm Hash digest
SHA256 3daf5e1e03070c6ee3e538ace0deb5ced6bee81b51a1ab15e81df26aa7dc6707
MD5 4dba3f9ef42dcb711762f7144efb2f8e
BLAKE2b-256 13594234fbb12a582db65b0709b0bf72245ad31dac46ae5adb7c30b2a41b034d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dinary-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 181.6 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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2334e525fdd141532b108909cee7c1e6c1ba26af2bd1364b26c5fd011556463
MD5 aa354a857384a3793eb2799d241880a8
BLAKE2b-256 282be6109b0d4ef75b0b41f2e697e0fd6c0d7c541862118287eaeef3b389533f

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