Skip to content
firegiant9000Public

About

Calendar app with recurrence on Expo + Next.js + Supabase (pnpm/Turborepo): OpenAPI-contract Edge Function API, row-level security with grant and policy tests. Friend sharing is planned, not built: schema, read policy and friend codes exist; request/accept flows and shared views do not.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

91 Commits

Folders and files

Repository files navigation

PlanPal

A calendar app with recurring events, built towards a one-way social sharing layer: share what you're busy with, at the granularity you choose, without handing over your whole calendar. The calendar works today. Sharing does not yet: the schema, a read policy and friend codes exist, but no user can see another user's events. See Status.

Demo: planpal-iota.vercel.app, the web app, which Vercel deploys from main. What is and is not finished is under Status.

ci

The month view, with a weekly standup expanded across September — one occurrence moved to Wednesday the 9th, and Friday the 11th cancelled

Expo (iOS/Android) and Next.js (web) share one TypeScript core, against a Supabase backend — Postgres with row-level security, and a Deno Edge Function API described by an OpenAPI contract.

How it works

flowchart TB
  subgraph clients["Clients"]
    M["apps/mobile<br/>Expo · expo-router"]
    W["apps/web<br/>Next 15 · App Router"]
  end

  subgraph shared["Shared packages"]
    AC["@planpal/api-client<br/>the only network boundary"]
    R["@planpal/recurrence<br/>RRULE expansion"]
    U["@planpal/ui + design-tokens"]
    T["@planpal/types<br/>generated from OpenAPI"]
  end

  subgraph backend["Supabase"]
    EF["Edge Functions (Deno)<br/>events · occurrences · export<br/>friend-code · me · healthz · notify"]
    DB[("Postgres<br/>RLS on every table")]
  end

  M --> AC
  W --> AC
  M --> U
  W --> U
  AC --> T
  M --> R
  W --> R
  AC -->|"HTTPS · JWT"| EF
  EF --> DB
Loading

No UI component talks to the network. Both apps go through @planpal/api-client, which is the single place a request is constructed — enforced by a lint rule, not by convention.

Engineering notes

Things in here I'd point at in a code review:

  • The API contract is the source of truth, and CI enforces it. openapi.yaml generates packages/types/src/generated/openapi.ts, and contract.yml regenerates it on every PR that touches the contract or the generated types, and fails on git diff --exit-code. A hand-edited type cannot survive a merge. The contract runs ahead of the code in one place: it declares the friend endpoints that are not built yet (see Status).
  • A deploy that silently did nothing fails the build. deploy-staging.yml stamps the commit SHA into the deployed functions, then requires /healthz to return 200, "status":"ok", and that exact version — because a no-op functions deploy otherwise leaves the previous build answering healthily.
  • Row-level security on every table in public, with the exceptions made explicit. All ten tables have rowsecurity on. Eight carry explicit policies; notification_sends and parse_spend_ledger are bookkeeping and deliberately have none, which denies every role that cannot bypass RLS. A test asserts that distinction both ways for the tables it covers, so adding a policy there fails the build — see grants.test.ts and core_schema.sql. The RLS story is owner-only today; the cross-user proof (friend, stranger, blocked, revoked) is roadmap milestone P2.
  • Recurrence is a real engine, not a for loop. packages/recurrence expands RRULEs with timezone handling, per-occurrence overrides, and cancellations. Its suite runs under node --test with coverage floors of 90% lines, 90% functions and 85% branches, enforced in the test command itself.
  • One design system, two renderers. @planpal/design-tokens is framework-agnostic plain values consumed by both React Native and the DOM, so a spacing change lands on both platforms at once.
  • Timezone correctness is tested against Postgres. Events store local wall-clock time plus a timezone id, with UTC derived by trigger; a fixed set of (local, zone) pairs including the DST gap and fold is checked against the database — see utc-authority.test.ts. These are hand-written cases, not generated properties; differential property tests against rrule.js are roadmap milestone P3.

Status

Honest about where this is. It's an active build, not a finished product.

Area State
Calendar — month/week views, event CRUD, recurrence Working on web, confirmed in a browser against the seeded stack. Mobile shares the same client and is green in CI, but has not been watched render on a device
Auth — email/password, session persistence Working
Auth — Google / Apple OAuth Buttons ship disabled; the PKCE exchange is unimplemented and documented in-code
API — 10 Deno Edge Functions, JWT-verified Built; linted, type-checked and exercised over HTTP by the integration suite in CI
Friend codes Get and rotate endpoints built and covered by the integration suite; no screen uses them yet
Friend connections — request, accept, decline, block Table and read-only policy done. The endpoints are declared in the OpenAPI contract but have no handler; the request/accept API (SECURITY DEFINER RPCs) and the UI are roadmap P1
Shared visibility Events store a visibility value; both event forms list sharing as unavailable. Event access is owner-only, so no other user can see a shared event until the friend view (roadmap P1) is built
AI screenshot import Backend pipeline built (upload, OCR, LLM extraction, normalisation, conflict detection, spend ledger) on a cron worker; no UI, no commit endpoint. Parked until P1 is accepted
In-app feedback API, client and form components built and tested; not yet reachable from either app's navigation
Push notifications Scheduler function built; device delivery gated on hardware testing
CI — lint, typecheck, test, build, Expo pin check, recurrence mirror, Edge Function checks, integration suite Running on every PR
Contract drift gate Separate workflow, on every PR that touches the contract or the generated types, and on every push to main
Deploy Web via Vercel's GitHub integration — production on merge, a preview per PR. Backend on merge to main, when the staging environment secrets are set; skips with a notice when they are not

The demo environment was designed around a disposable Supabase project, separate from development, with scheduled reseeding. The staging deploy workflow last deployed the backend at commit dd73911 on 2026-09-30. The web demo linked at the top is live; whether the scheduled reseeding still runs has not been re-verified.

Direction (2026-09): PlanPal is a personal calendar and a technical showcase, not a launch. The next work is sharing end to end with cross-user RLS proof, differential recurrence tests, and an ICS feed. See the 2026-09 revision at the top of docs/planning/DEVELOPMENT_PLAN.md.

Running it locally

Needs Node 22, pnpm 9, and Docker.

nvm use && corepack enable
pnpm install
cp .env.example .env      # see docs/SECRETS.md
pnpm db:start && pnpm db:reset

pnpm db:start prints the local stack's URL and anon key. The web app reads env from its own directory rather than the repo root, so put those two values in apps/web/.env.local (gitignored) before starting it:

NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321
NEXT_PUBLIC_SUPABASE_ANON_KEY=<the ANON_KEY printed above>
pnpm dev

That seeds two local accounts, alice@example.com and scott@example.com, both with password password123.

Full setup, repo layout and the migration strategy: docs/BOOTSTRAP.md.

Tests

Unit tests run per package. The integration suite in supabase/tests calls the Edge Functions over HTTP and checks the grants and row-level security policies against the local stack. CI runs all of it on every PR. More in docs/TESTING.md.

pnpm lint         # eslint across the workspace
pnpm typecheck    # tsc across the workspace
pnpm test         # unit tests
pnpm test:integration   # Edge Functions + SQL, needs the local stack up
pnpm build        # packages + web

Layout

apps/web                Next.js (App Router)
apps/mobile             Expo / React Native (expo-router)
packages/api-client     the only network boundary
packages/api-contract   OpenAPI spec — the integration contract
packages/types          shared types, generated from the contract
packages/recurrence     RRULE expansion engine
packages/calendar-core  date/grid logic shared by both apps
packages/ui             shared component contracts + theme
packages/design-tokens  design system primitives
packages/analytics      typed KPI event contracts
supabase/functions      the API — Edge Functions (Deno)
supabase/migrations     schema, RLS policies

More: architecture and runbook · environments · test strategy · metrics · planning archive

Who built it

Two people. Arlo Kharod set up the monorepo and the OpenAPI contract, and wrote most of the schema, RLS policies and their tests, the Edge Functions, the web and mobile apps, CI, and the deploy and demo pipelines. Scott Williams delivered the Month 2 milestone (the first recurrence engine, backend APIs and mobile calendar), the Month 5 screenshot-parse pipeline and feedback feature, and reviewed and merged pull requests. The planning archive in docs/planning records the intended split, month by month; git log records what actually landed.

Licence

MIT — see LICENSE.

About

Calendar app with recurrence on Expo + Next.js + Supabase (pnpm/Turborepo): OpenAPI-contract Edge Function API, row-level security with grant and policy tests. Friend sharing is planned, not built: schema, read policy and friend codes exist; request/accept flows and shared views do not.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages