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
Copy file name to clipboardExpand all lines: src/CLAUDE.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,8 @@ CoCalc is organized as a monorepo with key packages:
73
73
-**TypeScript React Components**: All frontend code is TypeScript with proper typing
74
74
-**Modular Store System**: Each feature has its own store/actions (AccountStore, BillingStore, etc.)
75
75
-**WebSocket Communication**: Real-time communication with backend via WebSocket messages
76
+
-**Authentication Waiting**: When frontend code needs to wait for user authentication, use `redux.getStore("account").async_wait({ until: () => store.get_account_id() != null, timeout: 0 })` to wait indefinitely until authentication completes
77
+
-**Conat DKV Usage**: For key-value storage with real-time sync, use `webapp_client.conat_client.dkv({ account_id, name: "store-name" })` to get a distributed key-value store that syncs across sessions
76
78
77
79
#### Backend Architecture
78
80
@@ -81,6 +83,8 @@ CoCalc is organized as a monorepo with key packages:
81
83
-**Conat System**: Container orchestration for compute servers
82
84
-**Event-Driven Architecture**: Extensive use of EventEmitter patterns
83
85
-**Microservice-like Packages**: Each package handles specific functionality
86
+
-**Database Access**: Use `getPool()` from `@cocalc/database/pool` for direct database queries in hub/backend code. Example: `const pool = getPool(); const { rows } = await pool.query('SELECT * FROM table WHERE id = $1', [id]);`
87
+
-**Hub Migration Functions**: Migration functions in hub should be designed to run once at startup, use batch processing with delays between batches to avoid database saturation
0 commit comments