Track kids’ weekly allowance with a parent Google login, a short family URL, and automatic Sunday credits.
- Marketing homepage
- Parent login with Google
- Admin: add / edit / delete kids, set weekly allowance, add or deduct money with a memo
- Unique family page at
/f/{5-char-slug}protected by a shared password (7-day sliding cookie) - Paginated transaction history per kid
- Netlify scheduled function every Sunday adds allowance (skips if already credited in the last 6 days)
- Astro (SSR) + vanilla CSS / JS (no React)
- Netlify hosting + scheduled functions
- Netlify Database (Postgres) via
@netlify/database+ Drizzle
npm installcp .env.example .envFill in:
| Variable | Purpose |
|---|---|
SITE_URL |
App origin, e.g. http://localhost:8888 locally or https://your-site.netlify.app in production |
GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRET |
Google OAuth web client |
GOOGLE_REDIRECT_URI |
Optional; defaults to ${SITE_URL}/auth/callback |
SESSION_SECRET |
Random string, at least 32 characters, used to seal cookies |
CRON_SECRET |
Optional; Bearer token for manually invoking the weekly allowance function |
- Open Google Cloud Console and create or select a project.
- Go to APIs & Services → OAuth consent screen. Choose External (or Internal for Workspace-only). Add your email as a test user while the app is in Testing.
- Go to APIs & Services → Credentials → Create credentials → OAuth client ID.
- Application type: Web application.
- Authorized JavaScript origins
http://localhost:8888https://your-production-domain
- Authorized redirect URIs
http://localhost:8888/auth/callbackhttps://your-production-domain/auth/callback
- Copy the Client ID and Client Secret into
.env(local) and Netlify site env vars (production). - Set
SITE_URLto match the environment you are running (local vs production). If you prefer an explicit redirect, setGOOGLE_REDIRECT_URIto the same callback URL registered above.
Scopes used: openid email profile.
npx netlify database init --yes # if not already initialized for this site
npx netlify database migrations apply
npx netlify devnetlify database init installs/configures @netlify/database. Migrations live in netlify/database/migrations/ and are applied automatically on deploy; locally you apply them with migrations apply while the local DB is running (netlify dev).
npx netlify devOpen http://localhost:8888.
- Create a Netlify site linked to this repo (or
npx netlify init). - Set env vars in Site configuration → Environment variables:
SITE_URL= your production URL (no trailing slash)GOOGLE_CLIENT_ID,GOOGLE_CLIENT_SECRETSESSION_SECRET(32+ random chars)- Optional:
GOOGLE_REDIRECT_URI,CRON_SECRET
- Add the production origin and
/auth/callbackredirect URI in the Google OAuth client. - Deploy. Netlify provisions the database (with
@netlify/databasepresent) and applies migrations. - Confirm the scheduled function
weekly-allowanceis listed (cron0 12 * * 0≈ Sunday 7am America/Chicago during CDT).
curl -H "Authorization: Bearer $CRON_SECRET" \
https://your-site.netlify.app/.netlify/functions/weekly-allowance- Parent admin mutations require a sealed parent session and verify kid ownership server-side.
- Family cookie is read-only, scoped to the family slug, lasts 7 days with sliding renewal, and is invalidated when the family password changes.
- The weekly function accepts Netlify schedule invocations or
Authorization: Bearer $CRON_SECRET.
users— Google identity, family slug, password hash + versionkids— name, weekly allowance (cents)transactions— amount (cents), memo,from_allowanceflag