Lightweight, self-hosted household expense tracker. A React + Vite SPA talks to PocketBase directly; production serves the built UI from PocketBase’s pb_public folder in a single container.
- Expense entry — date, amount, optional title, category, subcategory, store, payment mode
- Dashboard & filters — this month vs last month, category breakdowns, pivot-style row/column filters
- On-the-fly create — admins can add categories, subcategories, or stores while logging an expense
- Paginated history — per-user page size preference
- Email verification + admin approval — new accounts verify email, then wait for approval before using the app
- Google sign-in — optional PocketBase OAuth; Google accounts skip email verification but still need admin approval
- Weekly digests — Monday email of last week’s spending (on by default; opt out under Me)
- Privacy first — users only see their own transactions; admins (
kind=admin) manage reference data and can see everyone’s expenses
cp .env.example .env
docker compose up --build- App: http://localhost:8090
- PocketBase Admin: http://localhost:8090/_/
Change the published port with APP_PORT in .env. Set APP_PUBLIC_URL to the public app URL so verification and digest links point at Oikos (not an internal host).
- Open PocketBase Admin and create the first superuser.
- From the host (the production image is PocketBase-only — there is no
npminside the container):
PB_URL=http://127.0.0.1:8090 npm run setup:pocketbaseThe script is idempotent. Re-run it after upgrades so collections and fields stay in sync. With APP_PUBLIC_URL set, it also points verification emails at /verify-email?token={TOKEN} and enables PocketBase email OTP templates. With GOOGLE_OAUTH_CLIENT_ID and GOOGLE_OAUTH_CLIENT_SECRET set, it enables Google sign-in on the users collection.
Promote an app user to admin:
PB_URL=http://127.0.0.1:8090 npm run make:adminThe Me page shows the image build branch (APP_BUILD_BRANCH, default local).
Outbound SMTP is often blocked. pb_hooks/zeptomail.pb.js sends PocketBase mail (verification, OTP, reset, weekly digests) through ZeptoMail’s HTTPS API when these are set:
ZEPTO_MAIL_API_KEY=your_zeptomail_api_key
ZEPTO_MAIL_FROM_ADDRESS=noreply@example.com
ZEPTO_MAIL_FROM_NAME=OikosIf the key or from-address is missing, the hook falls through to PocketBase’s configured mailer (e.next()).
PocketBase already supports Google OAuth. Create a Web application OAuth 2.0 client in Google Cloud Console:
- Authorized JavaScript origins: your app URL (local Vite:
http://localhost:5173; production:APP_PUBLIC_URL) - Authorized redirect URI:
{APP_PUBLIC_URL or PB_URL}/api/oauth2-redirect
Local PocketBase:http://127.0.0.1:8090/api/oauth2-redirect(Google treatslocalhostand127.0.0.1as different hosts)
Put the client ID and secret in .env, then re-run npm run setup:pocketbase. You can also paste them in PocketBase Admin → users → Options → OAuth2 → Google.
On the OAuth consent screen, Google asks for public policy URLs. Use:
- Privacy Policy:
{APP_PUBLIC_URL}/privacy - Terms of Service:
{APP_PUBLIC_URL}/terms
Example locally: http://localhost:8090/privacy and http://localhost:8090/terms (or the Vite origin during npm run dev).
The SPA shows Continue with Google once the provider is enabled. New Google users are created as kind=user, approved automatically, and usually verified=true (Google confirmed the email). Email/password signups still wait for admin approval.
If Google sign-in matches an existing email/password account, PocketBase links it. Password users who have not linked Google are asked once after login; they can also link later under Me.
pb_hooks/weekly-digest.pb.js emails verified, approved (or admin) users who have not opted out. Summary covers the previous Mon–Sun (UTC): total spent, count, top categories. Empty weeks still get a zero-spend email.
- Preference field:
weeklyDigestOptOut(false = send; default on) - Toggle: Me → Weekly digest
- Schedule:
0 8 * * 1(Monday 08:00 UTC), override withWEEKLY_DIGEST_CRON
- Run PocketBase (e.g.
http://127.0.0.1:8090) and create a superuser. npm install- Copy
.env.example→.env(PB_URL,VITE_PB_URL,APP_PUBLIC_URL). npm run setup:pocketbasenpm run dev— Vite at http://localhost:5173 (API viaVITE_PB_URL)
Production build: npm run build (output in dist/, copied to pb_public in the Docker image).
| Variable | Purpose |
|---|---|
APP_PORT |
Host port mapped to container 8090 (Compose) |
PB_URL |
PocketBase URL for setup / make-admin scripts |
VITE_PB_URL |
PocketBase URL baked into the Vite app (empty = same-origin in prod) |
APP_PUBLIC_URL |
Public app URL for email links |
APP_BUILD_BRANCH |
Label shown on Me / /api/app-info |
APP_VERSION |
Optional override for /api/app-info version |
ZEPTO_MAIL_* |
ZeptoMail delivery |
WEEKLY_DIGEST_CRON |
Optional cron override for digests |
WEEKLY_DIGEST_LOGO_MODE |
embed (default) or link for cron digest logo |
GOOGLE_OAUTH_CLIENT_ID |
Optional Google OAuth client ID (setup enables Google sign-in) |
GOOGLE_OAUTH_CLIENT_SECRET |
Optional Google OAuth client secret |
PB_TOKEN |
Optional PocketBase admin token for setup (instead of interactive login) |
Auth: PocketBase users (plus firstName, lastName, kind, approved, weeklyDigestOptOut, transactionPageSize).
Business: oikos_categories, oikos_subcategories, oikos_stores, oikos_payment_methods, oikos_transactions.