You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code is organized by feature in `src/features/`. Each feature is self-contained with its own components, hooks, stores, and API logic.
35
+
Code is organized by feature in `src/features/`. Features own native components, one-source hooks, and view state. They do not own copies of cloud contracts, transport, orchestration, or presentation rules.
36
36
37
37
```
38
38
src/features/
@@ -46,18 +46,31 @@ src/features/
46
46
│ ├── hooks/
47
47
│ ├── stores/
48
48
│ └── types.ts
49
-
├── conversations/ # PostHog AI conversation list & management
50
-
│ ├── api.ts
49
+
├── inbox/ # Native inbox rendering and query hooks
51
50
│ ├── components/
52
51
│ ├── hooks/
53
52
│ └── stores/
54
-
└── tasks/ # Task management
55
-
├── api.ts
53
+
└── tasks/ # Native cloud-task rendering and host adapters
56
54
├── components/
57
55
├── hooks/
56
+
├── services/
58
57
└── stores/
59
58
```
60
59
60
+
### Portability boundary
61
+
62
+
Mobile and desktop use the same cloud-task architecture. New work must preserve these ownership rules:
63
+
64
+
-`@posthog/shared` owns runtime contracts and Zod schemas.
65
+
-`@posthog/api-client` owns authenticated PostHog HTTPS transport and its request/response types.
66
+
-`@posthog/core` owns cloud-task orchestration and headless presentation decisions, including sessions, queues, permissions, models, repositories, inbox rules, and automation semantics.
67
+
-`apps/mobile` owns Expo lifecycle, React Native rendering, gestures, sheets, notifications, audio, secure storage, and small persisted view-state stores.
68
+
-`@posthog/ui` owns the DOM/Quill renderer and web view state.
69
+
70
+
Do not add a mobile API facade, duplicate a shared type, or re-export a core helper through a mobile file. Import the owning package directly. If desktop and mobile need different visuals, add a headless descriptor or decision function to core and keep two thin renderers.
71
+
72
+
Intentional host differences are limited to platform capabilities and view state. Mobile may persist native navigation state, cached picker snapshots, optimistic attachment echoes, and notification preferences; it must not implement retries, reconnection, transport parsing, task lifecycle, or cross-store decisions in those stores.
73
+
61
74
### File-Based Routing
62
75
63
76
Routes for the screens are defined by the file structure in `src/app/` using expo-router.
@@ -270,4 +283,4 @@ Defined in `eas.json`:
270
283
271
284
**Local vs Cloud builds:**
272
285
- Cloud (default): Runs on Expo's servers, no local Xcode needed
273
-
- Local (`--local`): Runs on your machine, faster iteration, requires Xcode/Android SDK
286
+
- Local (`--local`): Runs on your machine, faster iteration, requires Xcode/Android SDK
0 commit comments