Auth app end-to-end
Session-shaped product shell: sign-in, hydrate, refresh, protected routes, and dispose. Uses every System package that belongs in an authenticated app.
- createAppShell with auth, http, query, head, theme, forms
- Provider-independent auth plus one optional adapter
- HTTP 401 refresh queue wired once, not per call site
- Sign-in / register forms with validation (auth.register, not signUp)
- Document head for auth and app chrome pages
- Delivery paths A/B/C (npm) or D1/D2 (CDN simple / modular)
Explanations
Auth owns session. HTTP owns transport and the refresh queue. Query owns server cache and must refetch after re-auth. App Shell shares one session epoch so privileged UI clears together. Forms never embed provider SDKs. Client can() helpers are UX-only; authorize on the server.
Styling
Packages ship unstyled. Style sign-in with your CSS or design tokens. Use @sometic/theme only for token/CSS variable plumbing, not as a forced look. Do not add Google Fonts CDN to publishable app packages; consumer fonts stay in the app shell.
SSR notes
Create auth, http, query, and app-shell inside request or client bootstrap scopes. Never touch window, document, or storage at import time. Prefer cookie or explicit storage adapters that work on the server path you choose. Dispose the shell when the tree unmounts.
FAQ
Which auth provider should the agent pick first?
Start with @sometic/auth-local against your REST API. Swap to auth-firebase, auth-supabase, or auth-oidc later without rewriting form UI. Keep provider SDKs out of field components.
Do I really need App Shell for a login page?
For this scaffold yes. Once you have auth + http + query together, createAppShell (or createSometicApp) keeps session epoch and dispose honest so privileged UI clears as one graph.
Where should 401 refresh live?
In @sometic/http via the auth interceptor and refresh queue. Do not sprinkle ad-hoc retries in every fetch call site.
Is client can() enough for authorization?
No. Client helpers only hide UX. Every privileged API must authorize on the server.
What happens on sign-out?
Clear the session through auth, then dispose or recreate the shell so query caches and bound stores tied to the epoch cannot leak the previous user.
Can I use Elements for the whole auth app?
Option C (Elements + DOM) works for shipped controls (fields, sometic-auth-status). For complex route shells, pick A (React) or B (Vue) when the scaffold needs structure adapters that are not yet custom elements.
How should storage work with SSR?
Pass an explicit storage strategy that is safe for your server path. Never read localStorage or cookies at import time.