Repository for basic goods household management. Shopping lists and current storage states.
  • PHP 55.8%
  • Svelte 20.4%
  • TypeScript 18.1%
  • Shell 2.5%
  • JavaScript 1.1%
  • Other 2.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Tomáš Lipenský 1664fbe8b4
All checks were successful
CI / backend (pull_request) Successful in 1m26s
CI / commits (pull_request) Successful in 36s
CI / frontend (pull_request) Successful in 2m50s
CI / release (pull_request) Has been skipped
CI / images (pull_request) Has been skipped
CI / commits (push) Successful in 35s
CI / release (push) Successful in 38s
CI / backend (push) Successful in 1m24s
CI / frontend (push) Successful in 2m53s
CI / images (push) Successful in 1m31s
feat: redesign the stock and shopping list screens
Brings the app to the design agreed on the design canvas: a calmer green palette, Inter with
Bricolage Grotesque titles (bundled, the CSP only allows fonts from our origin), white cards and
larger touch targets.

Stock: a level bar against the minimum, "+ Na seznam" or "Na seznamu" for items running low and
a − amount + stepper for the rest, a count summary under the title.

Shopping list: the title switches between lists, a progress bar shows how much is in the basket,
one input reads the amount and unit from the text ("mléko 2 l"), the basket folds away and
"Dokončit nákup" stays pinned above the navigation.

Navigation: a raised scan button between Zásoby and Seznamy; the household switcher and an
account menu with the household settings and logging out move to the header.

Categories and expiry dates from the design are left out, they need data the app doesn't keep.
2026-11-11 19:31:50 +01:00
.forgejo feat: add household stock and shopping lists 2026-11-05 21:25:00 +01:00
.githooks Initial commit 2026-11-05 19:33:14 +00:00
backend fix: ignore trailing slashes in FRONTEND_URL 2026-11-11 18:53:02 +01:00
docker/postgres-init feat: add household stock and shopping lists 2026-11-05 21:25:00 +01:00
frontend feat: redesign the stock and shopping list screens 2026-11-11 19:31:50 +01:00
release ci: retry creating the forgejo release while the tag is recorded 2026-11-08 20:01:27 +01:00
.editorconfig Initial commit 2026-11-05 19:33:14 +00:00
.env.example Initial commit 2026-11-05 19:33:14 +00:00
.gitignore Initial commit 2026-11-05 19:33:14 +00:00
.releaserc.json Initial commit 2026-11-05 19:33:14 +00:00
ci-local.sh feat: add household stock and shopping lists 2026-11-05 21:25:00 +01:00
CLAUDE.md feat: add household stock and shopping lists 2026-11-05 21:25:00 +01:00
compose.prod.yaml feat: add household stock and shopping lists 2026-11-05 21:25:00 +01:00
compose.yaml feat: add household stock and shopping lists 2026-11-05 21:25:00 +01:00
Makefile feat: add household stock and shopping lists 2026-11-05 21:25:00 +01:00
README.md feat: scan product barcodes to stock up after shopping 2026-11-08 20:48:46 +01:00

Domácnost

Web app for managing a household's stock and shopping lists together. A household shares its stock and several shopping lists; items below their minimum are offered for buying, and finishing the shopping adds what was bought to the stock.

Part Stack
backend/ Laravel 13 (/api/v1), Sanctum bearer tokens, Scramble (OpenAPI), Pest, Larastan at max, Pint with strict_types
frontend/ Svelte 5 + SvelteKit static SPA, TypeScript, Tailwind, TanStack Query, typed openapi-fetch client, Vitest, Playwright
Infrastructure compose.yaml (development), compose.prod.yaml (Dokploy), .forgejo/ (CI/CD), release/ (semantic-release, commitlint)

How it works

  • Accounts There is no public registration: people join through an invitation. The first account comes from make user (php artisan user:create in production). Any signed-in user can found further households, and a user can belong to several.
  • Invitations An owner invites by email, or creates a link to share. An invitation works once and expires after 7 days; an emailed one can be accepted only by the invited address. Tokens are stored hashed.
  • Roles Owners rename and delete the household, invite and remove members; members manage the stock and lists and can leave. A household always keeps at least one owner.
  • Stock An item is a name, an amount, a unit and an optional minimum. The same name in another unit is another item; amounts are never converted.
  • Shopping Finishing a list adds the checked items to the stock (creating missing items) and removes them from the list; unchecked ones stay.
  • Barcodes The scanner reads product codes with the phone's camera (the browser's BarcodeDetector, or a ZXing WebAssembly polyfill served from our origin). A household teaches the app its codes: an unknown one is assigned to a stock item with its package size, and is known from then on. A known code checks the item off an open list if it waits there (finishing the list stocks it, so nothing is counted twice), and otherwise adds one package to the stock.
  • Sync Pages poll the API, an open list every 5 seconds. There is no offline mode: the app says when the connection is gone, and changes fail with a message. It installs to a phone's home screen from its web manifest.

Starting

The host needs only Docker and make:

make up
make seed      # dev@example.test / password, with a sample household

Once per clone, enable the commit message check (optional, CI checks it anyway):

docker run --rm -v "$PWD":/w -w /w -u "$(id -u)" -e HOME=/tmp node:24-alpine npm ci --prefix release
git config core.hooksPath .githooks
Service URL
App (hot reload) http://localhost:5173
API http://localhost:8000/api/v1
API docs http://localhost:8000/docs/api
Mailpit http://localhost:8025

make lists the commands. Ports can be changed in .env (see .env.example).

Architecture

Development

Everything runs in containers. The source is bind-mounted, so the frontend has hot reload and PHP picks up changes on the next request. The browser talks to the API directly, across origins: CORS allows only FRONTEND_URL.

