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

Uploaded Python 3

File details

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

File metadata

  • Download URL: dinary-0.8.1.tar.gz
  • Upload date:
  • Size: 982.5 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.1.tar.gz
Algorithm Hash digest
SHA256 ed7cc8b2b5ad026c37b6dbc50d072c57fc7f3d5c6410662935ca0055a15b46d0
MD5 598451b7f5adff1d84c010815fad7e29
BLAKE2b-256 24a4ddd0073c5e17e649d2bb74ce1583d10a827594eefc5fb270abaf0deb2197

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dinary-0.8.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5c1b60e00404b17a2052110be4442dc28c483cf81e6a142731d8e89c51590dd8
MD5 e974b99dabaed49803981e1ec42bf64e
BLAKE2b-256 95004e4776ad2b49dac0b4bae36ed49c2dc80818a4f3c7fd3860043eeace3a53

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