mirror of
https://github.com/hanzo-apps/digital-dropstore.git
synced 2026-10-30 19:23:37 +00:00
Vite + React 19 + @hanzo/gui + @hanzo/iam + @hanzo/base. Fork of hanzo-starter: identical provider stack, vite.config, PKCE auth, and Base deploy contract. Three views (drop landing, product detail, my library), hype dark-first UI in @hanzo/gui longhand props, drops+claims schema.sql (org-scoped, IAM-native).
4.2 KiB
4.2 KiB
digital-dropstore — agent notes
A real Hanzo-stack app: a hype digital dropstore. List digital drops (packs,
presets, LUTs, files), open a drop's detail, claim it (purchase stub), and see
your library. Forked from the canonical hanzo-starter.
Vite + React 19 + @hanzo/gui (UI) + @hanzo/iam (auth) + @hanzo/base (data).
Keep it minimal and REAL — every surface builds and runs, no fabricated UI.
One way, decomplected
- Providers (
src/providers.tsx) mount in the canonical order every Hanzo surface ships:GuiProvider→IamProvider→BaseProvider.BaseProvidergets aBaseClientcarrying the IAM access token; it is rebuilt when the token changes (src/lib/base.tsbaseAs). That single seam is what makes everyuseQuery/useMutationorg-scoped to the signed-in user. - Env is one place (
src/env.ts), read fromimport.meta.env.VITE_*. Auth readsVITE_HANZO_CLIENT_ID(fallbackhanzo-app). - The look is one place (
src/ui.ts) — the hype-drop palette (near-black canvas, acid-lime primary, coral/cyan accents) + helpers. UI atoms are one place (src/parts.tsx):Poster,Chip,PriceTag,Eyebrow,Btn. - UI is one system —
@hanzo/guiprimitives only (no second kit, no Tailwind). Views:signed-out(landing),home(shell + nav),drops(grid + composer),detail(claim stub),library(owned drops).
Gotchas (do not regress)
@hanzo/guiunder Vite needs three things invite.config.ts(it is the Tamagui line; the in-browser builder runtime can't do this, which is the whole reason this ships as a real repo): (1) aliasreact-native→react-native-web, (2)defineprocess.env.TAMAGUI_TARGET/NODE_ENV/__DEV__, (3)dedupereact/react-dom/react-native-web. No Tamagui compiler, noone, no Expo — the optimizer is a perf pass, not a correctness one.@hanzo/guiprops are Tamagui LONGHAND with this v5 config:alignItems/justifyContent/backgroundColor/padding/alignSelf/borderRadius/textAlign— NOT theitems/justify/bg/p/self/rounded/textshorthands. Shorthands pass at runtime but FAILtsc.Buttontakes stack styles only — nocolorprop and nocolorinhoverStyle/pressStyle. Text color/weight live onButton.Text. That is exactly whatBtninsrc/parts.tsxwraps — route every colored button through it (flatbg/fg/borderprops).Input.placeholderTextColorwants aColorTokens, not a hex string. Omit it (the themed default is fine) rather than pass a raw hex.- PKCE storage is
localStorage(not sessionStorage) so the verifier/state survive the round-trip to hanzo.id. schema.sqlis the data contract. It is thedatabaseSchemaDDL the deploy translates into Base collections (provisionBaseFromDDL). Keep it in lockstep withsrc/data.tsand the views:drops(name,price,file,desc)andclaims(drop,user).
Data model
drops— a listed digital drop. Written by the composer indrops.tsx, read bydrops/detail/library. Org-scoped: your whole org sees the lineup.claims— one row per claim,{ drop: Drop.id, user: <IAM user key> }. Written bydetail.tsx(the claim stub), read bylibrary.tsxfiltered to the caller.me = user.id || user.name || user.email.
Deploy contract (Hanzo Cloud)
- Static SPA:
npm run build→dist/, served at<slug>.hanzo.appfrom object storage. No server process. - On publish,
schema.sql→provisionBaseFromDDLcreates the collections (org-scoped, IAM-native). Runtime read/write is browser →VITE_HANZO_BASE_URLwith the IAM token. - IAM redirect registration is the one external requirement: the IAM client
(
VITE_HANZO_CLIENT_ID, defaulthanzo-app) must allow this origin's/auth/callback(ahttps://*.hanzo.app/auth/callbackwildcard, or a per-apphanzo-<app>client).
Proven
tsc --noEmit clean · vite build → dist/ · login() performs a real PKCE
S256 redirect to https://hanzo.id. CI (.github/workflows/ci.yml) runs
npm ci && npm run typecheck && npm run build — build-verification only, NEVER a
container image (Hanzo Cloud owns deploys; do not build images locally).