flowchart LR
    browser(["Browser"])

    subgraph compose["compose.yaml"]
        frontend["frontend<br/>Vite dev server :5173"]
        backend["backend<br/>artisan serve :8000<br/>migrates on start"]
        worker["worker<br/>queue:listen"]
        scheduler["scheduler<br/>schedule:work"]
        db[("db<br/>PostgreSQL 18<br/>household + household_test")]
        mailpit["mailpit<br/>SMTP :1025, UI :8025"]
    end

    browser -->|"loads the app"| frontend
    browser -->|"REST + bearer token, CORS"| backend
    browser -->|"reads emails"| mailpit
    backend --> db
    worker -->|"jobs in the database"| db
    scheduler --> db
    backend -->|"password emails"| mailpit
    worker -->|"queued invitations"| mailpit

Production

One image per application; worker and scheduler run the backend image with another command. The frontend is static files, so the API must be reachable from the browser on its own domain. The API URL is not baked into the image: the container writes /config.json from API_URL when it starts, so one image works on any domain.

flowchart LR
    browser(["Browser"])
    traefik["Traefik (Dokploy)<br/>HTTPS"]

    subgraph prod["compose.prod.yaml"]
        frontend["frontend<br/>nginx: static SPA, /config.json :80"]
        backend["backend<br/>nginx + PHP-FPM :8080<br/>migrates on start"]
        worker["worker<br/>queue:work"]
        scheduler["scheduler<br/>schedule:work"]
        db[("db<br/>PostgreSQL 18")]
    end

    resend["Resend"]

    browser --> traefik
    traefik -->|"FRONTEND_URL"| frontend
    traefik -->|"APP_URL"| backend
    backend --> db
    worker --> db
    scheduler --> db
    backend -->|"password emails"| resend
    worker -->|"queued invitations"| resend

Request and types

The API is code-first: the Laravel code is the source of truth and the frontend's types are generated from it, so a changed endpoint fails the frontend's type check instead of production. Both generated files are committed, and CI fails when they are out of date.

flowchart LR
    subgraph be["backend"]
        routes["routes/api.php"]
        code["Controller<br/>FormRequest, Resource"]
        model["Eloquent model<br/>policies"]
        scramble["Scramble"]
        spec["openapi.json"]
    end

    subgraph fe["frontend"]
        schema["schema.d.ts<br/>openapi-typescript"]
        client["lib/api/client.ts<br/>openapi-fetch + token"]
        query["TanStack Query"]
        page["Svelte page"]
    end

    pg[("PostgreSQL")]

    page --> query --> client
    client -->|"HTTP /api/v1"| routes
    routes --> code --> model --> pg
    code -.->|"make types"| scramble
    scramble -.-> spec
    spec -.-> schema
    schema -.->|"compile-time types"| client

From commit to production

A push to master releases only when the Conventional Commits call for it.

flowchart TD
    dev(["git push"])

    subgraph ci["Forgejo Actions"]
        backendJob["backend<br/>Pint, Larastan, Pest"]
        frontendJob["frontend<br/>API types, lint, svelte-check, Vitest, Playwright, build"]
        commitsJob["commits<br/>commitlint"]
        release{"master and<br/>a releasable commit?"}
        tag["semantic-release<br/>tag + Forgejo release"]
        images["docker build + push<br/>version tag and latest"]
    end

    registry[("Forgejo container registry")]
    dokploy["Dokploy<br/>deploy webhook"]
    live["Production<br/>pulls images, migrates"]
    stop(["No release"])

    dev --> backendJob & frontendJob & commitsJob
    backendJob & frontendJob & commitsJob --> release
    release -->|"no"| stop
    release -->|"yes"| tag --> images
    images --> registry
    images --> dokploy
    dokploy --> live
    registry -.-> live

Everyday work

make test        # backend tests and frontend unit tests
make lint        # Pint, Prettier, ESLint, svelte-check
make analyse     # Larastan
make fix         # format the code
make types       # after changing an endpoint: openapi.json and schema.d.ts
make fresh       # recreate the development database
make ci          # all CI gates in CI's own images, run before pushing

Tests run on the household_test database. backend/tests/TestCase.php refuses any database whose name doesn't end with _test, because the tests recreate it.

Branch protection

master can't be force-pushed or deleted, not even by admins. Direct pushes stay allowed: a release already waits for the checks, so a broken commit doesn't reach production. To require a green CI before a change lands, enable the status check in the rule with the patterns CI / backend (push), CI / frontend (push) and CI / commits (push). Changes then go through a branch first.

Deployment

  1. In the project's Forgejo repository, add the secrets DOKPLOY_WEBHOOK_URL (see .forgejo/scripts/dokploy-deploy.sh) and PACKAGES_TOKEN (a token with the write:package scope). PACKAGES_TOKEN can also be set once in the user settings, for all your repositories.
  2. In Resend, verify the sending domain and create an API key.
  3. In Dokploy, create a Docker Compose service pointing at compose.prod.yaml and set the variables and domains listed at the top of that file, including MAIL_MAILER=resend, RESEND_API_KEY and MAIL_FROM_ADDRESS on the verified domain.
  4. Push to master. Commit messages decide the release: feat: is a minor version, fix: and perf: a patch, feat!: or a BREAKING CHANGE: footer a major one; docs, test, refactor, build, ci and chore release nothing.
  5. Create the first account in the backend container (Dokploy → Terminal): php artisan user:create.

Roll back by setting APP_VERSION to an older version in Dokploy and redeploying.

If a release fails after pushing its tag, no images are built, and a rerun finds no new commits since that tag. Delete the tag (git push origin :refs/tags/vX.Y.Z), then rerun the CI run or push the next commit: the release is cut again from the commits since the previous tag.