Skip to content

feat: Phived Pro — authenticated, synced, encrypted tier#103

Open
LukeberryPi wants to merge 3 commits into
mainfrom
feat/opus-medium-authentication-sync-encrypt
Open

feat: Phived Pro — authenticated, synced, encrypted tier#103
LukeberryPi wants to merge 3 commits into
mainfrom
feat/opus-medium-authentication-sync-encrypt

Conversation

@LukeberryPi

Copy link
Copy Markdown
Owner

Summary

Adds Phived Pro, an authenticated, cross-device tier (Google login, Polar subscriptions, tasks encrypted at rest in Postgres) alongside the unchanged free local-only experience. Both tiers stay local-first so Pro feels just as instant.

  • apps/api (Bun + Hono) — the single-origin Railway entrypoint. Ports the site-contract static/security rules into middleware (security headers, /sw.js no-cache, /app SPA fallback, 405-on-writes scoped to non-/api) and mounts /api/*.
  • Auth & billing — Better Auth (Kysely/Postgres adapter, Google, one HttpOnly SameSite=Lax session cookie, built-in rate limiting) + @polar-sh/better-auth (hosted checkout + portal + signed webhooks). Generous, idempotent entitlement mirror with post-checkout confirm and lazy self-heal.
  • Encrypted task syncGET/PUT /api/tasks behind requireActiveEntitlement; AES-256-GCM single master key + key_version; version counter (409 on stale baseVersion); server merge = union history by id + LWW canvas; ~1MB cap (413). Committed Kysely migrations run migrate-then-boot.
  • Client (apps/app)AuthProvider + useTaskSync: instant local writes stay the source of truth; debounced push + keepalive flush on hide; pull on load/focus/online; 409 reconcile; multi-tab coherence; backups before overwrite. Free/Pro/LocalOnly mode machine with degrade-not-destroy banners, adoption-on-upgrade, and a minimal header account slot.
  • Web — dedicated /pricing page (Free vs Pro, monthly/annual) + index upsell band; analytics made cookieless ("no tracking cookies"); CSP form-action extended for Google/Polar redirects.
  • The server boots static-only when unconfigured, so Pro is purely additive. See docs/adr/0004-phived-pro-auth-sync.md.

Test plan

  • bun run check (format, lint, typecheck, app/api/scripts tests, full site build) — green
  • Ported site-contract routing/security tests carried forward against the Hono port
  • Unit tests: merge (union/LWW), entitlement gate, adoption branch, crypto round-trip
  • Smoke-tested API serving the real built dist/ (root, /app fallback, /sw.js cache-control, /pricing, CSP)
  • Configure Railway env/secrets + Postgres plugin and verify live Google/Polar flows end-to-end

Made with Cursor

LukeberryPi and others added 3 commits June 17, 2026 17:35
Add the glossary terms for the upcoming paid tier (api, free, pro, User,
Customer, Subscription, entitlement, LocalOnly, sync, task document,
adoption) to CONTEXT.md, and record ADR 0004 capturing the same-origin
API, entitlement-vs-auth split, single encrypted task document, and
local-first sync trade-offs.

Co-authored-by: Cursor <cursoragent@cursor.com>
…t/codex-medium-authentication-sync-encrypt
Add apps/api (Bun + Hono) as the single-origin Railway entrypoint: ports the
site-contract static/security rules into middleware and mounts /api/* for
Better Auth (Google), Polar subscriptions, and an AES-256-GCM encrypted task
document synced via optimistic-concurrency PUT (union history, LWW canvas).

On the client, add AuthProvider + useTaskSync to apps/app: local-first writes
stay instant while Pro mirrors tasks in the background, with a Free/Pro/
LocalOnly mode machine, adoption-on-upgrade, degrade-not-destroy banners, and a
minimal header account slot. Add a /pricing page + upsell band, make analytics
cookieless ("no tracking cookies"), and switch Railway to migrate-then-boot.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
phived Error Error Jun 18, 2026 1:23pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant