@@ -16,24 +16,50 @@ This is a Monorepo managed by PNPM workspaces and organized as follows:
1616```
1717objectos/
1818├── packages/
19- │ ├── kernel/ # @objectos/kernel - Core runtime engine
20- │ ├── server/ # @objectos/server - NestJS HTTP server
21- │ └── presets/ # @objectos/preset-* - Standard metadata
19+ │ ├── agent/ # @objectos/agent - AI Agent Framework
20+ │ ├── analytics/ # @objectos/analytics - Analytics Engine
21+ │ ├── audit/ # @objectos/audit - Audit Logging
22+ │ ├── auth/ # @objectos/auth - Authentication (BetterAuth)
23+ │ ├── automation/ # @objectos/automation - Triggers & Rules
24+ │ ├── browser/ # @objectos/browser - Offline Runtime (SQLite WASM)
25+ │ ├── cache/ # @objectos/cache - LRU + Redis Cache
26+ │ ├── federation/ # @objectos/federation - Module Federation
27+ │ ├── graphql/ # @objectos/graphql - GraphQL API
28+ │ ├── i18n/ # @objectos/i18n - Localization
29+ │ ├── jobs/ # @objectos/jobs - Background Jobs & Cron
30+ │ ├── marketplace/ # @objectos/marketplace - Plugin Marketplace
31+ │ ├── metrics/ # @objectos/metrics - Prometheus Metrics
32+ │ ├── notification/ # @objectos/notification - Email/SMS/Push/Webhook
33+ │ ├── permissions/ # @objectos/permissions - RBAC Engine
34+ │ ├── realtime/ # @objectos/realtime - WebSocket Server
35+ │ ├── storage/ # @objectos/storage - KV Storage Backends
36+ │ ├── telemetry/ # @objectos/telemetry - OpenTelemetry Tracing
37+ │ ├── ui/ # @objectos/ui - Admin Console shared components
38+ │ └── workflow/ # @objectos/workflow - State Machine Engine
2239├── apps/
23- │ └── site/ # @objectos/site - Documentation site
24- ├── examples/ # Example applications
25- └── docs/ # VitePress documentation
40+ │ ├── web/ # @objectos/web - Admin Console (Vite + React 19)
41+ │ └── site/ # @objectos/site - Documentation (Next.js + Fumadocs)
42+ ├── api/ # Hono API routes & middleware
43+ ├── examples/ # Example applications (CRM, Todo)
44+ ├── docs/ # VitePress documentation (guides, spec)
45+ ├── e2e/ # Playwright E2E tests
46+ └── scripts/ # Build & maintenance scripts
2647```
2748
28- ** Note** : The UI package (` @objectos/ui ` ) has been moved to a separate repository and is developed independently.
29-
3049### Package Responsibilities
3150
32- | Package | Role | Can Import | Cannot Import |
33- | ---------| ------| ------------| ---------------|
34- | ` @objectos/kernel ` | Core logic, object registry, hooks | ` @objectql/types ` , ` @objectql/core ` | ` pg ` , ` express ` , ` nest ` |
35- | ` @objectos/server ` | HTTP layer, REST API | ` @objectos/kernel ` , ` @nestjs/* ` | ` knex ` , direct SQL |
36- | ` @objectos/preset-* ` | Metadata YAML files | None | No .ts files allowed |
51+ | Package | Role | Dependencies |
52+ | ---------| ------| -------------|
53+ | ` @objectos/auth ` | Identity — BetterAuth, SSO, 2FA, Sessions | ` @objectstack/spec ` , ` @objectstack/runtime ` |
54+ | ` @objectos/permissions ` | Authorization — RBAC, Permission Sets | ` @objectstack/spec ` , ` @objectstack/runtime ` |
55+ | ` @objectos/audit ` | Compliance — CRUD events, field history | ` @objectstack/spec ` , ` @objectstack/runtime ` |
56+ | ` @objectos/workflow ` | Flow — FSM engine, approval processes | ` @objectstack/spec ` , ` @objectstack/runtime ` |
57+ | ` @objectos/automation ` | Triggers — WorkflowRule, action types | ` @objectstack/spec ` , ` @objectstack/runtime ` |
58+ | ` @objectos/jobs ` | Background — queues, cron, retry | ` @objectstack/spec ` , ` @objectstack/runtime ` |
59+ | ` @objectos/realtime ` | Sync — WebSocket, presence | ` @objectstack/spec ` , ` @objectstack/runtime ` |
60+ | ` @objectos/graphql ` | GraphQL API — schema generation, subscriptions | ` @objectstack/spec ` , ` graphql ` |
61+ | ` @objectos/agent ` | AI — LLM agents, tools, orchestration | ` @objectstack/spec ` , ` @objectstack/runtime ` |
62+ | ` @objectos/analytics ` | Analytics — aggregation, reports, dashboards | ` @objectstack/spec ` , ` @objectstack/runtime ` |
3763
3864## Development Standards
3965
@@ -166,9 +192,9 @@ describe('ObjectOS.insert', () => {
166192
167193### Prerequisites
168194
169- - Node.js 18 + (LTS recommended)
170- - PNPM 8+
171- - PostgreSQL 13+ (for integration tests )
195+ - Node.js 20 + (LTS recommended — see ` .node-version ` )
196+ - PNPM 10+ (exact version managed via ` packageManager ` field in ` package.json ` )
197+ - PostgreSQL or MongoDB (optional — SQLite by default )
172198
173199### Setup
174200
@@ -180,41 +206,55 @@ cd objectos
180206# Install dependencies
181207pnpm install
182208
209+ # Copy and configure environment variables
210+ cp .env.example .env
211+ # Edit .env to set AUTH_SECRET (required)
212+
183213# Build all packages
184- pnpm run build
214+ pnpm build
185215
186216# Run tests
187- pnpm run test
217+ pnpm test
188218```
189219
190220### Development Workflow
191221
192222``` bash
193- # Start the full stack development environment
194- # - Server runs in watch mode on http://localhost:3000
195- # - Web runs in build watch mode (changes auto-compile)
196- pnpm run dev
223+ # Start API server (:5320) + Admin Console (:5321)
224+ pnpm dev
225+
226+ # Start everything including docs site
227+ pnpm dev:all
197228
198- # Start only the server (without frontend build watch)
199- pnpm run server
229+ # Start only the API server
230+ pnpm objectstack:serve
200231
201- # Start only the frontend build watch
202- pnpm run web:watch
232+ # Start only the Admin Console
233+ pnpm web:dev
203234
204- # Build for production (compiles both server and web)
205- pnpm run build
235+ # Start only the docs site
236+ pnpm site:dev
206237
207- # Run the production build (starts server serving built web assets)
208- pnpm run start
238+ # Build for production
239+ pnpm build
209240
210- # Run tests in watch mode
211- pnpm run test --watch
241+ # Run the production build
242+ pnpm start
212243
213- # Build documentation
214- pnpm run docs:dev
244+ # Run all tests (via Turborepo)
245+ pnpm test
215246
216- # Lint code
217- pnpm run lint # (TODO: Add lint script)
247+ # Lint all packages
248+ pnpm lint
249+
250+ # Type-check all packages
251+ pnpm type-check
252+
253+ # Validate ObjectStack configuration
254+ pnpm objectstack:validate
255+
256+ # Check development environment health
257+ pnpm objectstack:doctor
218258```
219259
220260## How to Contribute
@@ -261,8 +301,8 @@ Use conventional commits:
261301
262302``` bash
263303# Format: <type>(<scope>): <subject>
264- git commit -m " feat(kernel ): add hook priority support"
265- git commit -m " fix(server ): handle null values in query"
304+ git commit -m " feat(workflow ): add hook priority support"
305+ git commit -m " fix(graphql ): handle null values in query"
266306git commit -m " docs(guide): add architecture examples"
267307```
268308
@@ -302,87 +342,42 @@ Before submitting, ensure:
302342### Running Tests
303343
304344``` bash
305- # All tests
306- pnpm run test
345+ # All tests (via Turborepo, concurrency=3)
346+ pnpm test
307347
308348# Specific package
309- pnpm --filter @objectos/kernel test
349+ pnpm --filter @objectos/permissions test
310350
311- # With coverage
312- pnpm run test --coverage
313-
314- # Watch mode
315- pnpm run test --watch
351+ # E2E tests (Playwright)
352+ pnpm e2e
316353```
317354
318- ### Writing Tests
355+ > ** Note ** : Most packages use ** Jest ** (with ` ts-jest ` ESM preset). Some packages ( ` permissions ` , ` automation ` , ` workflow ` ) use ** Vitest ** . Both frameworks use the same ` describe ` / ` it ` / ` expect ` API — check each package's ` package.json ` for the exact test runner.
319356
320- #### Unit Test Example (Kernel)
357+ ### Writing Tests
321358
322359``` typescript
323- // packages/kernel/src/__tests__/registry.test.ts
324- import { ObjectRegistry } from ' ../registry' ;
360+ // packages/cache/test/plugin.test.ts
361+ import { CachePlugin } from ' ../src/plugin' ;
362+
363+ describe (' CachePlugin' , () => {
364+ let plugin: CachePlugin ;
325365
326- describe (' ObjectRegistry' , () => {
327- let registry: ObjectRegistry ;
328-
329366 beforeEach (() => {
330- registry = new ObjectRegistry ( );
367+ plugin = new CachePlugin ({ maxSize: 100 , ttl: 60000 } );
331368 });
332-
333- it (' should register an object' , () => {
334- registry .register ({
335- name: ' contacts' ,
336- fields: { email: { type: ' email' } }
337- });
338-
339- expect (registry .has (' contacts' )).toBe (true );
340- });
341-
342- it (' should throw if object not found' , () => {
343- expect (() => {
344- registry .get (' nonexistent' );
345- }).toThrow (' Object not found: nonexistent' );
346- });
347- });
348- ```
349369
350- #### Integration Test Example (Server)
351-
352- ``` typescript
353- // packages/server/test/api.e2e-spec.ts
354- import * as request from ' supertest' ;
355- import { Test } from ' @nestjs/testing' ;
356- import { AppModule } from ' ../src/app.module' ;
357-
358- describe (' ObjectDataController (e2e)' , () => {
359- let app;
360-
361- beforeAll (async () => {
362- const moduleRef = await Test .createTestingModule ({
363- imports: [AppModule ],
364- }).compile ();
365-
366- app = moduleRef .createNestApplication ();
367- await app .init ();
370+ it (' should store and retrieve values' , async () => {
371+ await plugin .set (' key' , ' value' );
372+ const result = await plugin .get (' key' );
373+ expect (result ).toBe (' value' );
368374 });
369-
370- it (' POST /api/data/contacts should create contact' , () => {
371- return request (app .getHttpServer ())
372- .post (' /api/data/contacts' )
373- .send ({
374- first_name: ' John' ,
375- last_name: ' Doe' ,
376- email: ' john@example.com'
377- })
378- .expect (201 )
379- .expect ((res ) => {
380- expect (res .body ).toHaveProperty (' id' );
381- });
382- });
383-
384- afterAll (async () => {
385- await app .close ();
375+
376+ it (' should return undefined for expired keys' , async () => {
377+ await plugin .set (' key' , ' value' , { ttl: 1 });
378+ await new Promise (r => setTimeout (r , 10 ));
379+ const result = await plugin .get (' key' );
380+ expect (result ).toBeUndefined ();
386381 });
387382});
388383```
@@ -392,14 +387,14 @@ describe('ObjectDataController (e2e)', () => {
392387### Building Docs
393388
394389``` bash
395- # Start docs dev server
396- pnpm run docs :dev
390+ # Start docs site in development mode
391+ pnpm site :dev
397392
398- # Build static docs
399- pnpm run docs :build
393+ # Build docs site for production
394+ pnpm site :build
400395
401- # Preview built docs
402- pnpm run docs :preview
396+ # Preview the built docs site
397+ pnpm site :preview
403398```
404399
405400### Documentation Structure
0 commit comments