Agent DocsAppsexpo-app
Architecture
Universal surface (Mobile & Web) architecture for the Artifacts platform
Expo App Architecture
Universal surface (Mobile & Web) for the Artifacts platform, built with Expo (React Native).
Core Components
Authentication (Clerk)
- Provider: Wrapped in
ClerkProviderinsrc/app/_layout.tsx. - Storage: Uses
expo-secure-storeviatokenCachefor session persistence. - Flow: Native-friendly OAuth (Google, Apple, GitHub) via
useSSOhook. - Session: JWT used to authenticate Supabase requests.
Data Access (Supabase)
- Client: Direct connection using
createClientin components. - Auth:
Authorization: Bearer <clerk_token>header injected per request. - Policy: Relies on RLS policies in Postgres (user_id from JWT claim).
- Service: Uses shared
@chatgpt-artifacts/artifact-servicefor typed stores.
Navigation (Expo Router)
- Stack: File-based routing in
src/app/. - Protection:
<Stack.Protected>guards based onisSignedInstate. - Modals: Used for Auth flows (
(auth)/*) and Artifact details (artifact/[id]).
Rendering Strategy
- Native First: Primary artifact rendering maps Schema -> Native Components.
- Components:
vstack-> FlexboxViewmarkdown->react-native-markedline-chart->react-native-gifted-charts
- Styling:
nativewindv4 +uniwindfor Tailwind class sharing with web.
Build Variants
The app supports multiple environments via a custom variant system:
| Variant | App ID | Name | Env File |
|---|---|---|---|
| Production | com.vasiliydumanov.artifacts | Artifacts | .env.production |
| Staging | com.vasiliydumanov.artifacts-staging | Artifacts Staging | .env.staging |
Mechanism:
scripts/select-variant.jsswaps native folder symlinks (android-staging<->android).env.jsloads correct.env.<variant>.app.config.tsreadsAPP_VARIANTto configure Bundle ID and Name.