oneie 3.7.0 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/dist/commands/agent.d.ts +2 -0
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +44 -0
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/bounty.d.ts +4 -0
- package/dist/commands/bounty.d.ts.map +1 -0
- package/dist/commands/bounty.js +24 -0
- package/dist/commands/bounty.js.map +1 -0
- package/dist/commands/capabilities.d.ts +4 -0
- package/dist/commands/capabilities.d.ts.map +1 -0
- package/dist/commands/capabilities.js +18 -0
- package/dist/commands/capabilities.js.map +1 -0
- package/dist/commands/commend.d.ts +4 -0
- package/dist/commands/commend.d.ts.map +1 -0
- package/dist/commands/commend.js +13 -0
- package/dist/commands/commend.js.map +1 -0
- package/dist/commands/completion.d.ts +4 -0
- package/dist/commands/completion.d.ts.map +1 -0
- package/dist/commands/completion.js +49 -0
- package/dist/commands/completion.js.map +1 -0
- package/dist/commands/config.d.ts +4 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +78 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/doctor.d.ts +4 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +72 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/export.d.ts +4 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +15 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/fade.d.ts.map +1 -1
- package/dist/commands/fade.js +8 -4
- package/dist/commands/fade.js.map +1 -1
- package/dist/commands/flag.d.ts +4 -0
- package/dist/commands/flag.d.ts.map +1 -0
- package/dist/commands/flag.js +13 -0
- package/dist/commands/flag.js.map +1 -0
- package/dist/commands/health.d.ts +4 -0
- package/dist/commands/health.d.ts.map +1 -0
- package/dist/commands/health.js +11 -0
- package/dist/commands/health.js.map +1 -0
- package/dist/commands/highways.d.ts.map +1 -1
- package/dist/commands/highways.js +7 -4
- package/dist/commands/highways.js.map +1 -1
- package/dist/commands/hire.d.ts +4 -0
- package/dist/commands/hire.d.ts.map +1 -0
- package/dist/commands/hire.js +16 -0
- package/dist/commands/hire.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +69 -42
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/mark.d.ts.map +1 -1
- package/dist/commands/mark.js +7 -7
- package/dist/commands/mark.js.map +1 -1
- package/dist/commands/pay.d.ts +4 -0
- package/dist/commands/pay.d.ts.map +1 -0
- package/dist/commands/pay.js +21 -0
- package/dist/commands/pay.js.map +1 -0
- package/dist/commands/pipe.d.ts +4 -0
- package/dist/commands/pipe.d.ts.map +1 -0
- package/dist/commands/pipe.js +35 -0
- package/dist/commands/pipe.js.map +1 -0
- package/dist/commands/publish.d.ts +4 -0
- package/dist/commands/publish.d.ts.map +1 -0
- package/dist/commands/publish.js +23 -0
- package/dist/commands/publish.js.map +1 -0
- package/dist/commands/repl.d.ts +4 -0
- package/dist/commands/repl.d.ts.map +1 -0
- package/dist/commands/repl.js +56 -0
- package/dist/commands/repl.js.map +1 -0
- package/dist/commands/revenue.d.ts +4 -0
- package/dist/commands/revenue.d.ts.map +1 -0
- package/dist/commands/revenue.js +11 -0
- package/dist/commands/revenue.js.map +1 -0
- package/dist/commands/stats.d.ts +4 -0
- package/dist/commands/stats.d.ts.map +1 -0
- package/dist/commands/stats.js +11 -0
- package/dist/commands/stats.js.map +1 -0
- package/dist/commands/status.d.ts +4 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +18 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/tail.d.ts +4 -0
- package/dist/commands/tail.d.ts.map +1 -0
- package/dist/commands/tail.js +51 -0
- package/dist/commands/tail.js.map +1 -0
- package/dist/commands/warn.d.ts.map +1 -1
- package/dist/commands/warn.js +6 -6
- package/dist/commands/warn.js.map +1 -1
- package/dist/index.js +61 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/args.d.ts +1 -0
- package/dist/lib/args.d.ts.map +1 -1
- package/dist/lib/args.js +3 -0
- package/dist/lib/args.js.map +1 -1
- package/dist/lib/output.d.ts +5 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/output.js +32 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/lib/sdk.d.ts +10 -0
- package/dist/lib/sdk.d.ts.map +1 -0
- package/dist/lib/sdk.js +22 -0
- package/dist/lib/sdk.js.map +1 -0
- package/dist/utils/installation-setup.d.ts +15 -0
- package/dist/utils/installation-setup.d.ts.map +1 -1
- package/dist/utils/installation-setup.js +63 -0
- package/dist/utils/installation-setup.js.map +1 -1
- package/package.json +3 -18
- package/.claude/agents/TROUBLESHOOTING.md +0 -530
- package/.claude/agents/agent-backend.md +0 -574
- package/.claude/agents/agent-builder.md +0 -911
- package/.claude/agents/agent-claude.md +0 -645
- package/.claude/agents/agent-clean.md +0 -477
- package/.claude/agents/agent-clone.md +0 -554
- package/.claude/agents/agent-designer.md +0 -1080
- package/.claude/agents/agent-director.md +0 -2254
- package/.claude/agents/agent-documenter.md +0 -688
- package/.claude/agents/agent-frontend.md +0 -1199
- package/.claude/agents/agent-integrator.md +0 -670
- package/.claude/agents/agent-lawyer.md +0 -1320
- package/.claude/agents/agent-news.md +0 -363
- package/.claude/agents/agent-onboard.md +0 -613
- package/.claude/agents/agent-ontology.md +0 -585
- package/.claude/agents/agent-ops.md +0 -1275
- package/.claude/agents/agent-problem-solver.md +0 -669
- package/.claude/agents/agent-quality.md +0 -1042
- package/.claude/agents/agent-sales.md +0 -507
- package/.claude/agents/agent-writer.md +0 -1068
- package/.claude/commands/cascade.md +0 -742
- package/.claude/commands/chat.md +0 -728
- package/.claude/commands/commit.md +0 -95
- package/.claude/commands/create.md +0 -544
- package/.claude/commands/deploy.md +0 -309
- package/.claude/commands/fast.md +0 -636
- package/.claude/commands/mcp-on.md +0 -191
- package/.claude/commands/media-upload.md +0 -186
- package/.claude/commands/news.md +0 -274
- package/.claude/commands/onboard.md +0 -440
- package/.claude/commands/one.md +0 -398
- package/.claude/commands/optimize.md +0 -74
- package/.claude/commands/plan.md +0 -719
- package/.claude/commands/push.md +0 -214
- package/.claude/commands/release.md +0 -105
- package/.claude/commands/review.md +0 -99
- package/.claude/commands/server.md +0 -487
- package/.claude/commands/start.md +0 -227
- package/.claude/commands/test.md +0 -197
- package/.claude/commands/validate.md +0 -140
- package/.claude/hooks/.last-news-context +0 -1
- package/.claude/hooks/PULL-BEFORE-PUSH-GUIDE.md +0 -473
- package/.claude/hooks/README-knowledge-hooks.md +0 -451
- package/.claude/hooks/README-news-generation.md +0 -364
- package/.claude/hooks/README-root-cleanup.md +0 -200
- package/.claude/hooks/README.md +0 -284
- package/.claude/hooks/__pycache__/todo.cpython-312.pyc +0 -0
- package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
- package/.claude/hooks/auto-format.sh +0 -106
- package/.claude/hooks/check-filenames.py +0 -177
- package/.claude/hooks/clean-post.py +0 -468
- package/.claude/hooks/clean-pre.py +0 -393
- package/.claude/hooks/clean-root-markdown.sh +0 -73
- package/.claude/hooks/commit-push.sh +0 -95
- package/.claude/hooks/done.py +0 -236
- package/.claude/hooks/format-hook.sh +0 -163
- package/.claude/hooks/formatting.py +0 -187
- package/.claude/hooks/hook-logger.sh +0 -173
- package/.claude/hooks/knowledge-post.py +0 -355
- package/.claude/hooks/knowledge-pre.py +0 -245
- package/.claude/hooks/mcp-on.sh +0 -134
- package/.claude/hooks/notification-hook.sh +0 -279
- package/.claude/hooks/ontology-validation.py +0 -255
- package/.claude/hooks/push.sh +0 -153
- package/.claude/hooks/release-cli.sh +0 -205
- package/.claude/hooks/root-cleanup.py +0 -217
- package/.claude/hooks/security-hook.sh +0 -397
- package/.claude/hooks/tag-all-docs.py +0 -464
- package/.claude/hooks/test-validate-ontology.sh +0 -170
- package/.claude/hooks/todo.py +0 -368
- package/.claude/hooks/track-changes.sh +0 -101
- package/.claude/hooks/validate-imports.py +0 -182
- package/.claude/hooks/validate-ontology-structure-summary.md +0 -243
- package/.claude/hooks/validate-ontology-structure.py +0 -558
- package/.claude/hooks/validate-ontology-structure.py.backup +0 -518
- package/.claude/hooks/validate-ontology.py +0 -140
- package/.claude/hooks/write-news.sh +0 -194
- package/.claude/skills/INDEX.md +0 -523
- package/.claude/skills/REGISTRY.md +0 -529
- package/.claude/skills/agent-backend-create-mutation.md +0 -319
- package/.claude/skills/agent-designer-create-wireframe.md +0 -341
- package/.claude/skills/agent-frontend-create-page.md +0 -413
- package/.claude/skills/agents/README.md +0 -238
- package/.claude/skills/astro/add-content-collection.md +0 -30
- package/.claude/skills/astro/check-build.md +0 -29
- package/.claude/skills/astro/create-component.md +0 -29
- package/.claude/skills/astro/create-page.md +0 -30
- package/.claude/skills/astro/optimize-performance.md +0 -21
- package/.claude/skills/convex/check-deployment.md +0 -46
- package/.claude/skills/convex/create-mutation.md +0 -405
- package/.claude/skills/convex/create-query.md +0 -52
- package/.claude/skills/convex/read-schema.md +0 -373
- package/.claude/skills/convex/test-function.md +0 -50
- package/.claude/skills/deployment/check-deployment-health.md +0 -20
- package/.claude/skills/deployment/create-release.md +0 -21
- package/.claude/skills/deployment/deploy-cloudflare.md +0 -31
- package/.claude/skills/deployment/deploy-convex.md +0 -30
- package/.claude/skills/deployment/sync-repositories.md +0 -19
- package/.claude/skills/design/check-accessibility.md +0 -21
- package/.claude/skills/design/create-component-spec.md +0 -27
- package/.claude/skills/design/generate-design-tokens.md +0 -24
- package/.claude/skills/design/generate-wireframe.md +0 -30
- package/.claude/skills/documentation/create-migration-guide.md +0 -20
- package/.claude/skills/documentation/generate-api-docs.md +0 -27
- package/.claude/skills/documentation/generate-readme.md +0 -22
- package/.claude/skills/documentation/update-knowledge.md +0 -20
- package/.claude/skills/integration/connect-external-system.md +0 -21
- package/.claude/skills/integration/implement-a2a.md +0 -20
- package/.claude/skills/integration/implement-acp.md +0 -20
- package/.claude/skills/integration/verify-integration.md +0 -20
- package/.claude/skills/ontology/README.md +0 -255
- package/.claude/skills/ontology/check-dimension.md +0 -307
- package/.claude/skills/ontology/generate-entity-type.md +0 -339
- package/.claude/skills/ontology/validate-schema.md +0 -229
- package/.claude/skills/ontology/verify-relationships.md +0 -310
- package/.claude/skills/problem-solving/analyze-test-failure.md +0 -21
- package/.claude/skills/problem-solving/identify-root-cause.md +0 -20
- package/.claude/skills/problem-solving/propose-solution.md +0 -29
- package/.claude/skills/problem-solving/verify-fix.md +0 -21
- package/.claude/skills/sales/generate-demo-script.md +0 -21
- package/.claude/skills/sales/qualify-lead.md +0 -30
- package/.claude/skills/sales/track-trial.md +0 -20
- package/.claude/skills/sales/verify-kyc.md +0 -20
- package/.claude/skills/testing/analyze-coverage.md +0 -24
- package/.claude/skills/testing/generate-tests.md +0 -24
- package/.claude/skills/testing/run-tests.md +0 -27
- package/.claude/skills/testing/validate-e2e.md +0 -25
- package/AGENTS.md +0 -60
- package/CLAUDE.md +0 -130
- package/CREATE-WEBSITE.md +0 -458
- package/SECURITY.md +0 -31
- package/folders.yaml +0 -92
- package/one/README.md +0 -760
- package/one/actors/anthony-o-connell.md +0 -469
- package/one/actors/people.md +0 -590
- package/one/events/0-changes.md +0 -2764
- package/one/events/1-PROJECTS-START-HERE.md +0 -384
- package/one/events/1-projects-developer-quickstart.md +0 -620
- package/one/events/1-projects-feature.md +0 -2047
- package/one/events/1-projects-team-briefing.md +0 -583
- package/one/events/2024-10-14-deployment-plan.md +0 -330
- package/one/events/2024-10-14-deployment-success.md +0 -447
- package/one/events/2024-10-14-final-sync-complete.md +0 -250
- package/one/events/2024-10-14-release-v2.0.6.md +0 -414
- package/one/events/2024-10-15-agent-clean-v2-summary.md +0 -495
- package/one/events/2024-10-15-handoff-to-clean.md +0 -347
- package/one/events/2024-10-15-package-manager-tests.md +0 -442
- package/one/events/2024-10-15-release-command-complete.md +0 -416
- package/one/events/2025-10-15-private-files-secured.md +0 -359
- package/one/events/2025-10-15-unignore-public-group-docs.md +0 -298
- package/one/events/2025-11-08-backend-claude-refactor.md +0 -242
- package/one/events/2025-11-08-parallel-agent-implementation.md +0 -620
- package/one/events/2025-11-10-ai-integration-status-report.md +0 -241
- package/one/events/ACCESSIBILITY_CHECKLIST.md +0 -275
- package/one/events/ACCESSIBILITY_FIXES_SUMMARY.md +0 -293
- package/one/events/ALIGNMENT_REPORT_PROBLEM_SOLVER.md +0 -335
- package/one/events/ALIGNMENT_SUMMARY.md +0 -280
- package/one/events/API_ROUTES_FIXES_SUMMARY.md +0 -280
- package/one/events/ASTRO-INTEGRATION-EXAMPLES.md +0 -654
- package/one/events/AUDIT-ONTOLOGY-ALIGNMENT.md +0 -598
- package/one/events/AUDIT_PLAN_COMPLETION-20251108-125555.md +0 -262
- package/one/events/BEFORE_AFTER_COMPARISON.md +0 -978
- package/one/events/CART-DRAWER-INTEGRATION-GUIDE.md +0 -372
- package/one/events/CASCADE-2-BACKEND-AGNOSTIC.md +0 -430
- package/one/events/CHARTS-READY-TO-USE-20251106-080939.md +0 -184
- package/one/events/CHARTS-SUMMARY-20251106-080938.md +0 -196
- package/one/events/CLAUDE copy.md +0 -897
- package/one/events/CLEANUP-RELEASE-V2.0.8.md +0 -308
- package/one/events/CLOUDFLARE-FS-FIX-20251106-100516.md +0 -75
- package/one/events/COMPONENT_SHOWCASE-20251106-080938.md +0 -629
- package/one/events/CONNECTIONS_DEMO.md +0 -519
- package/one/events/CREATE-WEBSITE.md +0 -460
- package/one/events/CRITICAL-FIXES-COMPLETE.md +0 -571
- package/one/events/CUSTOM-DOMAIN.md +0 -375
- package/one/events/DELIVERABLES.md +0 -450
- package/one/events/DELIVERABLES.txt +0 -273
- package/one/events/DEMO-GROUPS-PAGE.md +0 -410
- package/one/events/DEMO-TESTING-SUMMARY.md +0 -536
- package/one/events/DEMO_COMPONENTS.md +0 -505
- package/one/events/DEMO_HOOKS_INDEX.md +0 -352
- package/one/events/DEMO_INFRASTRUCTURE.md +0 -923
- package/one/events/DEMO_INFRASTRUCTURE_SUMMARY.md +0 -588
- package/one/events/DEMO_INTEGRATION_CHECKLIST.md +0 -449
- package/one/events/DEMO_QUICK_REFERENCE.md +0 -459
- package/one/events/DEMO_SETUP.md +0 -494
- package/one/events/DEPLOYMENT copy.md +0 -444
- package/one/events/DEPLOYMENT.md +0 -196
- package/one/events/DESIGN-DELIVERABLES-20251106-080938.md +0 -557
- package/one/events/DESIGN-EXECUTIVE-SUMMARY-20251106-080938.md +0 -484
- package/one/events/DOCS-SYSTEM-GUIDE-20251105-142103.md +0 -458
- package/one/events/DOCUMENTER-DELIVERY-SUMMARY.md +0 -481
- package/one/events/DOCUMENTER-EXECUTION-GUIDE.md +0 -394
- package/one/events/DOCUMENTER-TASK-BREAKDOWN.md +0 -783
- package/one/events/ECOMMERCE-BEFORE-AFTER.md +0 -267
- package/one/events/ECOMMERCE-DEMO-PLAN.md +0 -243
- package/one/events/ECOMMERCE-ENHANCEMENTS.md +0 -594
- package/one/events/ECOMMERCE-HIGH-CONVERTING-ELEMENTS.md +0 -439
- package/one/events/ECOMMERCE-LIVE-DEMO.md +0 -381
- package/one/events/ECOMMERCE-QUICKSTART.md +0 -376
- package/one/events/ECOMMERCE-README.md +0 -354
- package/one/events/ECOMMERCE-REFACTOR-SUMMARY.md +0 -214
- package/one/events/ECOMMERCE-SETUP-SUMMARY.md +0 -414
- package/one/events/ECOMMERCE-TEMPLATE-COMPLETE.md +0 -753
- package/one/events/ECOMMERCE-TEMPLATES-SUMMARY.md +0 -941
- package/one/events/EFFECT_TS_API_PATTERN.md +0 -496
- package/one/events/EXECUTION-READY.md +0 -359
- package/one/events/EXECUTION-SUMMARY.md +0 -478
- package/one/events/FEATURE-2-4-COMPLETE.md +0 -320
- package/one/events/FEATURE_2_3_COMPLETE.md +0 -593
- package/one/events/FILE-REFERENCE-20251105-142103.md +0 -325
- package/one/events/GRADIENT-TEXT-PERMANENT-FIX.md +0 -241
- package/one/events/GROUPS-MIGRATION.md +0 -643
- package/one/events/GROUPS_DEMO_IMPLEMENTATION.md +0 -432
- package/one/events/HANDOFF.md +0 -331
- package/one/events/HOOKS-DEMO.md +0 -459
- package/one/events/IMPLEMENTATION-CHECKLIST-20251105-142103.md +0 -274
- package/one/events/IMPLEMENTATION-REPORT-DOCS-20251105-142102.md +0 -394
- package/one/events/IMPLEMENTATION-SUMMARY-FINAL.md +0 -568
- package/one/events/IMPLEMENTATION_SUMMARY-20251106-080938.md +0 -571
- package/one/events/IMPLEMENTATION_SUMMARY.md +0 -547
- package/one/events/INDEX-ALL-AGENTS.md +0 -190
- package/one/events/INDEX-FRONTEND-TESTING.md +0 -524
- package/one/events/INDEX-PROBLEM-SOLVER.md +0 -488
- package/one/events/INDEX-QUALITY-AGENT-INFER65.md +0 -455
- package/one/events/INDEX.md +0 -295
- package/one/events/INDEX_QUICK_START_REDESIGN-20251106-080939.md +0 -342
- package/one/events/INSTALL-TESTS.md +0 -311
- package/one/events/INSTALLATION_FOLDERS.md +0 -534
- package/one/events/INSTALLATION_FOLDERS_FILES.md +0 -223
- package/one/events/INSTALLATION_FOLDERS_SUMMARY.md +0 -437
- package/one/events/INTEGRATION-ARCHITECTURE.md +0 -579
- package/one/events/INTEGRATION-CHECKLIST.md +0 -1252
- package/one/events/INTEGRATION-ORCHESTRATION.md +0 -2641
- package/one/events/INTEGRATION-SUMMARY.md +0 -671
- package/one/events/LANDING-PAGE-EXAMPLE-OUTPUT.md +0 -684
- package/one/events/LANDING-PAGE-IMPLEMENTATION.md +0 -660
- package/one/events/LANDING-PAGE-QUICKSTART.md +0 -425
- package/one/events/LICENSE.md +0 -107
- package/one/events/MASTER-COORDINATION-PLAN.md +0 -613
- package/one/events/MASTER-ORCHESTRATION-INFER65.md +0 -441
- package/one/events/MASTER-PLAN-SUMMARY.md +0 -309
- package/one/events/MCP-CONFIGURATION.md +0 -354
- package/one/events/MCP-SETUP-COMPLETE.md +0 -223
- package/one/events/MIGRATION-REPORT.md +0 -453
- package/one/events/MIGRATION.md +0 -87
- package/one/events/MULTI-ONTOLOGY-COMPLETE-GUIDE.md +0 -1663
- package/one/events/MULTI-ONTOLOGY-IMPLEMENTATION-COMPLETE.md +0 -643
- package/one/events/NEWS-COMMANDS.md +0 -506
- package/one/events/NEWS-SYSTEM-SUMMARY.md +0 -480
- package/one/events/NODE-UPGRADE.md +0 -129
- package/one/events/ONBOARDING-IMPLEMENTATION-COMPLETE copy.md +0 -416
- package/one/events/ONTOLOGY-HOOKS-README.md +0 -718
- package/one/events/ONTOLOGY-INTEGRATION-MANIFEST.md +0 -383
- package/one/events/ONTOLOGY-TUTORIALS-SUMMARY.md +0 -569
- package/one/events/ONTOLOGY-TYPE-GENERATOR-SUMMARY.md +0 -491
- package/one/events/ONTOLOGY_DISCOVERY_IMPLEMENTATION.md +0 -504
- package/one/events/ONTOLOGY_DISCOVERY_QUICKSTART.md +0 -221
- package/one/events/PACKAGE-STRUCTURE.md +0 -328
- package/one/events/PLAN-COMPLETE.md +0 -429
- package/one/events/PLAYBOOK-SETUP-SUMMARY.md +0 -349
- package/one/events/PROBLEM-SOLVER-EXECUTIVE-SUMMARY.md +0 -484
- package/one/events/PROBLEM-SOLVER-QUICKSTART.md +0 -420
- package/one/events/PROJECTS-PLAN-SUMMARY.md +0 -480
- package/one/events/PROMPT_FIX_FRONTEND_ONLY.md +0 -585
- package/one/events/QA-CHECKLIST.md +0 -692
- package/one/events/QUALITY-AGENT-SUMMARY.md +0 -334
- package/one/events/QUALITY-EXECUTION-CHECKLIST.md +0 -593
- package/one/events/QUICK-REFERENCE-FRONTEND-TESTING.md +0 -475
- package/one/events/QUICK-START-ONTOLOGY.md +0 -426
- package/one/events/QUICK_START_REDESIGN-20251106-080938.md +0 -400
- package/one/events/README-PROBLEM-SOLVER.md +0 -394
- package/one/events/README-archived.md +0 -537
- package/one/events/README_QUICK_START_REDESIGN-20251106-080938.md +0 -484
- package/one/events/SEARCH_DEMO_CODE_REFERENCE.md +0 -657
- package/one/events/SEARCH_DEMO_DELIVERY.md +0 -433
- package/one/events/SEARCH_DEMO_SUMMARY.md +0 -321
- package/one/events/SEARCH_DEMO_VISUAL_GUIDE.md +0 -399
- package/one/events/SECURITY-AUDIT-FIXES.md +0 -394
- package/one/events/SECURITY-SCAN-COMPLETE.md +0 -299
- package/one/events/SHOP-BUILD-STATUS.md +0 -132
- package/one/events/SHOP-PREMIUM-UPDATE.md +0 -165
- package/one/events/SIMPLE_FIX_FRONTEND_ONLY.md +0 -280
- package/one/events/SITE-WIDE-GRADIENT-FIX.md +0 -317
- package/one/events/SPECIALIST-QUICK-REFERENCE.md +0 -678
- package/one/events/STORE-PRODUCTION-READY-STATUS.md +0 -377
- package/one/events/STRIPE-INTEGRATION.md +0 -432
- package/one/events/STRIPE-PAYMENT-METHODS-GUIDE.md +0 -447
- package/one/events/STRIPE-SETUP-GUIDE.md +0 -480
- package/one/events/TEST-PLAN-INDEX.md +0 -364
- package/one/events/TEST-PLAN.md +0 -1435
- package/one/events/TEST-SUMMARY.md +0 -411
- package/one/events/TESTING-DELIVERY.txt +0 -372
- package/one/events/TESTS-QUICK-REF.md +0 -280
- package/one/events/TRANSITIONS-QUICK-START.md +0 -159
- package/one/events/TRANSPARENCY-FIXES.md +0 -293
- package/one/events/TYPESCRIPT_FIXES.md +0 -170
- package/one/events/TYPESCRIPT_FIXES_COMPLETE.txt +0 -412
- package/one/events/TYPESCRIPT_FIXES_INDEX.md +0 -359
- package/one/events/VERIFICATION_CHECKLIST-20251106-080938.md +0 -326
- package/one/events/VIEW-TRANSITIONS.md +0 -446
- package/one/events/agent-command-implementation.md +0 -305
- package/one/events/agent-director-enhancement-summary.md +0 -404
- package/one/events/agent-director-routing-update.md +0 -214
- package/one/events/agent-onboard-implementation-summary.md +0 -475
- package/one/events/agent-ontology-alignment-completion.md +0 -263
- package/one/events/ai-integration-complete.md +0 -294
- package/one/events/ai-integration-lessons-learned.md +0 -511
- package/one/events/backend-integration-tests.md +0 -624
- package/one/events/backend-structure-diagram.txt +0 -393
- package/one/events/backend-structure-summary.txt +0 -269
- package/one/events/bullfm-video-podcast-analysis.md +0 -319
- package/one/events/clean-agent-ontology-cleanup-report.md +0 -371
- package/one/events/clean-agent-todo-analysis-summary.md +0 -336
- package/one/events/cloudflare-automation-complete.md +0 -350
- package/one/events/cloudflare-pages-infrastructure-setup.md +0 -282
- package/one/events/contact-page-complete.md +0 -316
- package/one/events/convex-analysis-index.md +0 -322
- package/one/events/convex-structure-analysis.md +0 -718
- package/one/events/creation-instructions-9-todos.md +0 -906
- package/one/events/cycle-3-video-player-port-20251108.md +0 -368
- package/one/events/cycle-3-video-player-port-complete-20251108.md +0 -334
- package/one/events/deployment-installation-folders.md +0 -178
- package/one/events/deployment-ops-summary.md +0 -386
- package/one/events/deployment-verification.md +0 -366
- package/one/events/design-spec-complete.md +0 -226
- package/one/events/documentation-audit-index.md +0 -473
- package/one/events/documentation-audit-summary.md +0 -417
- package/one/events/documentation-improvement-roadmap.md +0 -906
- package/one/events/documentation-standards-compliance-report.md +0 -538
- package/one/events/documentation-updates.md +0 -370
- package/one/events/events.md +0 -563
- package/one/events/fix-product-hydration-20251106.md +0 -211
- package/one/events/frontend-effects-complete.md +0 -584
- package/one/events/frontend-effects-orchestration.md +0 -1356
- package/one/events/frontend-effects-risk-register.md +0 -1055
- package/one/events/frontend-effects-week1-assignments.md +0 -1594
- package/one/events/hook-ontology-alignment-summary.md +0 -528
- package/one/events/installation-folders-workflow-integration.md +0 -458
- package/one/events/landing-page-generator.md +0 -476
- package/one/events/legal-assessment-2025-10-16.md +0 -1917
- package/one/events/master-coordination-plan.json +0 -1078
- package/one/events/master-plan-9-todos.md +0 -900
- package/one/events/mobile-performance-optimization.md +0 -179
- package/one/events/onboarding-implementation-complete.md +0 -523
- package/one/events/ontology-audit-agent-clone.md +0 -323
- package/one/events/ontology-test-examples.md +0 -580
- package/one/events/phase1-backend-implementation-complete.md +0 -536
- package/one/events/plan-completion-audit.md +0 -707
- package/one/events/plan-files-updated.md +0 -273
- package/one/events/production-readiness-plan.md +0 -389
- package/one/events/readme.md +0 -100
- package/one/events/release.md +0 -272
- package/one/events/root-cleanup-alignment-report.md +0 -265
- package/one/events/security-fixes-2025-01-15.md +0 -226
- package/one/events/separate-implementation-status.md +0 -555
- package/one/events/server-command-optimization-20251108.md +0 -150
- package/one/events/session-summary-2025-10-18.md +0 -366
- package/one/events/skills-complete.md +0 -351
- package/one/events/skills-infer-6-10-summary.md +0 -70
- package/one/events/skills-phase1-complete.md +0 -281
- package/one/events/specialist-assignments.md +0 -766
- package/one/events/structural-analysis-architecture-vs-plans.md +0 -600
- package/one/events/test-dashboard.md +0 -363
- package/one/events/test-index.md +0 -421
- package/one/events/test-report-ontology.md +0 -611
- package/one/events/testing-summary.md +0 -388
- package/one/events/todo-agent-builder.md +0 -1180
- package/one/events/todo-agent-director.md +0 -164
- package/one/events/todo-agent-documenter.md +0 -1815
- package/one/events/todo-agent-frontend.md +0 -1542
- package/one/events/todo-agent-problem-solver.md +0 -1682
- package/one/events/todo-agent-quality.md +0 -1647
- package/one/events/todo-refactoring-complete.md +0 -408
- package/one/events/wave1-backend-implementation-complete.md +0 -698
- package/one/events/web-AI_INTEGRATION_PHASE2_SUMMARY-20251111-152540.md +0 -529
- package/one/events/web-BUY-IN-CHATGPT-README-20251116-235241.md +0 -491
- package/one/events/web-CHARTS-IMPLEMENTATION-20251106-080939.md +0 -576
- package/one/events/web-CHARTS-QUICKSTART-20251106-080939.md +0 -416
- package/one/events/web-CODE-HIGHLIGHTING-SUMMARY-20251111-152540.md +0 -442
- package/one/events/web-DEPLOYMENT_SUMMARY-20251116-005428.md +0 -290
- package/one/events/web-DESIGN-SUMMARY-20251106-080939.md +0 -514
- package/one/events/web-README-AI-INTEGRATION-20251111-152540.md +0 -196
- package/one/events/web-RECHARTS-INTEGRATION-20251111-152540.md +0 -265
- package/one/events/web-RELEASE_OPTIMIZATION_PLAN-20251116-005428.md +0 -447
- package/one/events/web-TEST-CLEANUP-20251105-143205.md +0 -3
- package/one/events/web-USING-ANY-COMPONENT-IN-CHAT-20251111-152540.md +0 -561
- package/one/events/web-test-code-highlighting-20251111-152540.md +0 -231
- package/one/groups/features.md +0 -2904
- package/one/groups/groups.md +0 -587
- package/one/groups/one.md +0 -619
- package/one/groups/strategy-copy.md +0 -887
- package/one/learning/.obsidian/app.json +0 -1
- package/one/learning/.obsidian/appearance.json +0 -1
- package/one/learning/.obsidian/core-plugins.json +0 -33
- package/one/learning/.obsidian/ecommerce-ontology.md +0 -210
- package/one/learning/.obsidian/workspace.json +0 -211
- package/one/learning/100-inference-quick-reference.md +0 -449
- package/one/learning/ag-ui-protocol.md +0 -613
- package/one/learning/agent-onboard-usage.md +0 -630
- package/one/learning/agentic-commerce.md +0 -146
- package/one/learning/ai-agents-vs-memecoins-thesis.md +0 -683
- package/one/learning/ai-api-reference.md +0 -715
- package/one/learning/ai-platform.md +0 -323
- package/one/learning/ai-quickstart.md +0 -355
- package/one/learning/ai-sdk-implementation.md +0 -436
- package/one/learning/ai-token-crypto-analysis-framework.md +0 -1191
- package/one/learning/ai-token-paradigm-shift-2025.md +0 -732
- package/one/learning/altcoin-cycle-prediction-ontology.md +0 -884
- package/one/learning/altcoin-cycle-trading-strategy.md +0 -642
- package/one/learning/architecture-any-backend.md +0 -1589
- package/one/learning/architecture-diagram.md +0 -404
- package/one/learning/architecture-frontend.md +0 -1014
- package/one/learning/architecture.md +0 -1742
- package/one/learning/archived/ontology.old.md +0 -2840
- package/one/learning/astro-effect-complete-vision.md +0 -2148
- package/one/learning/astro-effect-simple-architecture.md +0 -750
- package/one/learning/audit-agent-onboard-alignment.md +0 -481
- package/one/learning/audit-agent-sales-alignment.md +0 -444
- package/one/learning/backend-api-reference.md +0 -728
- package/one/learning/cascading-context-specification.md +0 -1617
- package/one/learning/claude-code-integration.md +0 -1293
- package/one/learning/cli-claude-handoff.md +0 -736
- package/one/learning/context-engineering.md +0 -610
- package/one/learning/crypto-analysis-strategy.md +0 -1276
- package/one/learning/crypto-cycle-2024-2025-analysis.md +0 -44
- package/one/learning/crypto.md +0 -978
- package/one/learning/develop/design.md +0 -364
- package/one/learning/develop/index.md +0 -145
- package/one/learning/development-commands.md +0 -251
- package/one/learning/docs.md +0 -627
- package/one/learning/dsl.md +0 -1678
- package/one/learning/event-driven-documentation.md +0 -270
- package/one/learning/files.md +0 -2489
- package/one/learning/frontend.md +0 -1056
- package/one/learning/games-english.md +0 -691
- package/one/learning/games.md +0 -1082
- package/one/learning/generative-ui-patterns.md +0 -559
- package/one/learning/guidelines.md +0 -314
- package/one/learning/hono.md +0 -2127
- package/one/learning/implementation-examples.md +0 -2554
- package/one/learning/installation-folders.md +0 -366
- package/one/learning/institutional-cycle-paradigm-2025.md +0 -555
- package/one/learning/knowledge.md +0 -660
- package/one/learning/language.md +0 -998
- package/one/learning/lessons-learned.md +0 -378
- package/one/learning/lessons-website-building-focus.md +0 -382
- package/one/learning/merge-report.md +0 -254
- package/one/learning/metadata-system.md +0 -504
- package/one/learning/nine-padel-playbook.md +0 -229
- package/one/learning/one-protocol-ai-agents.md +0 -892
- package/one/learning/one-protocol-executive-report.md +0 -617
- package/one/learning/one-protocol-standard.md +0 -869
- package/one/learning/one-protocol-whitepaper.md +0 -756
- package/one/learning/ontology-blog.yaml +0 -47
- package/one/learning/ontology-cheatsheet.md +0 -617
- package/one/learning/ontology-community.yaml +0 -65
- package/one/learning/ontology-core-universal.md +0 -740
- package/one/learning/ontology-core.yaml +0 -63
- package/one/learning/ontology-courses.yaml +0 -76
- package/one/learning/ontology-creator.md +0 -402
- package/one/learning/ontology-crypto.md +0 -1603
- package/one/learning/ontology-developer-guide.md +0 -814
- package/one/learning/ontology-documentation.md +0 -377
- package/one/learning/ontology-ecommerce.md +0 -269
- package/one/learning/ontology-education-game.md +0 -1654
- package/one/learning/ontology-education.md +0 -938
- package/one/learning/ontology-engineering-specification.md +0 -1310
- package/one/learning/ontology-engineering.md +0 -1676
- package/one/learning/ontology-files.yaml +0 -525
- package/one/learning/ontology-frontend-master.md +0 -2898
- package/one/learning/ontology-frontend-specifications.md +0 -2196
- package/one/learning/ontology-frontend.md +0 -2475
- package/one/learning/ontology-index.md +0 -397
- package/one/learning/ontology-minimal.yaml +0 -301
- package/one/learning/ontology-portfolio.yaml +0 -45
- package/one/learning/ontology-quickstart.md +0 -602
- package/one/learning/ontology-release.md +0 -317
- package/one/learning/ontology-shop.yaml +0 -148
- package/one/learning/ontology-tokens.yaml +0 -51
- package/one/learning/ontology-tutorial.md +0 -455
- package/one/learning/ontology-v2.md +0 -4449
- package/one/learning/ontology-video-script.md +0 -939
- package/one/learning/ontology-visual-guide.md +0 -378
- package/one/learning/ontology.md +0 -3847
- package/one/learning/ontology.yaml +0 -1653
- package/one/learning/parallel-agents.md +0 -932
- package/one/learning/patterns/backend/convex-mutation-pattern.md +0 -130
- package/one/learning/patterns/backend/convex-query-pattern.md +0 -143
- package/one/learning/patterns/backend/mutation-template.md +0 -249
- package/one/learning/patterns/backend/query-template.md +0 -286
- package/one/learning/patterns/backend/service-template.md +0 -258
- package/one/learning/patterns/design/component-architecture.md +0 -435
- package/one/learning/patterns/design/index.md +0 -160
- package/one/learning/patterns/design/test-driven-design-pattern.md +0 -196
- package/one/learning/patterns/design/wireframe-template.md +0 -250
- package/one/learning/patterns/frontend/component-template.md +0 -246
- package/one/learning/patterns/frontend/form-template.md +0 -348
- package/one/learning/patterns/frontend/page-template.md +0 -209
- package/one/learning/patterns/frontend/react-component-pattern.md +0 -188
- package/one/learning/patterns/test/acceptance-criteria-template.md +0 -396
- package/one/learning/patterns/test/technical-test-template.md +0 -566
- package/one/learning/patterns/test/test-driven-pattern.md +0 -160
- package/one/learning/patterns/test/user-flow-template.md +0 -272
- package/one/learning/performance.md +0 -459
- package/one/learning/provider-agnostic-content.md +0 -995
- package/one/learning/provider-creation-guide.md +0 -1082
- package/one/learning/quality-loop.md +0 -419
- package/one/learning/quick-start-ontology-mapping.md +0 -773
- package/one/learning/readme-architecture.md +0 -158
- package/one/learning/readme.md +0 -149
- package/one/learning/rules.md +0 -644
- package/one/learning/score.md +0 -85
- package/one/learning/specifications.md +0 -873
- package/one/learning/tags.md +0 -148
- package/one/learning/todo-template.md +0 -269
- package/one/learning/todo.md +0 -269
- package/one/learning/troubleshooting.md +0 -434
- package/one/learning/typescript-patterns.md +0 -321
- package/one/learning/universal-generation-language.md +0 -827
- package/one/learning/x402-research.md +0 -104
- package/one/license.md +0 -107
- package/one/paths/a2a.md +0 -600
- package/one/paths/acp.md +0 -808
- package/one/paths/acps.md +0 -749
- package/one/paths/agentkit.md +0 -367
- package/one/paths/agui.md +0 -785
- package/one/paths/any-backend.md +0 -1720
- package/one/paths/ap2.md +0 -1072
- package/one/paths/api/queries-reference.md +0 -860
- package/one/paths/api-docs.md +0 -1909
- package/one/paths/api-reference.md +0 -1029
- package/one/paths/api.md +0 -2208
- package/one/paths/architecture-diagram.md +0 -112
- package/one/paths/communications.md +0 -467
- package/one/paths/connections.md +0 -357
- package/one/paths/copilotkit.md +0 -1577
- package/one/paths/cryptonetworks.md +0 -799
- package/one/paths/documentation.md +0 -1138
- package/one/paths/effect.md +0 -297
- package/one/paths/elizaos.md +0 -1308
- package/one/paths/groups.md +0 -814
- package/one/paths/inference.md +0 -76
- package/one/paths/integration-examples.md +0 -893
- package/one/paths/integration-guide.md +0 -887
- package/one/paths/integration-phase2.md +0 -754
- package/one/paths/kyc.md +0 -650
- package/one/paths/mcp.md +0 -860
- package/one/paths/membership.md +0 -1170
- package/one/paths/middleware.md +0 -1085
- package/one/paths/multitenant.md +0 -1359
- package/one/paths/n8n.md +0 -1033
- package/one/paths/patterns.md +0 -107
- package/one/paths/protocols.md +0 -297
- package/one/paths/relationships.md +0 -125
- package/one/paths/schema.md +0 -605
- package/one/paths/service-layer.md +0 -568
- package/one/paths/vectors.md +0 -225
- package/one/paths/wordpress.md +0 -1320
- package/one/paths/workflow-copy.md +0 -923
- package/one/paths/workflow-examples.md +0 -759
- package/one/paths/workflow-onboarding.md +0 -701
- package/one/paths/workflow.md +0 -923
- package/one/paths/workflows/delegation.md +0 -903
- package/one/paths/workflows/frontend.md +0 -1055
- package/one/paths/workflows/strategy.md +0 -921
- package/one/paths/workflows/tasks.md +0 -716
- package/one/paths/x402-baazar.md +0 -131
- package/one/paths/x402.md +0 -1353
- package/one/things/ALIGNMENT_AUDIT_QUALITY_AGENT.md +0 -401
- package/one/things/AUDIT_AGENT_INTEGRATOR_ALIGNMENT.md +0 -588
- package/one/things/AUDIT_REPORT_AGENT_CLEAN.md +0 -461
- package/one/things/CHECKLIST.md +0 -407
- package/one/things/IMPLEMENTATION_STATUS.md +0 -379
- package/one/things/ONE.md +0 -529
- package/one/things/agents/agent-backend.md +0 -1501
- package/one/things/agents/agent-builder.md +0 -1064
- package/one/things/agents/agent-clean.md +0 -1112
- package/one/things/agents/agent-clone.md +0 -1324
- package/one/things/agents/agent-deploy.md +0 -986
- package/one/things/agents/agent-designer.md +0 -2305
- package/one/things/agents/agent-director.md +0 -1526
- package/one/things/agents/agent-documenter.md +0 -1129
- package/one/things/agents/agent-frontend.md +0 -1201
- package/one/things/agents/agent-integrator.md +0 -1269
- package/one/things/agents/agent-lawyer.md +0 -1371
- package/one/things/agents/agent-problem-solver.md +0 -1457
- package/one/things/agents/agent-quality.md +0 -1483
- package/one/things/agents/agent-sales.md +0 -1074
- package/one/things/cascade/cascade.yaml +0 -481
- package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +0 -523
- package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +0 -314
- package/one/things/cascade/docs/examples/1-1-agent-prompts.md +0 -562
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +0 -543
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +0 -272
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +0 -548
- package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +0 -586
- package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +0 -267
- package/one/things/cascade/docs/examples/1-3-event-coordination.md +0 -547
- package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +0 -665
- package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +0 -236
- package/one/things/cascade/docs/examples/1-4-knowledge-management.md +0 -652
- package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +0 -860
- package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +0 -255
- package/one/things/cascade/docs/examples/1-5-quality-loops.md +0 -725
- package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +0 -659
- package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +0 -256
- package/one/things/cascade/docs/examples/1-6-numbering-structure.md +0 -639
- package/one/things/cascade/docs/examples/readme.md +0 -259
- package/one/things/cascade/docs/getting-started.md +0 -533
- package/one/things/cascade/docs/workflow.md +0 -1378
- package/one/things/cascade/readme.md +0 -379
- package/one/things/cascade/templates/feature-template.md +0 -289
- package/one/things/claude/agents/advocacy-activation-manager.md +0 -710
- package/one/things/claude/agents/advocacy-campaign-designer.md +0 -688
- package/one/things/claude/agents/analyst.md +0 -508
- package/one/things/claude/agents/architect.md +0 -505
- package/one/things/claude/agents/brand-identity-specialist.md +0 -538
- package/one/things/claude/agents/bstp-token-strategist.md +0 -690
- package/one/things/claude/agents/builder-repo.md +0 -532
- package/one/things/claude/agents/bullstamp-community-builder.md +0 -597
- package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +0 -529
- package/one/things/claude/agents/bulltilt-platform-growth.md +0 -590
- package/one/things/claude/agents/company-bullstamp-character.md +0 -602
- package/one/things/claude/agents/company-bullstamp-community.md +0 -307
- package/one/things/claude/agents/company-bullstamp-marketing.md +0 -307
- package/one/things/claude/agents/company-bullstamp-token.md +0 -307
- package/one/things/claude/agents/company-bulltilt-growth.md +0 -307
- package/one/things/claude/agents/content-bibliography-formatter.md +0 -404
- package/one/things/claude/agents/content-calendar-planner.md +0 -473
- package/one/things/claude/agents/content-chapter-formatter.md +0 -513
- package/one/things/claude/agents/content-formatter.md +0 -571
- package/one/things/claude/agents/content-hook-specialist.md +0 -485
- package/one/things/claude/agents/content-image-formatter.md +0 -560
- package/one/things/claude/agents/content-introduction-formatter.md +0 -510
- package/one/things/claude/agents/content-multiplication-engine.md +0 -579
- package/one/things/claude/agents/content-playbook-writer.md +0 -473
- package/one/things/claude/agents/content-team-manager.md +0 -647
- package/one/things/claude/agents/content-toc-formatter.md +0 -547
- package/one/things/claude/agents/convex-backend-specialist.md +0 -2725
- package/one/things/claude/agents/core-manager.md +0 -607
- package/one/things/claude/agents/core-master.md +0 -426
- package/one/things/claude/agents/cross-functional-manager.md +0 -476
- package/one/things/claude/agents/crypto-airdrop-strategist.md +0 -622
- package/one/things/claude/agents/crypto-analytics-educator.md +0 -596
- package/one/things/claude/agents/crypto-architecture-specialist.md +0 -497
- package/one/things/claude/agents/crypto-community-analyst.md +0 -314
- package/one/things/claude/agents/crypto-community-psychologist.md +0 -546
- package/one/things/claude/agents/crypto-dex-optimization-expert.md +0 -579
- package/one/things/claude/agents/crypto-dex-optimizer.md +0 -307
- package/one/things/claude/agents/crypto-diamond-formation-specialist.md +0 -552
- package/one/things/claude/agents/crypto-diamond-hands.md +0 -307
- package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +0 -597
- package/one/things/claude/agents/crypto-engagement-specialist.md +0 -581
- package/one/things/claude/agents/crypto-market-researcher.md +0 -307
- package/one/things/claude/agents/crypto-marketing-orchestrator.md +0 -563
- package/one/things/claude/agents/crypto-network-effect-amplifier.md +0 -614
- package/one/things/claude/agents/crypto-optimization-analyst.md +0 -597
- package/one/things/claude/agents/crypto-strategic-synthesizer.md +0 -556
- package/one/things/claude/agents/crypto-team-manager.md +0 -392
- package/one/things/claude/agents/crypto-token-analyst.md +0 -319
- package/one/things/claude/agents/crypto-viral-content-creator.md +0 -549
- package/one/things/claude/agents/crypto-wallet-identification-expert.md +0 -527
- package/one/things/claude/agents/crypto-wallet-identifier.md +0 -307
- package/one/things/claude/agents/customer-journey-designer.md +0 -474
- package/one/things/claude/agents/customer-success-manager.md +0 -574
- package/one/things/claude/agents/dev.md +0 -406
- package/one/things/claude/agents/documenter.md +0 -548
- package/one/things/claude/agents/elevate-marketing-orchestrator.md +0 -403
- package/one/things/claude/agents/engagement-specialist.md +0 -502
- package/one/things/claude/agents/engineering-architect.md +0 -387
- package/one/things/claude/agents/engineering-business-analyst.md +0 -527
- package/one/things/claude/agents/engineering-developer.md +0 -386
- package/one/things/claude/agents/engineering-director.md +0 -322
- package/one/things/claude/agents/engineering-ingestor.md +0 -659
- package/one/things/claude/agents/engineering-product-manager.md +0 -525
- package/one/things/claude/agents/engineering-product-owner.md +0 -527
- package/one/things/claude/agents/engineering-project-coordinator.md +0 -525
- package/one/things/claude/agents/engineering-quality-assurance.md +0 -392
- package/one/things/claude/agents/engineering-team-manager.md +0 -515
- package/one/things/claude/agents/engineering-user-experience.md +0 -386
- package/one/things/claude/agents/framework-elevate-manager.md +0 -309
- package/one/things/claude/agents/improver.md +0 -805
- package/one/things/claude/agents/intelligence-team-manager.md +0 -390
- package/one/things/claude/agents/lead-capture-expert.md +0 -459
- package/one/things/claude/agents/lead-magnet-creator.md +0 -446
- package/one/things/claude/agents/market-research-analyst.md +0 -435
- package/one/things/claude/agents/marketing-brand-identity.md +0 -344
- package/one/things/claude/agents/marketing-content-hooks.md +0 -455
- package/one/things/claude/agents/marketing-content-multiplier.md +0 -331
- package/one/things/claude/agents/marketing-content-poster.md +0 -372
- package/one/things/claude/agents/marketing-customer-journey.md +0 -331
- package/one/things/claude/agents/marketing-director.md +0 -402
- package/one/things/claude/agents/marketing-engagement.md +0 -331
- package/one/things/claude/agents/marketing-lead-capture.md +0 -331
- package/one/things/claude/agents/marketing-lead-magnet.md +0 -331
- package/one/things/claude/agents/marketing-network-effects.md +0 -331
- package/one/things/claude/agents/marketing-nurture-campaigns.md +0 -331
- package/one/things/claude/agents/marketing-share-optimizer.md +0 -331
- package/one/things/claude/agents/marketing-team-manager.md +0 -451
- package/one/things/claude/agents/marketing-viral-growth.md +0 -232
- package/one/things/claude/agents/mission-commander.md +0 -378
- package/one/things/claude/agents/network-effect-analyst.md +0 -604
- package/one/things/claude/agents/nextjs-15-specialist.md +0 -1634
- package/one/things/claude/agents/npx.md +0 -946
- package/one/things/claude/agents/nurture-campaign-manager.md +0 -554
- package/one/things/claude/agents/one-master.md +0 -378
- package/one/things/claude/agents/one-orchestrator.md +0 -345
- package/one/things/claude/agents/one.md +0 -658
- package/one/things/claude/agents/playbook-generator.md +0 -526
- package/one/things/claude/agents/pm.md +0 -349
- package/one/things/claude/agents/po.md +0 -370
- package/one/things/claude/agents/qa.md +0 -361
- package/one/things/claude/agents/research-foundation-analyst.md +0 -324
- package/one/things/claude/agents/research-intelligence-gatherer.md +0 -435
- package/one/things/claude/agents/research-market-analyst.md +0 -324
- package/one/things/claude/agents/research-team-manager.md +0 -489
- package/one/things/claude/agents/sales-environment-optimizer.md +0 -519
- package/one/things/claude/agents/sales-team-manager.md +0 -407
- package/one/things/claude/agents/sales-upsell-strategist.md +0 -324
- package/one/things/claude/agents/service-advocacy-campaigns.md +0 -324
- package/one/things/claude/agents/service-advocacy-manager.md +0 -324
- package/one/things/claude/agents/service-success-manager.md +0 -324
- package/one/things/claude/agents/service-team-manager.md +0 -405
- package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +0 -2357
- package/one/things/claude/agents/share-optimization-specialist.md +0 -576
- package/one/things/claude/agents/sm.md +0 -352
- package/one/things/claude/agents/story-teller.md +0 -498
- package/one/things/claude/agents/task-master.md +0 -621
- package/one/things/claude/agents/tauri-cross-platform-specialist.md +0 -1912
- package/one/things/claude/agents/tester.md +0 -595
- package/one/things/claude/agents/the-bull-character-manager.md +0 -603
- package/one/things/claude/agents/tools-playbook-generator.md +0 -492
- package/one/things/claude/agents/turbo-repo-builder.md +0 -346
- package/one/things/claude/agents/upsell-strategist.md +0 -503
- package/one/things/claude/agents/ux-expert.md +0 -360
- package/one/things/claude/agents/viral-growth-orchestrator.md +0 -520
- package/one/things/claude/claude-code-hooks-development.json +0 -21
- package/one/things/claude/claude-code-hooks-production.json +0 -21
- package/one/things/claude/claude-code-hooks.json +0 -25
- package/one/things/claude/commands/agent.md +0 -124
- package/one/things/claude/commands/cascade-status.md +0 -153
- package/one/things/claude/commands/ingest.md +0 -343
- package/one/things/claude/commands/ingestor.md +0 -158
- package/one/things/claude/commands/mission.md +0 -103
- package/one/things/claude/commands/npx.md +0 -156
- package/one/things/claude/commands/one.md +0 -486
- package/one/things/claude/commands/quality-check.md +0 -252
- package/one/things/claude/commands/smart-route.md +0 -261
- package/one/things/claude/commands/start.md +0 -139
- package/one/things/claude/commands/story.md +0 -103
- package/one/things/claude/commands/task.md +0 -193
- package/one/things/claude/hook-bypass.json +0 -32
- package/one/things/claude/hooks/agent-hook-config.json +0 -427
- package/one/things/claude/hooks/build-hook.sh +0 -156
- package/one/things/claude/hooks/cleanup-hook.sh +0 -201
- package/one/things/claude/hooks/file-organization-hook.sh +0 -80
- package/one/things/claude/hooks/format-hook.sh +0 -43
- package/one/things/claude/hooks/hook-bypass.sh +0 -293
- package/one/things/claude/hooks/hook-debouncer.sh +0 -62
- package/one/things/claude/hooks/hook-logger.sh +0 -89
- package/one/things/claude/hooks/lint-hook.sh +0 -140
- package/one/things/claude/hooks/notification-hook.sh +0 -204
- package/one/things/claude/hooks/ontology-validation-hook.sh +0 -86
- package/one/things/claude/hooks/performance-metrics.json +0 -25
- package/one/things/claude/hooks/security-hook.sh +0 -256
- package/one/things/claude/hooks/story-validation-hook-enhanced.sh +0 -210
- package/one/things/claude/hooks/story-validation-hook.sh +0 -145
- package/one/things/claude/hooks/test-hook.sh +0 -145
- package/one/things/claude/hooks/test-story-validation.sh +0 -170
- package/one/things/claude/settings-local.json +0 -86
- package/one/things/cli/cli-code.md +0 -677
- package/one/things/cli/cli-compiler-code.md +0 -677
- package/one/things/cli/cli.md +0 -871
- package/one/things/components/card-shadcn.md +0 -953
- package/one/things/components/card.md +0 -1041
- package/one/things/components.md +0 -1743
- package/one/things/componets.md +0 -19
- package/one/things/contracts/Move.toml +0 -12
- package/one/things/contracts/README.md +0 -288
- package/one/things/contracts/one.move +0 -762
- package/one/things/contracts/sdk.ts +0 -579
- package/one/things/creator-diagram.md +0 -184
- package/one/things/crypto/FEATURES.md +0 -78
- package/one/things/crypto/ONECORE.md +0 -62
- package/one/things/crypto/ONECOREFAQ.md +0 -22
- package/one/things/crypto/ONECOREHOW.md +0 -46
- package/one/things/crypto/ONEENTERPRISE.md +0 -64
- package/one/things/crypto/ONEENTERPRISEFAQ.md +0 -64
- package/one/things/crypto/ONEENTERPRISEHOW.md +0 -53
- package/one/things/crypto/ONEPRO.md +0 -60
- package/one/things/crypto/ONEPROFAQ.md +0 -22
- package/one/things/crypto/ONEPROHOW.md +0 -53
- package/one/things/crypto/READMEAGENCY.md +0 -64
- package/one/things/crypto/VSL.md +0 -45
- package/one/things/crypto/WebsiteCopy.md +0 -176
- package/one/things/demo-accessibility-animations.md +0 -1025
- package/one/things/demo-components.md +0 -1310
- package/one/things/demo-design-summary.md +0 -692
- package/one/things/demo-design-system.md +0 -973
- package/one/things/demo-page-layouts.md +0 -1016
- package/one/things/design-system.md +0 -832
- package/one/things/designs/accessibility-audit.md +0 -877
- package/one/things/designs/component-specifications.md +0 -855
- package/one/things/designs/design-overview.md +0 -377
- package/one/things/designs/design-tokens.md +0 -448
- package/one/things/designs/wireframes-dashboard.md +0 -710
- package/one/things/docs/api-requests.md +0 -987
- package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +0 -485
- package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +0 -465
- package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +0 -425
- package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +0 -451
- package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +0 -536
- package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +0 -650
- package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +0 -473
- package/one/things/docs/ecommerce/QUICK-START.md +0 -405
- package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +0 -567
- package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +0 -271
- package/one/things/docs/ecommerce/USAGE-EXAMPLE.astro +0 -171
- package/one/things/docs/ecommerce/demo.astro +0 -309
- package/one/things/examples/children/lemonade-stand.md +0 -404
- package/one/things/examples/enterprise/crm-saas.md +0 -1444
- package/one/things/features/1-1-agent-prompts.md +0 -562
- package/one/things/features/1-2-yaml-orchestrator.md +0 -548
- package/one/things/features/1-3-event-coordination.md +0 -547
- package/one/things/features/1-4-knowledge-management.md +0 -652
- package/one/things/features/1-5-quality-loops.md +0 -725
- package/one/things/features/1-6-numbering-structure.md +0 -639
- package/one/things/features/2-1-dataprovider-interface.md +0 -2583
- package/one/things/features/2-2-config-system.md +0 -3242
- package/one/things/features/2-3-effectts-services.md +0 -1645
- package/one/things/features/2-4-react-hooks.md +0 -2136
- package/one/things/features/2-5-auth-migration.md +0 -2144
- package/one/things/features/2-6-dashboard-migration.md +0 -2084
- package/one/things/features/2-7-alternative-providers.md +0 -2578
- package/one/things/features/2-7-implementation-report.md +0 -724
- package/one/things/features/2-cli.md +0 -1720
- package/one/things/features/2-design.md +0 -1770
- package/one/things/features/2-tests.md +0 -576
- package/one/things/features/AUTH_HOOKS_IMPLEMENTATION.md +0 -576
- package/one/things/features/DECOUPLING.md +0 -290
- package/one/things/features/DEPLOYMENT.md +0 -470
- package/one/things/features/IMPLEMENTATION_SUMMARY.md +0 -362
- package/one/things/features/improve.md +0 -861
- package/one/things/features/remove-convex-deps.md +0 -63
- package/one/things/features/top-features.md +0 -87
- package/one/things/features/use-one-backend.md +0 -1217
- package/one/things/features-in-english.md +0 -200
- package/one/things/files.yaml +0 -721
- package/one/things/ideas/1-create-workflow.md +0 -207
- package/one/things/ideas/2-backend-agnostic-frontend.md +0 -439
- package/one/things/implementation/backend-guide.md +0 -457
- package/one/things/interface.md +0 -257
- package/one/things/landing-page-implementation.md +0 -455
- package/one/things/legal/README.md +0 -234
- package/one/things/legal/privacy-policy.md +0 -1227
- package/one/things/legal/terms-of-service.md +0 -1432
- package/one/things/master-workflow-plan.md +0 -806
- package/one/things/pay.one.ie.md +0 -53
- package/one/things/plans/0-in-sync.md +0 -136
- package/one/things/plans/0-timeline.md +0 -36
- package/one/things/plans/1-create-workflow.md +0 -732
- package/one/things/plans/QUICK-START-SIMPLIFICATION.md +0 -333
- package/one/things/plans/README-SIMPLIFICATION.md +0 -349
- package/one/things/plans/SIMPLIFICATION-EXAMPLES.md +0 -16
- package/one/things/plans/SIMPLIFICATION-SUMMARY.md +0 -455
- package/one/things/plans/ai-elements-integration.md +0 -483
- package/one/things/plans/ai-elements.md +0 -1278
- package/one/things/plans/ai-integration-plan.md +0 -263
- package/one/things/plans/ai-integration.md +0 -996
- package/one/things/plans/ai-sdk.md +0 -798
- package/one/things/plans/ai-tools.md +0 -621
- package/one/things/plans/app.md +0 -832
- package/one/things/plans/architecture-summary.md +0 -312
- package/one/things/plans/async-ai-agents.md +0 -233
- package/one/things/plans/backend-agnostic-frontend.md +0 -390
- package/one/things/plans/backend-cleanup-quickstart.md +0 -380
- package/one/things/plans/backend-ontology-conformance.md +0 -475
- package/one/things/plans/backend-status.md +0 -599
- package/one/things/plans/backend-structure.md +0 -847
- package/one/things/plans/backend-target-structure.md +0 -482
- package/one/things/plans/backend.md +0 -1175
- package/one/things/plans/better-auth-any-backend-revised.md +0 -1103
- package/one/things/plans/better-auth-any-backend.md +0 -1896
- package/one/things/plans/better-auth-available-features.md +0 -273
- package/one/things/plans/big-plan.md +0 -52
- package/one/things/plans/cli-updates-required.md +0 -320
- package/one/things/plans/complete-step-by-step.md +0 -1409
- package/one/things/plans/components.md +0 -709
- package/one/things/plans/convex-agents.md +0 -1034
- package/one/things/plans/convex-better-auth.md +0 -1141
- package/one/things/plans/convex-on-off.md +0 -407
- package/one/things/plans/crypto-token-researcher.md +0 -629
- package/one/things/plans/data-quality-metrics.md +0 -745
- package/one/things/plans/deep-researcher-agent.md +0 -466
- package/one/things/plans/deploy-to-cloudflare.md +0 -623
- package/one/things/plans/deployment-architecture.md +0 -469
- package/one/things/plans/desktop.md +0 -1139
- package/one/things/plans/development-plan.md +0 -1283
- package/one/things/plans/development-workflow-tldr.md +0 -207
- package/one/things/plans/development-workflow.md +0 -959
- package/one/things/plans/dsl-claude-code.md +0 -1011
- package/one/things/plans/effect-components.md +0 -1743
- package/one/things/plans/effect-patterns-reference.md +0 -2235
- package/one/things/plans/effect.md +0 -1806
- package/one/things/plans/email.md +0 -966
- package/one/things/plans/enhance-auth.md +0 -1692
- package/one/things/plans/execution-strategy.md +0 -1291
- package/one/things/plans/existing-infrastructure.md +0 -712
- package/one/things/plans/feature-based-sites.md +0 -894
- package/one/things/plans/frontend-effects.md +0 -1276
- package/one/things/plans/group-folder-multi-tenancy.md +0 -893
- package/one/things/plans/improve-codebase.md +0 -1811
- package/one/things/plans/install-components.md +0 -215
- package/one/things/plans/integrate-frontend-and-backend.md +0 -603
- package/one/things/plans/landing.md +0 -820
- package/one/things/plans/layout.md +0 -249
- package/one/things/plans/mail-backend.md +0 -1361
- package/one/things/plans/mail.md +0 -2677
- package/one/things/plans/mcp-clear-context-prompt.md +0 -81
- package/one/things/plans/mcp-simple.md +0 -248
- package/one/things/plans/multi-ontology-architecture.md +0 -885
- package/one/things/plans/next-features.md +0 -114
- package/one/things/plans/npx-agent-safety.md +0 -785
- package/one/things/plans/npx-agent.md +0 -1089
- package/one/things/plans/onboarding.md +0 -51
- package/one/things/plans/one-protocol-and-payone-usage.md +0 -82
- package/one/things/plans/one.md +0 -677
- package/one/things/plans/ontology-6-dimensions.md +0 -2201
- package/one/things/plans/ontology-compliance-audit.md +0 -342
- package/one/things/plans/ontology-driven-strategy.md +0 -882
- package/one/things/plans/ontology-refine.md +0 -586
- package/one/things/plans/ontology-ui-approach.md +0 -375
- package/one/things/plans/open-agent.md +0 -840
- package/one/things/plans/performace.md +0 -122
- package/one/things/plans/phase-1-foundation.md +0 -620
- package/one/things/plans/phase-3-implementation.md +0 -1037
- package/one/things/plans/plan-connect-to-api.md +0 -146
- package/one/things/plans/quick-wins.md +0 -1428
- package/one/things/plans/r2.md +0 -777
- package/one/things/plans/readme-backend-cleanup.md +0 -402
- package/one/things/plans/release.md +0 -507
- package/one/things/plans/remove-backend-development-from-agents.md +0 -1331
- package/one/things/plans/repos.md +0 -98
- package/one/things/plans/separate-copy-2.md +0 -1349
- package/one/things/plans/separate-copy-3.md +0 -2479
- package/one/things/plans/separate-copy.md +0 -1349
- package/one/things/plans/separate-demo.md +0 -864
- package/one/things/plans/separate.md +0 -1999
- package/one/things/plans/sequence.md +0 -2040
- package/one/things/plans/shadcn-integration-summary.md +0 -510
- package/one/things/plans/sidebar.md +0 -206
- package/one/things/plans/skills.md +0 -709
- package/one/things/plans/small-fixes.md +0 -23
- package/one/things/plans/start-new.md +0 -764
- package/one/things/plans/switch-off-auth.md +0 -42
- package/one/things/plans/sync-checklist.md +0 -351
- package/one/things/plans/test-backend-connection.md +0 -514
- package/one/things/plans/unified-implementation-plan.md +0 -934
- package/one/things/plans/update-demos.md +0 -581
- package/one/things/plans/use-our-backend.md +0 -572
- package/one/things/plans/video-backend.md +0 -638
- package/one/things/plans/video-frontend.md +0 -490
- package/one/things/plans/video-old-archived.md +0 -656
- package/one/things/plans/wave1-onboarding-100-inferences.md +0 -1686
- package/one/things/plans/wave1-onboarding-vision.md +0 -744
- package/one/things/plans/wave1-orchestration-summary.md +0 -604
- package/one/things/plans/wave1-specialist-assignments.md +0 -1413
- package/one/things/plans/workflow-files.md +0 -1210
- package/one/things/plans/workflow.md +0 -1378
- package/one/things/plans-u.md +0 -905
- package/one/things/products/Blockchain Products.md +0 -6278
- package/one/things/products/cascade-landing-page.md +0 -841
- package/one/things/products/cascade.md +0 -1568
- package/one/things/products/context-engineering.md +0 -1488
- package/one/things/products/onthology.md +0 -15
- package/one/things/products/ontology-ui-shadcn.md +0 -1302
- package/one/things/products/ontology-ui.md +0 -1429
- package/one/things/products/ontology.md +0 -789
- package/one/things/products/sdk.md +0 -573
- package/one/things/promptkit.md +0 -930
- package/one/things/repos/all-repos.md +0 -0
- package/one/things/scripts-clean-mac.sh +0 -409
- package/one/things/service-providers-new.md +0 -1052
- package/one/things/service-providers.md +0 -1121
- package/one/things/structure.md +0 -532
- package/one/things/system.md +0 -618
- package/one/things/templates.md +0 -294
- package/one/things/tests/2-1-dataprovider-interface.md +0 -1216
- package/one/things/tests/2-1-test-analysis.md +0 -544
- package/one/things/things.md +0 -384
- package/one/things/todo-acp-integration.md +0 -744
- package/one/things/todo-ai.md +0 -933
- package/one/things/todo-api.md +0 -1078
- package/one/things/todo-assignment.md +0 -580
- package/one/things/todo-buy-chatgpt.md +0 -1450
- package/one/things/todo-components.md +0 -1683
- package/one/things/todo-connections.md +0 -278
- package/one/things/todo-ecommerce-frontend.md +0 -1313
- package/one/things/todo-ecommerce.md +0 -569
- package/one/things/todo-effects.md +0 -1075
- package/one/things/todo-frontend-effects.md +0 -977
- package/one/things/todo-landing-page.md +0 -1091
- package/one/things/todo-mail.md +0 -1160
- package/one/things/todo-master-plan.md +0 -490
- package/one/things/todo-onboard.md +0 -666
- package/one/things/todo-one-ie.md +0 -538
- package/one/things/todo-page.md +0 -606
- package/one/things/todo-plans.md +0 -282
- package/one/things/todo-projects.md +0 -241
- package/one/things/todo-refactoring-plan.md +0 -366
- package/one/things/todo-release.md +0 -654
- package/one/things/todo-sequence.md +0 -1621
- package/one/things/todo-use-our-backend.md +0 -1908
- package/one/things/todo-workflow.md +0 -626
- package/one/things/todo-x402.md +0 -2047
- package/one/things/todo.md +0 -21
- package/one/things/video/scripts-crypto.md +0 -835
- package/one/things/video-script-backup.md +0 -318
- package/one/things/video-script-demo.md +0 -382
- package/one/things/video-script-ontology.md +0 -333
- package/one/things/video-script.md +0 -361
|
@@ -1,2196 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Ontology Frontend Specifications
|
|
3
|
-
dimension: knowledge
|
|
4
|
-
category: ontology-frontend-specifications.md
|
|
5
|
-
tags: 6-dimensions, architecture, backend, frontend, ontology, ui
|
|
6
|
-
related_dimensions: events, groups, people
|
|
7
|
-
scope: global
|
|
8
|
-
created: 2025-11-03
|
|
9
|
-
updated: 2025-11-03
|
|
10
|
-
version: 1.0.0
|
|
11
|
-
ai_context: |
|
|
12
|
-
This document is part of the knowledge dimension in the ontology-frontend-specifications.md category.
|
|
13
|
-
Location: one/knowledge/ontology-frontend-specifications.md
|
|
14
|
-
Purpose: Documents one ontology: frontend implementation guide
|
|
15
|
-
Related dimensions: events, groups, people
|
|
16
|
-
For AI agents: Read this to understand ontology frontend specifications.
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
# ONE Ontology: Frontend Implementation Guide
|
|
20
|
-
|
|
21
|
-
**Building /frontend/* - The Rendering Layer**
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Executive Summary
|
|
26
|
-
|
|
27
|
-
The frontend is **purely a rendering and interaction layer**. It has ZERO business logic, ZERO database access, ZERO data validation. It only:
|
|
28
|
-
|
|
29
|
-
1. **Renders UI** from data
|
|
30
|
-
2. **Calls backend APIs** via abstract data providers
|
|
31
|
-
3. **Manages local UI state** (loading, errors, forms)
|
|
32
|
-
4. **Displays real-time updates** via subscriptions
|
|
33
|
-
|
|
34
|
-
**Backend-Agnostic Architecture:**
|
|
35
|
-
```
|
|
36
|
-
┌────────────────────────────────────────────────────────┐
|
|
37
|
-
│ FRONTEND (Astro + React) │
|
|
38
|
-
│ ✅ Renders HTML/React components │
|
|
39
|
-
│ ✅ Calls DataProvider interface │
|
|
40
|
-
│ ✅ Manages UI state only │
|
|
41
|
-
│ ✅ Displays data from any backend │
|
|
42
|
-
│ ❌ NO database access │
|
|
43
|
-
│ ❌ NO business logic │
|
|
44
|
-
│ ❌ NO data validation │
|
|
45
|
-
│ ❌ NO event logging │
|
|
46
|
-
└──────────────────────┬─────────────────────────────────┘
|
|
47
|
-
│ DataProvider Interface
|
|
48
|
-
│ (Ontology = Universal API)
|
|
49
|
-
↓
|
|
50
|
-
┌────────────────────────────────────────────────────────┐
|
|
51
|
-
│ BACKEND PROVIDERS (Choose One) │
|
|
52
|
-
│ │
|
|
53
|
-
│ ├─ ConvexProvider → Convex backend │
|
|
54
|
-
│ ├─ WordPressProvider → WordPress + WooCommerce │
|
|
55
|
-
│ ├─ NotionProvider → Notion databases │
|
|
56
|
-
│ ├─ SupabaseProvider → Supabase PostgreSQL │
|
|
57
|
-
│ ├─ StrapiProvider → Strapi CMS │
|
|
58
|
-
│ └─ CustomProvider → Your own API │
|
|
59
|
-
│ │
|
|
60
|
-
│ All providers implement the same interface: │
|
|
61
|
-
│ - organizations: { get, list, update } │
|
|
62
|
-
│ - people: { get, list, create, update, delete } │
|
|
63
|
-
│ - things: { get, list, create, update, delete } │
|
|
64
|
-
│ - connections: { create, getRelated, getCount } │
|
|
65
|
-
│ - events: { log, query } │
|
|
66
|
-
│ - knowledge: { embed, search } │
|
|
67
|
-
└────────────────────────────────────────────────────────┘
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
**Key Insight:** The ONE 6-dimension ontology becomes a **universal data API**. Frontend doesn't care if data comes from Convex, WordPress, or Notion—it only knows the 6 dimensions.
|
|
71
|
-
|
|
72
|
-
**What Frontend Builds:**
|
|
73
|
-
- 66 thing types → 198 UI components (card, list, detail per type)
|
|
74
|
-
- 25 connection types → 75 relationship UIs
|
|
75
|
-
- Organizations → Multi-tenant websites at `{slug}.one.ie`
|
|
76
|
-
|
|
77
|
-
**Tech Stack:**
|
|
78
|
-
- **Astro** - SSR/SSG (pages, layouts)
|
|
79
|
-
- **React 19** - Interactive components
|
|
80
|
-
- **Effect.ts** - Type-safe, composable data operations
|
|
81
|
-
- **DataProvider Pattern** - Backend-agnostic interface (inspired by Astro's content layer)
|
|
82
|
-
- **Tailwind + shadcn/ui** - Styling
|
|
83
|
-
- **TypeScript** - Type safety
|
|
84
|
-
|
|
85
|
-
**Architecture Philosophy:**
|
|
86
|
-
|
|
87
|
-
1. **Backend-Agnostic**
|
|
88
|
-
- Frontend talks to `DataProvider` interface, not specific backends
|
|
89
|
-
- Swap backends by changing ONE line in config
|
|
90
|
-
- Ontology = universal API that works with ANY backend
|
|
91
|
-
|
|
92
|
-
2. **Provider Pattern**
|
|
93
|
-
- `ConvexProvider`, `WordPressProvider`, `NotionProvider`, etc.
|
|
94
|
-
- Each provider translates ontology operations → backend-specific calls
|
|
95
|
-
- Organizations can use their existing infrastructure
|
|
96
|
-
|
|
97
|
-
3. **Generic Services**
|
|
98
|
-
- `ThingService` + `ConnectionService` handle ALL 66 thing types
|
|
99
|
-
- No specialized services needed (courses, products, lessons are all things)
|
|
100
|
-
- Add convenience wrappers only when you repeat patterns 3+ times
|
|
101
|
-
|
|
102
|
-
---
|
|
103
|
-
|
|
104
|
-
## Table of Contents
|
|
105
|
-
|
|
106
|
-
1. [What Frontend IS and IS NOT](#what-frontend-is-and-is-not)
|
|
107
|
-
2. [Frontend File Structure](#frontend-file-structure)
|
|
108
|
-
3. [Backend-Agnostic Data Layer](#backend-agnostic-data-layer)
|
|
109
|
-
4. [DataProvider Interface](#dataprovider-interface)
|
|
110
|
-
5. [Provider Implementations](#provider-implementations)
|
|
111
|
-
6. [Configuration (Astro-Style)](#configuration-astro-style)
|
|
112
|
-
7. [Ontology Config (Display Only)](#ontology-config-display-only)
|
|
113
|
-
8. [Effect.ts Service Layer](#effectts-service-layer)
|
|
114
|
-
9. [React Integration (useEffectRunner)](#react-integration-useeffectrunner)
|
|
115
|
-
10. [Component Patterns](#component-patterns)
|
|
116
|
-
11. [Page Patterns (SSR)](#page-patterns-ssr)
|
|
117
|
-
12. [Real-Time Components](#real-time-components)
|
|
118
|
-
13. [Forms (Calls Backend)](#forms-calls-backend)
|
|
119
|
-
14. [Multi-Tenant Routing](#multi-tenant-routing)
|
|
120
|
-
15. [Deployment](#deployment)
|
|
121
|
-
|
|
122
|
-
---
|
|
123
|
-
|
|
124
|
-
## What Frontend IS and IS NOT
|
|
125
|
-
|
|
126
|
-
### ✅ Frontend IS Responsible For:
|
|
127
|
-
|
|
128
|
-
**1. Rendering**
|
|
129
|
-
```tsx
|
|
130
|
-
// Display data from backend
|
|
131
|
-
<h1>{course.name}</h1>
|
|
132
|
-
<p>{course.properties.description}</p>
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
**2. Calling Backend APIs**
|
|
136
|
-
```tsx
|
|
137
|
-
// Get data from backend
|
|
138
|
-
const courses = useQuery(api.queries.things.list, { type: 'course' })
|
|
139
|
-
|
|
140
|
-
// Send data to backend
|
|
141
|
-
const create = useMutation(api.mutations.things.create)
|
|
142
|
-
await create({ type: 'course', name: 'Fitness 101', properties: {...} })
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
**3. Managing UI State**
|
|
146
|
-
```tsx
|
|
147
|
-
const [loading, setLoading] = useState(false)
|
|
148
|
-
const [error, setError] = useState(null)
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
**4. User Interactions**
|
|
152
|
-
```tsx
|
|
153
|
-
<button onClick={handleClick}>Create Course</button>
|
|
154
|
-
<input onChange={handleChange} />
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
**5. Client-Side Routing**
|
|
158
|
-
```tsx
|
|
159
|
-
// Navigate between pages
|
|
160
|
-
<Link href="/courses">View Courses</Link>
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
### ❌ Frontend IS NOT Responsible For:
|
|
164
|
-
|
|
165
|
-
**1. Database Operations**
|
|
166
|
-
```tsx
|
|
167
|
-
// ❌ NEVER do this in frontend
|
|
168
|
-
const courses = await db.query('things').filter(...).collect()
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
**2. Business Logic**
|
|
172
|
-
```tsx
|
|
173
|
-
// ❌ NEVER do this in frontend
|
|
174
|
-
if (user.tokens < course.price) {
|
|
175
|
-
// Calculate discount, check quotas, etc.
|
|
176
|
-
}
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
**3. Data Validation**
|
|
180
|
-
```tsx
|
|
181
|
-
// ❌ NEVER trust frontend validation alone
|
|
182
|
-
if (formData.email.includes('@')) {
|
|
183
|
-
// Backend MUST validate, frontend only for UX
|
|
184
|
-
}
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
**4. Event Logging**
|
|
188
|
-
```tsx
|
|
189
|
-
// ❌ NEVER log events in frontend
|
|
190
|
-
await db.insert('events', { type: 'course_created', ... })
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
**5. Authorization**
|
|
194
|
-
```tsx
|
|
195
|
-
// ❌ NEVER check permissions in frontend alone
|
|
196
|
-
if (user.role === 'admin') {
|
|
197
|
-
// Backend MUST authorize, frontend only for UI hints
|
|
198
|
-
}
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
---
|
|
202
|
-
|
|
203
|
-
## Frontend File Structure
|
|
204
|
-
|
|
205
|
-
```
|
|
206
|
-
frontend/ # Frontend repo (separate from backend)
|
|
207
|
-
├── src/
|
|
208
|
-
│ ├── pages/ # Astro pages (SSR/SSG)
|
|
209
|
-
│ │ ├── index.astro # Homepage
|
|
210
|
-
│ │ ├── courses/
|
|
211
|
-
│ │ │ ├── index.astro # Course list (SSR)
|
|
212
|
-
│ │ │ └── [id].astro # Course detail (SSR)
|
|
213
|
-
│ │ └── [thingType]/ # Dynamic routes
|
|
214
|
-
│ │ ├── index.astro # Generic list page
|
|
215
|
-
│ │ └── [id].astro # Generic detail page
|
|
216
|
-
│ ├── components/ # React components
|
|
217
|
-
│ │ ├── cards/
|
|
218
|
-
│ │ │ └── ThingCard.tsx # Generic card (adapts to any type)
|
|
219
|
-
│ │ ├── lists/
|
|
220
|
-
│ │ │ └── ThingList.tsx # Generic list
|
|
221
|
-
│ │ ├── forms/
|
|
222
|
-
│ │ │ └── ThingForm.tsx # Generic form (calls backend)
|
|
223
|
-
│ │ └── ui/ # shadcn/ui components
|
|
224
|
-
│ ├── services/ # Effect.ts client services
|
|
225
|
-
│ │ ├── ConvexHttpClient.ts # Convex client wrapper (required)
|
|
226
|
-
│ │ ├── ThingClientService.ts # Thing operations (required)
|
|
227
|
-
│ │ ├── ConnectionClientService.ts # Connection operations (required)
|
|
228
|
-
│ │ ├── ClientLayer.ts # Dependency injection layer (required)
|
|
229
|
-
│ │ └── CourseClientService.ts # OPTIONAL: Course-specific convenience
|
|
230
|
-
│ ├── hooks/ # React hooks
|
|
231
|
-
│ │ └── useEffectRunner.ts # Run Effect programs in React
|
|
232
|
-
│ ├── layouts/
|
|
233
|
-
│ │ └── Layout.astro # Main layout
|
|
234
|
-
│ ├── ontology/ # Display config ONLY
|
|
235
|
-
│ │ ├── types.ts # Type definitions (synced from backend)
|
|
236
|
-
│ │ └── config.ts # UI display config (colors, icons, labels)
|
|
237
|
-
│ ├── lib/
|
|
238
|
-
│ │ └── convex.ts # Backend client setup
|
|
239
|
-
│ └── middleware.ts # Multi-tenant routing
|
|
240
|
-
├── .env
|
|
241
|
-
│ PUBLIC_CONVEX_URL=https://backend.convex.cloud # Backend URL
|
|
242
|
-
└── package.json
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
**Key Point:** Frontend has NO `convex/` directory. Backend-specific code lives in provider implementations.
|
|
246
|
-
|
|
247
|
-
---
|
|
248
|
-
|
|
249
|
-
## Backend-Agnostic Data Layer
|
|
250
|
-
|
|
251
|
-
**Inspired by Astro's Content Layer Pattern**
|
|
252
|
-
|
|
253
|
-
Astro elegantly abstracts content sources via a universal interface:
|
|
254
|
-
|
|
255
|
-
```typescript
|
|
256
|
-
// astro.config.ts
|
|
257
|
-
import { defineConfig } from 'astro/config'
|
|
258
|
-
import { glob } from 'astro/loaders'
|
|
259
|
-
|
|
260
|
-
export default defineConfig({
|
|
261
|
-
collections: {
|
|
262
|
-
blog: {
|
|
263
|
-
loader: glob({ pattern: '**/*.md', base: './src/content/blog' })
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
})
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
ONE applies this pattern to **data operations**:
|
|
270
|
-
|
|
271
|
-
```typescript
|
|
272
|
-
// frontend/astro.config.ts
|
|
273
|
-
import { defineConfig } from 'astro/config'
|
|
274
|
-
import { convexProvider } from './src/providers/convex'
|
|
275
|
-
// import { wordpressProvider } from './src/providers/wordpress'
|
|
276
|
-
// import { notionProvider } from './src/providers/notion'
|
|
277
|
-
|
|
278
|
-
export default defineConfig({
|
|
279
|
-
integrations: [
|
|
280
|
-
one({
|
|
281
|
-
// ✅ Change this ONE line to swap backends
|
|
282
|
-
provider: convexProvider({
|
|
283
|
-
url: import.meta.env.PUBLIC_BACKEND_URL
|
|
284
|
-
})
|
|
285
|
-
|
|
286
|
-
// Or use WordPress:
|
|
287
|
-
// provider: wordpressProvider({
|
|
288
|
-
// url: 'https://yoursite.com',
|
|
289
|
-
// apiKey: import.meta.env.WORDPRESS_API_KEY
|
|
290
|
-
// })
|
|
291
|
-
|
|
292
|
-
// Or use Notion:
|
|
293
|
-
// provider: notionProvider({
|
|
294
|
-
// apiKey: import.meta.env.NOTION_API_KEY,
|
|
295
|
-
// databaseId: import.meta.env.NOTION_DB_ID
|
|
296
|
-
// })
|
|
297
|
-
})
|
|
298
|
-
]
|
|
299
|
-
})
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
**Key Principle:** Frontend components never know which backend they're talking to.
|
|
303
|
-
|
|
304
|
-
---
|
|
305
|
-
|
|
306
|
-
## DataProvider Interface
|
|
307
|
-
|
|
308
|
-
**The universal ontology API.**
|
|
309
|
-
|
|
310
|
-
```typescript
|
|
311
|
-
// frontend/src/providers/DataProvider.ts
|
|
312
|
-
import { Effect } from 'effect'
|
|
313
|
-
|
|
314
|
-
// Error types (universal across all providers)
|
|
315
|
-
export class ThingNotFoundError {
|
|
316
|
-
readonly _tag = 'ThingNotFoundError'
|
|
317
|
-
constructor(readonly thingId: string) {}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
export class ConnectionCreateError {
|
|
321
|
-
readonly _tag = 'ConnectionCreateError'
|
|
322
|
-
constructor(readonly reason: string) {}
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
export class UnauthorizedError {
|
|
326
|
-
readonly _tag = 'UnauthorizedError'
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
export class GroupNotFoundError {
|
|
330
|
-
readonly _tag = 'GroupNotFoundError'
|
|
331
|
-
constructor(readonly groupId: string) {}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
export class PersonNotFoundError {
|
|
335
|
-
readonly _tag = 'PersonNotFoundError'
|
|
336
|
-
constructor(readonly personId: string) {}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
export class PersonCreateError {
|
|
340
|
-
readonly _tag = 'PersonCreateError'
|
|
341
|
-
constructor(readonly reason: string) {}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// Type definitions for 6 dimensions
|
|
345
|
-
export interface Group {
|
|
346
|
-
_id: string
|
|
347
|
-
slug: string
|
|
348
|
-
name: string
|
|
349
|
-
type: 'friend_circle' | 'business' | 'community' | 'dao' | 'government' | 'organization'
|
|
350
|
-
parentGroupId?: string
|
|
351
|
-
description?: string
|
|
352
|
-
status: 'active' | 'archived'
|
|
353
|
-
settings: {
|
|
354
|
-
visibility: 'public' | 'private'
|
|
355
|
-
joinPolicy: 'open' | 'invite_only' | 'approval_required'
|
|
356
|
-
plan?: 'starter' | 'pro' | 'enterprise'
|
|
357
|
-
}
|
|
358
|
-
createdAt: number
|
|
359
|
-
updatedAt: number
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
export interface Person {
|
|
363
|
-
_id: string
|
|
364
|
-
email: string
|
|
365
|
-
username: string
|
|
366
|
-
displayName: string
|
|
367
|
-
emailVerified: boolean
|
|
368
|
-
role: 'platform_owner' | 'group_owner' | 'group_user' | 'customer'
|
|
369
|
-
groupId?: string
|
|
370
|
-
groups: string[] // All groups this person belongs to
|
|
371
|
-
permissions?: string[]
|
|
372
|
-
image?: string
|
|
373
|
-
bio?: string
|
|
374
|
-
createdAt: number
|
|
375
|
-
updatedAt: number
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
// DataProvider interface (every backend must implement this)
|
|
379
|
-
export interface DataProvider {
|
|
380
|
-
// Dimension 1: Groups operations
|
|
381
|
-
groups: {
|
|
382
|
-
get: (id: string) => Effect.Effect<Group, GroupNotFoundError>
|
|
383
|
-
list: (params: {
|
|
384
|
-
status?: 'active' | 'archived'
|
|
385
|
-
limit?: number
|
|
386
|
-
}) => Effect.Effect<Group[], Error>
|
|
387
|
-
update: (id: string, updates: Partial<Group>) => Effect.Effect<void, Error>
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
// Dimension 2: People operations
|
|
391
|
-
people: {
|
|
392
|
-
get: (id: string) => Effect.Effect<Person, PersonNotFoundError | UnauthorizedError>
|
|
393
|
-
list: (params: {
|
|
394
|
-
groupId?: string
|
|
395
|
-
role?: 'platform_owner' | 'group_owner' | 'group_user' | 'customer'
|
|
396
|
-
filters?: Record<string, any>
|
|
397
|
-
limit?: number
|
|
398
|
-
}) => Effect.Effect<Person[], Error>
|
|
399
|
-
create: (input: {
|
|
400
|
-
email: string
|
|
401
|
-
displayName: string
|
|
402
|
-
role: 'platform_owner' | 'group_owner' | 'group_user' | 'customer'
|
|
403
|
-
groupId: string
|
|
404
|
-
password?: string
|
|
405
|
-
}) => Effect.Effect<string, PersonCreateError>
|
|
406
|
-
update: (id: string, updates: Partial<Person>) => Effect.Effect<void, Error>
|
|
407
|
-
delete: (id: string) => Effect.Effect<void, Error>
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
// Dimension 3: Things operations
|
|
411
|
-
things: {
|
|
412
|
-
get: (id: string) => Effect.Effect<Thing, ThingNotFoundError | UnauthorizedError>
|
|
413
|
-
list: (params: {
|
|
414
|
-
type: ThingType
|
|
415
|
-
groupId?: string
|
|
416
|
-
filters?: Record<string, any>
|
|
417
|
-
limit?: number
|
|
418
|
-
}) => Effect.Effect<Thing[], Error>
|
|
419
|
-
create: (input: {
|
|
420
|
-
type: ThingType
|
|
421
|
-
name: string
|
|
422
|
-
groupId: string
|
|
423
|
-
properties: Record<string, any>
|
|
424
|
-
}) => Effect.Effect<string, ThingCreateError>
|
|
425
|
-
update: (id: string, updates: Partial<Thing>) => Effect.Effect<void, Error>
|
|
426
|
-
delete: (id: string) => Effect.Effect<void, Error>
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
// Dimension 4: Connections operations
|
|
430
|
-
connections: {
|
|
431
|
-
create: (input: {
|
|
432
|
-
fromThingId: string
|
|
433
|
-
toThingId: string
|
|
434
|
-
relationshipType: ConnectionType
|
|
435
|
-
metadata?: Record<string, any>
|
|
436
|
-
}) => Effect.Effect<string, ConnectionCreateError>
|
|
437
|
-
getRelated: (params: {
|
|
438
|
-
thingId: string
|
|
439
|
-
relationshipType: ConnectionType
|
|
440
|
-
direction: 'from' | 'to' | 'both'
|
|
441
|
-
}) => Effect.Effect<Thing[], Error>
|
|
442
|
-
getCount: (thingId: string, relationshipType: ConnectionType) => Effect.Effect<number, Error>
|
|
443
|
-
delete: (id: string) => Effect.Effect<void, Error>
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
// Dimension 5: Events operations
|
|
447
|
-
events: {
|
|
448
|
-
log: (event: {
|
|
449
|
-
type: EventType
|
|
450
|
-
actorId: string // Person ID (who did it)
|
|
451
|
-
targetId?: string // Thing/Person/Connection ID (what was acted upon)
|
|
452
|
-
groupId: string // Group scope
|
|
453
|
-
metadata?: Record<string, any>
|
|
454
|
-
}) => Effect.Effect<void, Error>
|
|
455
|
-
query: (params: {
|
|
456
|
-
type?: EventType
|
|
457
|
-
actorId?: string // Person ID
|
|
458
|
-
targetId?: string
|
|
459
|
-
groupId?: string
|
|
460
|
-
from?: Date
|
|
461
|
-
to?: Date
|
|
462
|
-
}) => Effect.Effect<Event[], Error>
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
// Dimension 6: Knowledge operations
|
|
466
|
-
knowledge: {
|
|
467
|
-
embed: (params: {
|
|
468
|
-
text: string
|
|
469
|
-
sourceThingId?: string // Thing ID
|
|
470
|
-
sourcePersonId?: string // Person ID
|
|
471
|
-
groupId: string
|
|
472
|
-
labels?: string[]
|
|
473
|
-
}) => Effect.Effect<string, Error>
|
|
474
|
-
search: (params: {
|
|
475
|
-
query: string
|
|
476
|
-
groupId?: string
|
|
477
|
-
limit?: number
|
|
478
|
-
}) => Effect.Effect<KnowledgeMatch[], Error>
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
// Real-time subscriptions (optional - not all backends support this)
|
|
482
|
-
subscriptions?: {
|
|
483
|
-
watchThing: (id: string) => Effect.Effect<Observable<Thing>, Error>
|
|
484
|
-
watchList: (type: ThingType, groupId?: string) => Effect.Effect<Observable<Thing[]>, Error>
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
```
|
|
488
|
-
|
|
489
|
-
**Key Insight:** This interface IS the ONE 6-dimension ontology. Any backend that implements this interface can power ONE—Organizations partition, People authorize, Things exist, Connections relate, Events record, Knowledge understands.
|
|
490
|
-
|
|
491
|
-
---
|
|
492
|
-
|
|
493
|
-
## Provider Implementations
|
|
494
|
-
|
|
495
|
-
### Convex Provider
|
|
496
|
-
|
|
497
|
-
```typescript
|
|
498
|
-
// frontend/src/providers/convex/ConvexProvider.ts
|
|
499
|
-
import { Effect, Layer } from 'effect'
|
|
500
|
-
import { ConvexHttpClient } from 'convex/browser'
|
|
501
|
-
import { DataProvider } from '../DataProvider'
|
|
502
|
-
import { api } from './api'
|
|
503
|
-
|
|
504
|
-
export class ConvexProvider implements DataProvider {
|
|
505
|
-
constructor(private client: ConvexHttpClient) {}
|
|
506
|
-
|
|
507
|
-
things = {
|
|
508
|
-
get: (id: string) =>
|
|
509
|
-
Effect.gen(function* () {
|
|
510
|
-
const thing = yield* Effect.tryPromise({
|
|
511
|
-
try: () => this.client.query(api.queries.things.get, { id }),
|
|
512
|
-
catch: (error) => new Error(String(error))
|
|
513
|
-
})
|
|
514
|
-
|
|
515
|
-
if (!thing) {
|
|
516
|
-
return yield* Effect.fail(new ThingNotFoundError(id))
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
return thing
|
|
520
|
-
}),
|
|
521
|
-
|
|
522
|
-
list: (params) =>
|
|
523
|
-
Effect.tryPromise({
|
|
524
|
-
try: () => this.client.query(api.queries.things.list, params),
|
|
525
|
-
catch: (error) => new Error(String(error))
|
|
526
|
-
}),
|
|
527
|
-
|
|
528
|
-
create: (input) =>
|
|
529
|
-
Effect.tryPromise({
|
|
530
|
-
try: () => this.client.mutation(api.mutations.things.create, input),
|
|
531
|
-
catch: (error) => new ConnectionCreateError(String(error))
|
|
532
|
-
}),
|
|
533
|
-
|
|
534
|
-
update: (id, updates) =>
|
|
535
|
-
Effect.tryPromise({
|
|
536
|
-
try: () => this.client.mutation(api.mutations.things.update, { id, updates }),
|
|
537
|
-
catch: (error) => new Error(String(error))
|
|
538
|
-
}),
|
|
539
|
-
|
|
540
|
-
delete: (id) =>
|
|
541
|
-
Effect.tryPromise({
|
|
542
|
-
try: () => this.client.mutation(api.mutations.things.delete, { id }),
|
|
543
|
-
catch: (error) => new Error(String(error))
|
|
544
|
-
})
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
connections = {
|
|
548
|
-
// Similar implementation for connections...
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
events = {
|
|
552
|
-
// Similar implementation for events...
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
knowledge = {
|
|
556
|
-
// Similar implementation for knowledge...
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
// Factory function
|
|
561
|
-
export function convexProvider(config: { url: string }) {
|
|
562
|
-
return Layer.succeed(
|
|
563
|
-
DataProvider,
|
|
564
|
-
new ConvexProvider(new ConvexHttpClient(config.url))
|
|
565
|
-
)
|
|
566
|
-
}
|
|
567
|
-
```
|
|
568
|
-
|
|
569
|
-
### WordPress Provider
|
|
570
|
-
|
|
571
|
-
```typescript
|
|
572
|
-
// frontend/src/providers/wordpress/WordPressProvider.ts
|
|
573
|
-
import { Effect, Layer } from 'effect'
|
|
574
|
-
import { DataProvider } from '../DataProvider'
|
|
575
|
-
|
|
576
|
-
export class WordPressProvider implements DataProvider {
|
|
577
|
-
constructor(
|
|
578
|
-
private baseUrl: string,
|
|
579
|
-
private apiKey: string
|
|
580
|
-
) {}
|
|
581
|
-
|
|
582
|
-
things = {
|
|
583
|
-
get: (id: string) =>
|
|
584
|
-
Effect.gen(function* () {
|
|
585
|
-
// Map ONE ontology → WordPress REST API
|
|
586
|
-
const response = yield* Effect.tryPromise({
|
|
587
|
-
try: () =>
|
|
588
|
-
fetch(`${this.baseUrl}/wp-json/wp/v2/posts/${id}`, {
|
|
589
|
-
headers: { Authorization: `Bearer ${this.apiKey}` }
|
|
590
|
-
}),
|
|
591
|
-
catch: (error) => new Error(String(error))
|
|
592
|
-
})
|
|
593
|
-
|
|
594
|
-
if (!response.ok) {
|
|
595
|
-
return yield* Effect.fail(new ThingNotFoundError(id))
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
const post = yield* Effect.tryPromise({
|
|
599
|
-
try: () => response.json(),
|
|
600
|
-
catch: (error) => new Error(String(error))
|
|
601
|
-
})
|
|
602
|
-
|
|
603
|
-
// Transform WordPress post → ONE thing
|
|
604
|
-
return {
|
|
605
|
-
_id: post.id.toString(),
|
|
606
|
-
type: 'post' as ThingType,
|
|
607
|
-
name: post.title.rendered,
|
|
608
|
-
properties: {
|
|
609
|
-
content: post.content.rendered,
|
|
610
|
-
excerpt: post.excerpt.rendered,
|
|
611
|
-
author: post.author,
|
|
612
|
-
publishedAt: post.date
|
|
613
|
-
},
|
|
614
|
-
status: post.status,
|
|
615
|
-
createdAt: new Date(post.date).getTime(),
|
|
616
|
-
updatedAt: new Date(post.modified).getTime()
|
|
617
|
-
}
|
|
618
|
-
}),
|
|
619
|
-
|
|
620
|
-
list: (params) =>
|
|
621
|
-
Effect.gen(function* () {
|
|
622
|
-
// Map ONE list query → WordPress REST API query
|
|
623
|
-
const query = new URLSearchParams({
|
|
624
|
-
per_page: String(params.limit || 10),
|
|
625
|
-
// Map ontology filters → WordPress query params
|
|
626
|
-
})
|
|
627
|
-
|
|
628
|
-
const response = yield* Effect.tryPromise({
|
|
629
|
-
try: () =>
|
|
630
|
-
fetch(`${this.baseUrl}/wp-json/wp/v2/posts?${query}`, {
|
|
631
|
-
headers: { Authorization: `Bearer ${this.apiKey}` }
|
|
632
|
-
}),
|
|
633
|
-
catch: (error) => new Error(String(error))
|
|
634
|
-
})
|
|
635
|
-
|
|
636
|
-
const posts = yield* Effect.tryPromise({
|
|
637
|
-
try: () => response.json(),
|
|
638
|
-
catch: (error) => new Error(String(error))
|
|
639
|
-
})
|
|
640
|
-
|
|
641
|
-
// Transform WordPress posts → ONE things
|
|
642
|
-
return posts.map((post: any) => ({
|
|
643
|
-
_id: post.id.toString(),
|
|
644
|
-
type: 'post' as ThingType,
|
|
645
|
-
name: post.title.rendered,
|
|
646
|
-
properties: {
|
|
647
|
-
content: post.content.rendered,
|
|
648
|
-
excerpt: post.excerpt.rendered
|
|
649
|
-
},
|
|
650
|
-
status: post.status,
|
|
651
|
-
createdAt: new Date(post.date).getTime(),
|
|
652
|
-
updatedAt: new Date(post.modified).getTime()
|
|
653
|
-
}))
|
|
654
|
-
}),
|
|
655
|
-
|
|
656
|
-
create: (input) =>
|
|
657
|
-
Effect.gen(function* () {
|
|
658
|
-
// Map ONE create → WordPress create post
|
|
659
|
-
const response = yield* Effect.tryPromise({
|
|
660
|
-
try: () =>
|
|
661
|
-
fetch(`${this.baseUrl}/wp-json/wp/v2/posts`, {
|
|
662
|
-
method: 'POST',
|
|
663
|
-
headers: {
|
|
664
|
-
'Content-Type': 'application/json',
|
|
665
|
-
Authorization: `Bearer ${this.apiKey}`
|
|
666
|
-
},
|
|
667
|
-
body: JSON.stringify({
|
|
668
|
-
title: input.name,
|
|
669
|
-
content: input.properties.content || '',
|
|
670
|
-
status: 'draft'
|
|
671
|
-
})
|
|
672
|
-
}),
|
|
673
|
-
catch: (error) => new ConnectionCreateError(String(error))
|
|
674
|
-
})
|
|
675
|
-
|
|
676
|
-
const post = yield* Effect.tryPromise({
|
|
677
|
-
try: () => response.json(),
|
|
678
|
-
catch: (error) => new ConnectionCreateError(String(error))
|
|
679
|
-
})
|
|
680
|
-
|
|
681
|
-
return post.id.toString()
|
|
682
|
-
}),
|
|
683
|
-
|
|
684
|
-
update: (id, updates) => {
|
|
685
|
-
// Similar WordPress update implementation
|
|
686
|
-
},
|
|
687
|
-
|
|
688
|
-
delete: (id) => {
|
|
689
|
-
// Similar WordPress delete implementation
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
connections = {
|
|
694
|
-
// WordPress doesn't have native connections
|
|
695
|
-
// Could use:
|
|
696
|
-
// - Post relationships (parent/child)
|
|
697
|
-
// - Categories/tags as connections
|
|
698
|
-
// - Custom post meta
|
|
699
|
-
// - Custom tables
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
events = {
|
|
703
|
-
// Log to WordPress activity log or custom table
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
knowledge = {
|
|
707
|
-
// Could integrate with:
|
|
708
|
-
// - Elasticsearch
|
|
709
|
-
// - Algolia
|
|
710
|
-
// - Custom vector search
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
// Factory function
|
|
715
|
-
export function wordpressProvider(config: { url: string; apiKey: string }) {
|
|
716
|
-
return Layer.succeed(
|
|
717
|
-
DataProvider,
|
|
718
|
-
new WordPressProvider(config.url, config.apiKey)
|
|
719
|
-
)
|
|
720
|
-
}
|
|
721
|
-
```
|
|
722
|
-
|
|
723
|
-
### Notion Provider
|
|
724
|
-
|
|
725
|
-
```typescript
|
|
726
|
-
// frontend/src/providers/notion/NotionProvider.ts
|
|
727
|
-
import { Effect, Layer } from 'effect'
|
|
728
|
-
import { Client } from '@notionhq/client'
|
|
729
|
-
import { DataProvider } from '../DataProvider'
|
|
730
|
-
|
|
731
|
-
export class NotionProvider implements DataProvider {
|
|
732
|
-
private notion: Client
|
|
733
|
-
|
|
734
|
-
constructor(apiKey: string, private databaseId: string) {
|
|
735
|
-
this.notion = new Client({ auth: apiKey })
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
things = {
|
|
739
|
-
get: (id: string) =>
|
|
740
|
-
Effect.gen(function* () {
|
|
741
|
-
// Map ONE thing → Notion page
|
|
742
|
-
const page = yield* Effect.tryPromise({
|
|
743
|
-
try: () => this.notion.pages.retrieve({ page_id: id }),
|
|
744
|
-
catch: (error) => new Error(String(error))
|
|
745
|
-
})
|
|
746
|
-
|
|
747
|
-
// Transform Notion page → ONE thing
|
|
748
|
-
return {
|
|
749
|
-
_id: page.id,
|
|
750
|
-
type: 'document' as ThingType,
|
|
751
|
-
name: (page.properties.Name as any).title[0]?.plain_text || '',
|
|
752
|
-
properties: {
|
|
753
|
-
// Map Notion properties → ONE properties
|
|
754
|
-
},
|
|
755
|
-
status: 'active',
|
|
756
|
-
createdAt: new Date(page.created_time).getTime(),
|
|
757
|
-
updatedAt: new Date(page.last_edited_time).getTime()
|
|
758
|
-
}
|
|
759
|
-
}),
|
|
760
|
-
|
|
761
|
-
list: (params) =>
|
|
762
|
-
Effect.gen(function* () {
|
|
763
|
-
// Map ONE list query → Notion database query
|
|
764
|
-
const response = yield* Effect.tryPromise({
|
|
765
|
-
try: () =>
|
|
766
|
-
this.notion.databases.query({
|
|
767
|
-
database_id: this.databaseId,
|
|
768
|
-
page_size: params.limit || 10
|
|
769
|
-
}),
|
|
770
|
-
catch: (error) => new Error(String(error))
|
|
771
|
-
})
|
|
772
|
-
|
|
773
|
-
// Transform Notion pages → ONE things
|
|
774
|
-
return response.results.map((page: any) => ({
|
|
775
|
-
_id: page.id,
|
|
776
|
-
type: params.type,
|
|
777
|
-
name: page.properties.Name?.title[0]?.plain_text || '',
|
|
778
|
-
properties: {},
|
|
779
|
-
status: 'active',
|
|
780
|
-
createdAt: new Date(page.created_time).getTime(),
|
|
781
|
-
updatedAt: new Date(page.last_edited_time).getTime()
|
|
782
|
-
}))
|
|
783
|
-
}),
|
|
784
|
-
|
|
785
|
-
create: (input) =>
|
|
786
|
-
Effect.gen(function* () {
|
|
787
|
-
// Map ONE create → Notion create page
|
|
788
|
-
const page = yield* Effect.tryPromise({
|
|
789
|
-
try: () =>
|
|
790
|
-
this.notion.pages.create({
|
|
791
|
-
parent: { database_id: this.databaseId },
|
|
792
|
-
properties: {
|
|
793
|
-
Name: {
|
|
794
|
-
title: [{ text: { content: input.name } }]
|
|
795
|
-
}
|
|
796
|
-
// Map input.properties → Notion properties
|
|
797
|
-
}
|
|
798
|
-
}),
|
|
799
|
-
catch: (error) => new ConnectionCreateError(String(error))
|
|
800
|
-
})
|
|
801
|
-
|
|
802
|
-
return page.id
|
|
803
|
-
}),
|
|
804
|
-
|
|
805
|
-
update: (id, updates) => {
|
|
806
|
-
// Similar Notion update implementation
|
|
807
|
-
},
|
|
808
|
-
|
|
809
|
-
delete: (id) => {
|
|
810
|
-
// Notion archive page
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
connections = {
|
|
815
|
-
// Notion relations can map to connections
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
events = {
|
|
819
|
-
// Log to separate Notion database
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
knowledge = {
|
|
823
|
-
// Use Notion's built-in search or external vector DB
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
// Factory function
|
|
828
|
-
export function notionProvider(config: { apiKey: string; databaseId: string }) {
|
|
829
|
-
return Layer.succeed(
|
|
830
|
-
DataProvider,
|
|
831
|
-
new NotionProvider(config.apiKey, config.databaseId)
|
|
832
|
-
)
|
|
833
|
-
}
|
|
834
|
-
```
|
|
835
|
-
|
|
836
|
-
### Supabase Provider
|
|
837
|
-
|
|
838
|
-
```typescript
|
|
839
|
-
// frontend/src/providers/supabase/SupabaseProvider.ts
|
|
840
|
-
import { Effect, Layer } from 'effect'
|
|
841
|
-
import { createClient, SupabaseClient } from '@supabase/supabase-js'
|
|
842
|
-
import { DataProvider } from '../DataProvider'
|
|
843
|
-
|
|
844
|
-
export class SupabaseProvider implements DataProvider {
|
|
845
|
-
private supabase: SupabaseClient
|
|
846
|
-
|
|
847
|
-
constructor(url: string, apiKey: string) {
|
|
848
|
-
this.supabase = createClient(url, apiKey)
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
things = {
|
|
852
|
-
get: (id: string) =>
|
|
853
|
-
Effect.gen(function* () {
|
|
854
|
-
// Map ONE thing → Supabase row
|
|
855
|
-
const { data, error } = yield* Effect.tryPromise({
|
|
856
|
-
try: () => this.supabase.from('things').select('*').eq('id', id).single(),
|
|
857
|
-
catch: (err) => new Error(String(err))
|
|
858
|
-
})
|
|
859
|
-
|
|
860
|
-
if (error) {
|
|
861
|
-
return yield* Effect.fail(new ThingNotFoundError(id))
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
return data
|
|
865
|
-
}),
|
|
866
|
-
|
|
867
|
-
list: (params) =>
|
|
868
|
-
Effect.gen(function* () {
|
|
869
|
-
let query = this.supabase
|
|
870
|
-
.from('things')
|
|
871
|
-
.select('*')
|
|
872
|
-
.eq('type', params.type)
|
|
873
|
-
.limit(params.limit || 10)
|
|
874
|
-
|
|
875
|
-
if (params.groupId) {
|
|
876
|
-
query = query.eq('groupId', params.groupId)
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
const { data, error } = yield* Effect.tryPromise({
|
|
880
|
-
try: () => query,
|
|
881
|
-
catch: (err) => new Error(String(err))
|
|
882
|
-
})
|
|
883
|
-
|
|
884
|
-
if (error) {
|
|
885
|
-
return yield* Effect.fail(new Error(error.message))
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
return data
|
|
889
|
-
}),
|
|
890
|
-
|
|
891
|
-
create: (input) =>
|
|
892
|
-
Effect.gen(function* () {
|
|
893
|
-
const { data, error } = yield* Effect.tryPromise({
|
|
894
|
-
try: () =>
|
|
895
|
-
this.supabase.from('things').insert([input]).select().single(),
|
|
896
|
-
catch: (err) => new ConnectionCreateError(String(err))
|
|
897
|
-
})
|
|
898
|
-
|
|
899
|
-
if (error) {
|
|
900
|
-
return yield* Effect.fail(new ConnectionCreateError(error.message))
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
return data.id
|
|
904
|
-
}),
|
|
905
|
-
|
|
906
|
-
update: (id, updates) => {
|
|
907
|
-
// Similar Supabase update
|
|
908
|
-
},
|
|
909
|
-
|
|
910
|
-
delete: (id) => {
|
|
911
|
-
// Similar Supabase delete
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
connections = {
|
|
916
|
-
// Use Supabase 'connections' table
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
events = {
|
|
920
|
-
// Use Supabase 'events' table
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
knowledge = {
|
|
924
|
-
// Use pgvector extension for embeddings
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
// ✅ Supabase supports real-time!
|
|
928
|
-
subscriptions = {
|
|
929
|
-
watchThing: (id: string) =>
|
|
930
|
-
Effect.gen(function* () {
|
|
931
|
-
// Use Supabase real-time subscriptions
|
|
932
|
-
const channel = this.supabase
|
|
933
|
-
.channel(`thing:${id}`)
|
|
934
|
-
.on('postgres_changes', {
|
|
935
|
-
event: '*',
|
|
936
|
-
schema: 'public',
|
|
937
|
-
table: 'things',
|
|
938
|
-
filter: `id=eq.${id}`
|
|
939
|
-
}, (payload) => {
|
|
940
|
-
// Emit updates
|
|
941
|
-
})
|
|
942
|
-
|
|
943
|
-
yield* Effect.tryPromise({
|
|
944
|
-
try: () => channel.subscribe(),
|
|
945
|
-
catch: (err) => new Error(String(err))
|
|
946
|
-
})
|
|
947
|
-
|
|
948
|
-
// Return observable
|
|
949
|
-
})
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
// Factory function
|
|
954
|
-
export function supabaseProvider(config: { url: string; apiKey: string }) {
|
|
955
|
-
return Layer.succeed(
|
|
956
|
-
DataProvider,
|
|
957
|
-
new SupabaseProvider(config.url, config.apiKey)
|
|
958
|
-
)
|
|
959
|
-
}
|
|
960
|
-
```
|
|
961
|
-
|
|
962
|
-
**Key Insight:** Each provider translates between ONE ontology ↔ backend-specific API.
|
|
963
|
-
|
|
964
|
-
---
|
|
965
|
-
|
|
966
|
-
## Configuration (Astro-Style)
|
|
967
|
-
|
|
968
|
-
**Swap backends by changing ONE line.**
|
|
969
|
-
|
|
970
|
-
```typescript
|
|
971
|
-
// frontend/astro.config.ts
|
|
972
|
-
import { defineConfig } from 'astro/config'
|
|
973
|
-
import react from '@astrojs/react'
|
|
974
|
-
import { one } from '@one/astro-integration'
|
|
975
|
-
|
|
976
|
-
// Import providers
|
|
977
|
-
import { convexProvider } from './src/providers/convex'
|
|
978
|
-
import { wordpressProvider } from './src/providers/wordpress'
|
|
979
|
-
import { notionProvider } from './src/providers/notion'
|
|
980
|
-
import { supabaseProvider } from './src/providers/supabase'
|
|
981
|
-
|
|
982
|
-
export default defineConfig({
|
|
983
|
-
integrations: [
|
|
984
|
-
react(),
|
|
985
|
-
one({
|
|
986
|
-
// ✅ Choose your backend (change this ONE line)
|
|
987
|
-
|
|
988
|
-
// Option 1: Convex (real-time, serverless)
|
|
989
|
-
provider: convexProvider({
|
|
990
|
-
url: import.meta.env.PUBLIC_CONVEX_URL
|
|
991
|
-
})
|
|
992
|
-
|
|
993
|
-
// Option 2: WordPress (existing CMS)
|
|
994
|
-
// provider: wordpressProvider({
|
|
995
|
-
// url: 'https://yoursite.com',
|
|
996
|
-
// apiKey: import.meta.env.WORDPRESS_API_KEY
|
|
997
|
-
// })
|
|
998
|
-
|
|
999
|
-
// Option 3: Notion (databases as backend)
|
|
1000
|
-
// provider: notionProvider({
|
|
1001
|
-
// apiKey: import.meta.env.NOTION_API_KEY,
|
|
1002
|
-
// databaseId: import.meta.env.NOTION_DB_ID
|
|
1003
|
-
// })
|
|
1004
|
-
|
|
1005
|
-
// Option 4: Supabase (PostgreSQL + real-time)
|
|
1006
|
-
// provider: supabaseProvider({
|
|
1007
|
-
// url: import.meta.env.PUBLIC_SUPABASE_URL,
|
|
1008
|
-
// apiKey: import.meta.env.PUBLIC_SUPABASE_ANON_KEY
|
|
1009
|
-
// })
|
|
1010
|
-
|
|
1011
|
-
// Option 5: Custom backend
|
|
1012
|
-
// provider: customProvider({ ... })
|
|
1013
|
-
})
|
|
1014
|
-
]
|
|
1015
|
-
})
|
|
1016
|
-
```
|
|
1017
|
-
|
|
1018
|
-
**Result:**
|
|
1019
|
-
- Frontend components don't change
|
|
1020
|
-
- UI stays the same
|
|
1021
|
-
- Only data source changes
|
|
1022
|
-
- Organizations can use their existing infrastructure
|
|
1023
|
-
|
|
1024
|
-
---
|
|
1025
|
-
|
|
1026
|
-
## Ontology Config (Display Only)
|
|
1027
|
-
|
|
1028
|
-
Frontend needs **display configuration** for UI rendering. NOT business logic.
|
|
1029
|
-
|
|
1030
|
-
```typescript
|
|
1031
|
-
// frontend/src/ontology/config.ts
|
|
1032
|
-
// THIS IS NOT BUSINESS LOGIC - JUST UI CONFIGURATION
|
|
1033
|
-
|
|
1034
|
-
export const thingConfigs = {
|
|
1035
|
-
course: {
|
|
1036
|
-
// Display names
|
|
1037
|
-
displayName: 'Course',
|
|
1038
|
-
displayNamePlural: 'Courses',
|
|
1039
|
-
|
|
1040
|
-
// UI presentation
|
|
1041
|
-
icon: 'BookOpen', // Lucide icon name
|
|
1042
|
-
color: 'green', // Tailwind color
|
|
1043
|
-
|
|
1044
|
-
// Which fields to show in UI
|
|
1045
|
-
primaryField: 'title', // Main display field
|
|
1046
|
-
secondaryField: 'description',
|
|
1047
|
-
imageField: 'thumbnail',
|
|
1048
|
-
|
|
1049
|
-
// Form fields (for UI only, backend validates)
|
|
1050
|
-
fields: {
|
|
1051
|
-
title: {
|
|
1052
|
-
label: 'Course Title',
|
|
1053
|
-
type: 'text',
|
|
1054
|
-
required: true,
|
|
1055
|
-
placeholder: 'e.g., Fitness 101'
|
|
1056
|
-
},
|
|
1057
|
-
description: {
|
|
1058
|
-
label: 'Description',
|
|
1059
|
-
type: 'textarea',
|
|
1060
|
-
required: true
|
|
1061
|
-
},
|
|
1062
|
-
price: {
|
|
1063
|
-
label: 'Price (USD)',
|
|
1064
|
-
type: 'number',
|
|
1065
|
-
required: true
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
},
|
|
1069
|
-
|
|
1070
|
-
creator: {
|
|
1071
|
-
displayName: 'Creator',
|
|
1072
|
-
displayNamePlural: 'Creators',
|
|
1073
|
-
icon: 'User',
|
|
1074
|
-
color: 'blue',
|
|
1075
|
-
primaryField: 'name',
|
|
1076
|
-
secondaryField: 'bio',
|
|
1077
|
-
imageField: 'avatar',
|
|
1078
|
-
fields: {
|
|
1079
|
-
name: { label: 'Name', type: 'text', required: true },
|
|
1080
|
-
email: { label: 'Email', type: 'text', required: true },
|
|
1081
|
-
bio: { label: 'Bio', type: 'textarea', required: false }
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
// ... all 66 types (UI config only)
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
// Helper function
|
|
1089
|
-
export function getThingConfig(type: ThingType) {
|
|
1090
|
-
return thingConfigs[type]
|
|
1091
|
-
}
|
|
1092
|
-
```
|
|
1093
|
-
|
|
1094
|
-
**What This Is:**
|
|
1095
|
-
- ✅ UI labels and placeholders
|
|
1096
|
-
- ✅ Icon and color choices
|
|
1097
|
-
- ✅ Which fields to display
|
|
1098
|
-
- ✅ Form field types
|
|
1099
|
-
|
|
1100
|
-
**What This Is NOT:**
|
|
1101
|
-
- ❌ Business logic
|
|
1102
|
-
- ❌ Validation rules (backend validates)
|
|
1103
|
-
- ❌ Authorization rules (backend authorizes)
|
|
1104
|
-
- ❌ Database schema (that's in backend)
|
|
1105
|
-
|
|
1106
|
-
---
|
|
1107
|
-
|
|
1108
|
-
## Effect.ts Service Layer
|
|
1109
|
-
|
|
1110
|
-
**Effect.ts services consume the DataProvider interface.**
|
|
1111
|
-
|
|
1112
|
-
The frontend service layer sits between React components and the DataProvider, providing:
|
|
1113
|
-
- Type-safe operations
|
|
1114
|
-
- Composable workflows
|
|
1115
|
-
- Consistent error handling
|
|
1116
|
-
- Testability
|
|
1117
|
-
|
|
1118
|
-
### Architecture
|
|
1119
|
-
|
|
1120
|
-
```
|
|
1121
|
-
┌────────────────────────────────────────────┐
|
|
1122
|
-
│ React Components │
|
|
1123
|
-
│ - useEffectRunner hook │
|
|
1124
|
-
│ - Render UI from Effect results │
|
|
1125
|
-
│ - Handle typed errors │
|
|
1126
|
-
└────────────────┬───────────────────────────┘
|
|
1127
|
-
│ Effect.runPromise
|
|
1128
|
-
↓
|
|
1129
|
-
┌────────────────────────────────────────────┐
|
|
1130
|
-
│ Service Layer (Effect.ts) │
|
|
1131
|
-
│ - ThingService │
|
|
1132
|
-
│ - ConnectionService │
|
|
1133
|
-
│ - Composable, testable │
|
|
1134
|
-
└────────────────┬───────────────────────────┘
|
|
1135
|
-
│ DataProvider Interface
|
|
1136
|
-
↓
|
|
1137
|
-
┌────────────────────────────────────────────┐
|
|
1138
|
-
│ DataProvider (Backend-Agnostic) │
|
|
1139
|
-
│ - ConvexProvider │
|
|
1140
|
-
│ - WordPressProvider │
|
|
1141
|
-
│ - NotionProvider │
|
|
1142
|
-
│ - SupabaseProvider │
|
|
1143
|
-
└────────────────────────────────────────────┘
|
|
1144
|
-
```
|
|
1145
|
-
|
|
1146
|
-
### Why Effect.ts?
|
|
1147
|
-
|
|
1148
|
-
```typescript
|
|
1149
|
-
// ❌ Traditional approach - untyped errors, hard to compose
|
|
1150
|
-
async function getCourse(id: string) {
|
|
1151
|
-
try {
|
|
1152
|
-
const response = await fetch(`/api/courses/${id}`)
|
|
1153
|
-
const course = await response.json()
|
|
1154
|
-
return course
|
|
1155
|
-
} catch (error) {
|
|
1156
|
-
// What type of error? Network? 404? 500?
|
|
1157
|
-
console.error(error)
|
|
1158
|
-
throw error
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
// ✅ Effect.ts approach - typed errors, backend-agnostic
|
|
1163
|
-
import { Effect } from 'effect'
|
|
1164
|
-
|
|
1165
|
-
function getCourse(id: string) {
|
|
1166
|
-
return Effect.gen(function* () {
|
|
1167
|
-
const provider = yield* DataProvider
|
|
1168
|
-
|
|
1169
|
-
// Works with ANY backend (Convex, WordPress, Notion, etc.)
|
|
1170
|
-
const course = yield* provider.things.get(id)
|
|
1171
|
-
|
|
1172
|
-
return course
|
|
1173
|
-
}).pipe(
|
|
1174
|
-
// Handle specific errors
|
|
1175
|
-
Effect.catchTag('ThingNotFoundError', err =>
|
|
1176
|
-
Effect.fail(new Error(`Course ${err.thingId} not found`))
|
|
1177
|
-
)
|
|
1178
|
-
)
|
|
1179
|
-
}
|
|
1180
|
-
```
|
|
1181
|
-
|
|
1182
|
-
**Key Benefits:**
|
|
1183
|
-
1. **Backend-Agnostic** - Works with any DataProvider implementation
|
|
1184
|
-
2. **Type-Safe Errors** - Compiler enforces error handling
|
|
1185
|
-
3. **Composability** - Small functions combine into complex flows
|
|
1186
|
-
4. **Testability** - Test layers replace real providers
|
|
1187
|
-
|
|
1188
|
-
---
|
|
1189
|
-
|
|
1190
|
-
## Service Implementations
|
|
1191
|
-
|
|
1192
|
-
**Client services wrap backend API calls in Effect.ts patterns.**
|
|
1193
|
-
|
|
1194
|
-
### Core Principle: Generic Services Handle Everything
|
|
1195
|
-
|
|
1196
|
-
The ontology has **66 thing types**, but you only need **2 generic services**:
|
|
1197
|
-
|
|
1198
|
-
1. **ThingClientService** - All CRUD for all 66 types
|
|
1199
|
-
2. **ConnectionClientService** - All relationships
|
|
1200
|
-
|
|
1201
|
-
```typescript
|
|
1202
|
-
// ✅ This handles courses, lessons, products, everything
|
|
1203
|
-
// Works with ANY backend (Convex, WordPress, Notion, Supabase, etc.)
|
|
1204
|
-
const provider = yield* DataProvider
|
|
1205
|
-
|
|
1206
|
-
// Get any thing
|
|
1207
|
-
const course = yield* provider.things.get(courseId)
|
|
1208
|
-
const lesson = yield* provider.things.get(lessonId)
|
|
1209
|
-
|
|
1210
|
-
// List any type
|
|
1211
|
-
const courses = yield* provider.things.list({ type: 'course', groupId: orgId })
|
|
1212
|
-
const products = yield* provider.things.list({ type: 'product', groupId: orgId })
|
|
1213
|
-
|
|
1214
|
-
// Create any type
|
|
1215
|
-
const courseId = yield* provider.things.create({
|
|
1216
|
-
type: 'course',
|
|
1217
|
-
name: 'Fitness 101',
|
|
1218
|
-
properties: { price: 99, description: '...' }
|
|
1219
|
-
})
|
|
1220
|
-
```
|
|
1221
|
-
|
|
1222
|
-
**Specialized services are OPTIONAL** - only add them if you repeat the same multi-step operations frequently.
|
|
1223
|
-
|
|
1224
|
-
---
|
|
1225
|
-
|
|
1226
|
-
### Pattern: Generic Thing Service (Thin Wrapper)
|
|
1227
|
-
|
|
1228
|
-
**Services are thin wrappers around DataProvider - backend-agnostic.**
|
|
1229
|
-
|
|
1230
|
-
```typescript
|
|
1231
|
-
// frontend/src/services/ThingService.ts
|
|
1232
|
-
import { Effect } from 'effect'
|
|
1233
|
-
import { DataProvider } from '@/providers/DataProvider'
|
|
1234
|
-
|
|
1235
|
-
// Services just delegate to the configured provider
|
|
1236
|
-
export class ThingService extends Effect.Service<ThingService>()(
|
|
1237
|
-
'ThingService',
|
|
1238
|
-
{
|
|
1239
|
-
effect: Effect.gen(function* () {
|
|
1240
|
-
// Get the configured provider (Convex, WordPress, etc.)
|
|
1241
|
-
const provider = yield* DataProvider
|
|
1242
|
-
|
|
1243
|
-
return {
|
|
1244
|
-
// All methods delegate to provider
|
|
1245
|
-
get: (id: string) => provider.things.get(id),
|
|
1246
|
-
|
|
1247
|
-
list: (type: ThingType, orgId?: string) =>
|
|
1248
|
-
provider.things.list({
|
|
1249
|
-
type,
|
|
1250
|
-
groupId: orgId
|
|
1251
|
-
}),
|
|
1252
|
-
|
|
1253
|
-
create: (input: { type: ThingType; name: string; properties: any }) =>
|
|
1254
|
-
provider.things.create(input),
|
|
1255
|
-
|
|
1256
|
-
update: (id: string, updates: any) =>
|
|
1257
|
-
provider.things.update(id, updates),
|
|
1258
|
-
|
|
1259
|
-
delete: (id: string) =>
|
|
1260
|
-
provider.things.delete(id)
|
|
1261
|
-
}
|
|
1262
|
-
}),
|
|
1263
|
-
dependencies: [DataProvider] // Depends on DataProvider (backend-agnostic)
|
|
1264
|
-
}
|
|
1265
|
-
) {}
|
|
1266
|
-
```
|
|
1267
|
-
|
|
1268
|
-
**Key Point:** `ThingService` doesn't care if provider is Convex, WordPress, or Notion. It just calls `provider.things.get()`. The provider handles backend-specific logic.
|
|
1269
|
-
|
|
1270
|
-
### Pattern: Specialized Service (Optional - Course Example)
|
|
1271
|
-
|
|
1272
|
-
**You don't need this!** A course is just a thing. But if you repeat operations, add convenience methods:
|
|
1273
|
-
|
|
1274
|
-
```typescript
|
|
1275
|
-
// frontend/src/services/CourseClientService.ts (OPTIONAL)
|
|
1276
|
-
import { Effect } from 'effect'
|
|
1277
|
-
import { ThingClientService } from './ThingClientService'
|
|
1278
|
-
import { ConnectionClientService } from './ConnectionClientService'
|
|
1279
|
-
|
|
1280
|
-
export class CourseClientService extends Effect.Service<CourseClientService>()(
|
|
1281
|
-
'CourseClientService',
|
|
1282
|
-
{
|
|
1283
|
-
effect: Effect.gen(function* () {
|
|
1284
|
-
const thingService = yield* ThingClientService
|
|
1285
|
-
const connectionService = yield* ConnectionClientService
|
|
1286
|
-
|
|
1287
|
-
return {
|
|
1288
|
-
// Convenience: Get course with lessons
|
|
1289
|
-
// Without this, you'd do:
|
|
1290
|
-
// const course = yield* thingService.get(courseId)
|
|
1291
|
-
// const lessons = yield* connectionService.getRelated(courseId, 'part_of', 'to')
|
|
1292
|
-
getCourseWithLessons: (courseId: string) =>
|
|
1293
|
-
Effect.gen(function* () {
|
|
1294
|
-
const [course, lessons] = yield* Effect.all([
|
|
1295
|
-
thingService.get(courseId),
|
|
1296
|
-
connectionService.getRelated(courseId, 'part_of', 'to')
|
|
1297
|
-
])
|
|
1298
|
-
|
|
1299
|
-
return { course, lessons }
|
|
1300
|
-
}),
|
|
1301
|
-
|
|
1302
|
-
// Convenience: Clearer domain vocabulary
|
|
1303
|
-
// Without this, you'd do:
|
|
1304
|
-
// yield* connectionService.create({
|
|
1305
|
-
// fromThingId: userId,
|
|
1306
|
-
// toThingId: courseId,
|
|
1307
|
-
// relationshipType: 'enrolled_in'
|
|
1308
|
-
// })
|
|
1309
|
-
enrollUser: (userId: string, courseId: string) =>
|
|
1310
|
-
Effect.gen(function* () {
|
|
1311
|
-
return yield* connectionService.create({
|
|
1312
|
-
fromThingId: userId,
|
|
1313
|
-
toThingId: courseId,
|
|
1314
|
-
relationshipType: 'enrolled_in'
|
|
1315
|
-
})
|
|
1316
|
-
}),
|
|
1317
|
-
|
|
1318
|
-
// Convenience: Specific count query
|
|
1319
|
-
getEnrollmentCount: (courseId: string) =>
|
|
1320
|
-
Effect.gen(function* () {
|
|
1321
|
-
return yield* connectionService.getCount(courseId, 'enrolled_in')
|
|
1322
|
-
})
|
|
1323
|
-
}
|
|
1324
|
-
}),
|
|
1325
|
-
dependencies: [ThingClientService.Default, ConnectionClientService.Default]
|
|
1326
|
-
}
|
|
1327
|
-
) {}
|
|
1328
|
-
```
|
|
1329
|
-
|
|
1330
|
-
**When to add specialized services:**
|
|
1331
|
-
- ✅ Repeat the same multi-step operation 3+ times
|
|
1332
|
-
- ✅ Want domain vocabulary (`enrollUser` vs `create connection`)
|
|
1333
|
-
- ✅ Need to encapsulate complex business workflows
|
|
1334
|
-
- ❌ Don't add them upfront for all 66 types
|
|
1335
|
-
- ❌ Don't add them for simple CRUD (use ThingClientService)
|
|
1336
|
-
|
|
1337
|
-
### ConvexHttpClient Wrapper
|
|
1338
|
-
|
|
1339
|
-
```typescript
|
|
1340
|
-
// frontend/src/services/ConvexHttpClient.ts
|
|
1341
|
-
import { Effect, Context, Layer } from 'effect'
|
|
1342
|
-
import { ConvexHttpClient as ConvexClient } from 'convex/browser'
|
|
1343
|
-
|
|
1344
|
-
// Define client interface
|
|
1345
|
-
export class ConvexHttpClient extends Context.Tag('ConvexHttpClient')<
|
|
1346
|
-
ConvexHttpClient,
|
|
1347
|
-
{
|
|
1348
|
-
query: <T>(endpoint: any, args: any) => Effect.Effect<T, Error>
|
|
1349
|
-
mutation: <T>(endpoint: any, args: any) => Effect.Effect<T, Error>
|
|
1350
|
-
}
|
|
1351
|
-
>() {}
|
|
1352
|
-
|
|
1353
|
-
// Live implementation
|
|
1354
|
-
export const ConvexHttpClientLive = Layer.succeed(
|
|
1355
|
-
ConvexHttpClient,
|
|
1356
|
-
{
|
|
1357
|
-
query: (endpoint, args) =>
|
|
1358
|
-
Effect.tryPromise({
|
|
1359
|
-
try: () => {
|
|
1360
|
-
const client = new ConvexClient(import.meta.env.PUBLIC_CONVEX_URL)
|
|
1361
|
-
return client.query(endpoint, args)
|
|
1362
|
-
},
|
|
1363
|
-
catch: (error) => new Error(String(error))
|
|
1364
|
-
}),
|
|
1365
|
-
|
|
1366
|
-
mutation: (endpoint, args) =>
|
|
1367
|
-
Effect.tryPromise({
|
|
1368
|
-
try: () => {
|
|
1369
|
-
const client = new ConvexClient(import.meta.env.PUBLIC_CONVEX_URL)
|
|
1370
|
-
return client.mutation(endpoint, args)
|
|
1371
|
-
},
|
|
1372
|
-
catch: (error) => new Error(String(error))
|
|
1373
|
-
})
|
|
1374
|
-
}
|
|
1375
|
-
)
|
|
1376
|
-
```
|
|
1377
|
-
|
|
1378
|
-
### Client Layer (Dependency Injection)
|
|
1379
|
-
|
|
1380
|
-
```typescript
|
|
1381
|
-
// frontend/src/services/ClientLayer.ts
|
|
1382
|
-
import { Layer } from 'effect'
|
|
1383
|
-
import { ConvexHttpClientLive } from './ConvexHttpClient'
|
|
1384
|
-
import { ThingClientService } from './ThingClientService'
|
|
1385
|
-
import { ConnectionClientService } from './ConnectionClientService'
|
|
1386
|
-
// import { CourseClientService } from './CourseClientService' // OPTIONAL
|
|
1387
|
-
|
|
1388
|
-
// ✅ Minimal layer - handles all 66 thing types
|
|
1389
|
-
export const ClientLayer = Layer.mergeAll(
|
|
1390
|
-
ConvexHttpClientLive,
|
|
1391
|
-
ThingClientService.Default,
|
|
1392
|
-
ConnectionClientService.Default
|
|
1393
|
-
// CourseClientService.Default // Add ONLY if you created it
|
|
1394
|
-
)
|
|
1395
|
-
```
|
|
1396
|
-
|
|
1397
|
-
**Most apps only need the 2 generic services.** Add specialized services as you discover repeated patterns.
|
|
1398
|
-
|
|
1399
|
-
---
|
|
1400
|
-
|
|
1401
|
-
## React Integration (useEffectRunner)
|
|
1402
|
-
|
|
1403
|
-
**Custom hook for running Effect programs in React components.**
|
|
1404
|
-
|
|
1405
|
-
### useEffectRunner Hook
|
|
1406
|
-
|
|
1407
|
-
```typescript
|
|
1408
|
-
// frontend/src/hooks/useEffectRunner.ts
|
|
1409
|
-
import { useCallback, useState } from 'react'
|
|
1410
|
-
import { Effect } from 'effect'
|
|
1411
|
-
import { ClientLayer } from '@/services/ClientLayer'
|
|
1412
|
-
|
|
1413
|
-
export function useEffectRunner() {
|
|
1414
|
-
const [loading, setLoading] = useState(false)
|
|
1415
|
-
const [error, setError] = useState<string | null>(null)
|
|
1416
|
-
|
|
1417
|
-
const run = useCallback(async <A, E>(
|
|
1418
|
-
effect: Effect.Effect<A, E>,
|
|
1419
|
-
options?: {
|
|
1420
|
-
onSuccess?: (result: A) => void
|
|
1421
|
-
onError?: (error: E) => void
|
|
1422
|
-
}
|
|
1423
|
-
) => {
|
|
1424
|
-
setLoading(true)
|
|
1425
|
-
setError(null)
|
|
1426
|
-
|
|
1427
|
-
try {
|
|
1428
|
-
const result = await Effect.runPromise(
|
|
1429
|
-
effect.pipe(Effect.provide(ClientLayer))
|
|
1430
|
-
)
|
|
1431
|
-
|
|
1432
|
-
options?.onSuccess?.(result)
|
|
1433
|
-
return result
|
|
1434
|
-
} catch (err) {
|
|
1435
|
-
const errorMessage = err instanceof Error ? err.message : String(err)
|
|
1436
|
-
setError(errorMessage)
|
|
1437
|
-
options?.onError?.(err as E)
|
|
1438
|
-
throw err
|
|
1439
|
-
} finally {
|
|
1440
|
-
setLoading(false)
|
|
1441
|
-
}
|
|
1442
|
-
}, [])
|
|
1443
|
-
|
|
1444
|
-
return { run, loading, error }
|
|
1445
|
-
}
|
|
1446
|
-
```
|
|
1447
|
-
|
|
1448
|
-
### Using in Components
|
|
1449
|
-
|
|
1450
|
-
```tsx
|
|
1451
|
-
// frontend/src/components/CourseEnrollButton.tsx
|
|
1452
|
-
import { useEffectRunner } from '@/hooks/useEffectRunner'
|
|
1453
|
-
import { ConnectionClientService } from '@/services/ConnectionClientService'
|
|
1454
|
-
import { Effect } from 'effect'
|
|
1455
|
-
import { Button } from '@/components/ui/button'
|
|
1456
|
-
import { Alert } from '@/components/ui/alert'
|
|
1457
|
-
|
|
1458
|
-
interface Props {
|
|
1459
|
-
courseId: string
|
|
1460
|
-
userId: string
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
|
-
export function CourseEnrollButton({ courseId, userId }: Props) {
|
|
1464
|
-
const { run, loading, error } = useEffectRunner()
|
|
1465
|
-
|
|
1466
|
-
const handleEnroll = () => {
|
|
1467
|
-
// Define Effect program using GENERIC service
|
|
1468
|
-
const program = Effect.gen(function* () {
|
|
1469
|
-
const connectionService = yield* ConnectionClientService
|
|
1470
|
-
|
|
1471
|
-
// Enroll = create connection (course is just a thing)
|
|
1472
|
-
const enrollmentId = yield* connectionService.create({
|
|
1473
|
-
fromThingId: userId,
|
|
1474
|
-
toThingId: courseId,
|
|
1475
|
-
relationshipType: 'enrolled_in'
|
|
1476
|
-
})
|
|
1477
|
-
|
|
1478
|
-
// Log success (client-side only for UX)
|
|
1479
|
-
yield* Effect.logInfo(`Enrolled in course ${courseId}`)
|
|
1480
|
-
|
|
1481
|
-
return enrollmentId
|
|
1482
|
-
})
|
|
1483
|
-
|
|
1484
|
-
// Run Effect program
|
|
1485
|
-
run(program, {
|
|
1486
|
-
onSuccess: (enrollmentId) => {
|
|
1487
|
-
console.log('Enrolled successfully:', enrollmentId)
|
|
1488
|
-
window.location.href = `/courses/${courseId}/learn`
|
|
1489
|
-
},
|
|
1490
|
-
onError: (err) => {
|
|
1491
|
-
console.error('Enrollment failed:', err)
|
|
1492
|
-
}
|
|
1493
|
-
})
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
|
-
return (
|
|
1497
|
-
<div>
|
|
1498
|
-
<Button onClick={handleEnroll} disabled={loading}>
|
|
1499
|
-
{loading ? 'Enrolling...' : 'Enroll Now'}
|
|
1500
|
-
</Button>
|
|
1501
|
-
|
|
1502
|
-
{error && (
|
|
1503
|
-
<Alert variant="destructive">{error}</Alert>
|
|
1504
|
-
)}
|
|
1505
|
-
</div>
|
|
1506
|
-
)
|
|
1507
|
-
}
|
|
1508
|
-
```
|
|
1509
|
-
|
|
1510
|
-
**Alternative with specialized service (if you created CourseClientService):**
|
|
1511
|
-
```tsx
|
|
1512
|
-
// OPTIONAL: If you have CourseClientService
|
|
1513
|
-
const program = Effect.gen(function* () {
|
|
1514
|
-
const courseService = yield* CourseClientService
|
|
1515
|
-
return yield* courseService.enrollUser(userId, courseId)
|
|
1516
|
-
})
|
|
1517
|
-
```
|
|
1518
|
-
|
|
1519
|
-
### Pattern: Composable Operations
|
|
1520
|
-
|
|
1521
|
-
```tsx
|
|
1522
|
-
// frontend/src/components/CourseCreator.tsx
|
|
1523
|
-
import { useEffectRunner } from '@/hooks/useEffectRunner'
|
|
1524
|
-
import { ThingClientService } from '@/services/ThingClientService'
|
|
1525
|
-
import { ConnectionClientService } from '@/services/ConnectionClientService'
|
|
1526
|
-
import { Effect } from 'effect'
|
|
1527
|
-
import { useState } from 'react'
|
|
1528
|
-
|
|
1529
|
-
export function CourseCreator() {
|
|
1530
|
-
const { run, loading, error } = useEffectRunner()
|
|
1531
|
-
const [formData, setFormData] = useState({
|
|
1532
|
-
title: '',
|
|
1533
|
-
description: '',
|
|
1534
|
-
price: 0
|
|
1535
|
-
})
|
|
1536
|
-
|
|
1537
|
-
const handleSubmit = async (e: React.FormEvent) => {
|
|
1538
|
-
e.preventDefault()
|
|
1539
|
-
|
|
1540
|
-
// Define COMPLEX Effect program with ONLY generic services
|
|
1541
|
-
const program = Effect.gen(function* () {
|
|
1542
|
-
const thingService = yield* ThingClientService
|
|
1543
|
-
const connectionService = yield* ConnectionClientService
|
|
1544
|
-
|
|
1545
|
-
// 1. Create course (just a thing with type='course')
|
|
1546
|
-
const courseId = yield* thingService.create({
|
|
1547
|
-
type: 'course',
|
|
1548
|
-
name: formData.title,
|
|
1549
|
-
properties: {
|
|
1550
|
-
title: formData.title,
|
|
1551
|
-
description: formData.description,
|
|
1552
|
-
price: formData.price
|
|
1553
|
-
}
|
|
1554
|
-
})
|
|
1555
|
-
|
|
1556
|
-
// 2. Create default lesson (just a thing with type='lesson')
|
|
1557
|
-
const lessonId = yield* thingService.create({
|
|
1558
|
-
type: 'lesson',
|
|
1559
|
-
name: 'Introduction',
|
|
1560
|
-
properties: {
|
|
1561
|
-
content: 'Welcome to the course!'
|
|
1562
|
-
}
|
|
1563
|
-
})
|
|
1564
|
-
|
|
1565
|
-
// 3. Connect lesson to course (generic connection)
|
|
1566
|
-
yield* connectionService.create({
|
|
1567
|
-
fromThingId: lessonId,
|
|
1568
|
-
toThingId: courseId,
|
|
1569
|
-
relationshipType: 'part_of'
|
|
1570
|
-
})
|
|
1571
|
-
|
|
1572
|
-
// 4. Return course ID
|
|
1573
|
-
return courseId
|
|
1574
|
-
}).pipe(
|
|
1575
|
-
// Add retry logic
|
|
1576
|
-
Effect.retry({ times: 3 }),
|
|
1577
|
-
// Add timeout
|
|
1578
|
-
Effect.timeout('5 seconds'),
|
|
1579
|
-
// Handle specific errors
|
|
1580
|
-
Effect.catchTag('ThingCreateError', err =>
|
|
1581
|
-
Effect.fail(new Error(`Failed to create course: ${err.reason}`))
|
|
1582
|
-
)
|
|
1583
|
-
)
|
|
1584
|
-
|
|
1585
|
-
// Run the program
|
|
1586
|
-
const courseId = await run(program, {
|
|
1587
|
-
onSuccess: (id) => {
|
|
1588
|
-
window.location.href = `/courses/${id}`
|
|
1589
|
-
}
|
|
1590
|
-
})
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
|
-
return (
|
|
1594
|
-
<form onSubmit={handleSubmit}>
|
|
1595
|
-
<input
|
|
1596
|
-
type="text"
|
|
1597
|
-
value={formData.title}
|
|
1598
|
-
onChange={(e) => setFormData({ ...formData, title: e.target.value })}
|
|
1599
|
-
placeholder="Course Title"
|
|
1600
|
-
/>
|
|
1601
|
-
|
|
1602
|
-
<textarea
|
|
1603
|
-
value={formData.description}
|
|
1604
|
-
onChange={(e) => setFormData({ ...formData, description: e.target.value })}
|
|
1605
|
-
placeholder="Description"
|
|
1606
|
-
/>
|
|
1607
|
-
|
|
1608
|
-
<input
|
|
1609
|
-
type="number"
|
|
1610
|
-
value={formData.price}
|
|
1611
|
-
onChange={(e) => setFormData({ ...formData, price: parseFloat(e.target.value) })}
|
|
1612
|
-
placeholder="Price"
|
|
1613
|
-
/>
|
|
1614
|
-
|
|
1615
|
-
<button type="submit" disabled={loading}>
|
|
1616
|
-
{loading ? 'Creating...' : 'Create Course'}
|
|
1617
|
-
</button>
|
|
1618
|
-
|
|
1619
|
-
{error && <Alert variant="destructive">{error}</Alert>}
|
|
1620
|
-
</form>
|
|
1621
|
-
)
|
|
1622
|
-
}
|
|
1623
|
-
```
|
|
1624
|
-
|
|
1625
|
-
**Key Point:** This handles courses, products, lessons, EVERYTHING with just 2 generic services. No specialized services needed.
|
|
1626
|
-
|
|
1627
|
-
### Pattern: Parallel Data Fetching
|
|
1628
|
-
|
|
1629
|
-
```tsx
|
|
1630
|
-
// frontend/src/components/CourseDashboard.tsx
|
|
1631
|
-
import { useEffect, useState } from 'react'
|
|
1632
|
-
import { useEffectRunner } from '@/hooks/useEffectRunner'
|
|
1633
|
-
import { ThingClientService } from '@/services/ThingClientService'
|
|
1634
|
-
import { ConnectionClientService } from '@/services/ConnectionClientService'
|
|
1635
|
-
import { Effect } from 'effect'
|
|
1636
|
-
|
|
1637
|
-
interface Props {
|
|
1638
|
-
courseId: string
|
|
1639
|
-
}
|
|
1640
|
-
|
|
1641
|
-
export function CourseDashboard({ courseId }: Props) {
|
|
1642
|
-
const { run, loading } = useEffectRunner()
|
|
1643
|
-
const [data, setData] = useState<any>(null)
|
|
1644
|
-
|
|
1645
|
-
useEffect(() => {
|
|
1646
|
-
// Fetch all data in parallel using GENERIC services
|
|
1647
|
-
const program = Effect.gen(function* () {
|
|
1648
|
-
const thingService = yield* ThingClientService
|
|
1649
|
-
const connectionService = yield* ConnectionClientService
|
|
1650
|
-
|
|
1651
|
-
// Parallel fetch (all run at once)
|
|
1652
|
-
// Course is just a thing, lessons are connected things
|
|
1653
|
-
const [course, lessons, enrollmentCount] = yield* Effect.all([
|
|
1654
|
-
thingService.get(courseId),
|
|
1655
|
-
connectionService.getRelated(courseId, 'part_of', 'to'),
|
|
1656
|
-
connectionService.getCount(courseId, 'enrolled_in')
|
|
1657
|
-
], { concurrency: 'unbounded' })
|
|
1658
|
-
|
|
1659
|
-
return { course, lessons, enrollmentCount }
|
|
1660
|
-
})
|
|
1661
|
-
|
|
1662
|
-
run(program, {
|
|
1663
|
-
onSuccess: setData
|
|
1664
|
-
})
|
|
1665
|
-
}, [courseId])
|
|
1666
|
-
|
|
1667
|
-
if (loading) return <div>Loading...</div>
|
|
1668
|
-
if (!data) return <div>No data</div>
|
|
1669
|
-
|
|
1670
|
-
return (
|
|
1671
|
-
<div>
|
|
1672
|
-
<h1>{data.course.name}</h1>
|
|
1673
|
-
<p>{data.enrollmentCount} students enrolled</p>
|
|
1674
|
-
|
|
1675
|
-
<h2>Lessons</h2>
|
|
1676
|
-
{data.lessons.map((lesson: any) => (
|
|
1677
|
-
<div key={lesson._id}>{lesson.name}</div>
|
|
1678
|
-
))}
|
|
1679
|
-
</div>
|
|
1680
|
-
)
|
|
1681
|
-
}
|
|
1682
|
-
```
|
|
1683
|
-
|
|
1684
|
-
**This is where a specialized service provides value** - compare:
|
|
1685
|
-
|
|
1686
|
-
```tsx
|
|
1687
|
-
// ❌ Without specialized service (3 separate operations)
|
|
1688
|
-
const [course, lessons, enrollmentCount] = yield* Effect.all([
|
|
1689
|
-
thingService.get(courseId),
|
|
1690
|
-
connectionService.getRelated(courseId, 'part_of', 'to'),
|
|
1691
|
-
connectionService.getCount(courseId, 'enrolled_in')
|
|
1692
|
-
])
|
|
1693
|
-
|
|
1694
|
-
// ✅ With specialized service (cleaner, if you repeat this pattern)
|
|
1695
|
-
const data = yield* courseService.getCourseWithLessons(courseId)
|
|
1696
|
-
const count = yield* courseService.getEnrollmentCount(courseId)
|
|
1697
|
-
```
|
|
1698
|
-
|
|
1699
|
-
But you only add `CourseClientService` **after** you repeat this pattern 3+ times.
|
|
1700
|
-
|
|
1701
|
-
---
|
|
1702
|
-
|
|
1703
|
-
### Summary: Generic vs Specialized Services
|
|
1704
|
-
|
|
1705
|
-
```
|
|
1706
|
-
┌─────────────────────────────────────────────────────────┐
|
|
1707
|
-
│ 66 Thing Types │
|
|
1708
|
-
│ course, lesson, product, video, post, comment, etc. │
|
|
1709
|
-
└──────────────────────┬──────────────────────────────────┘
|
|
1710
|
-
│
|
|
1711
|
-
↓
|
|
1712
|
-
┌─────────────────────────────────────────────────────────┐
|
|
1713
|
-
│ 2 GENERIC SERVICES (handle everything) │
|
|
1714
|
-
│ │
|
|
1715
|
-
│ ThingClientService: │
|
|
1716
|
-
│ - get(id) │
|
|
1717
|
-
│ - list(type, orgId) │
|
|
1718
|
-
│ - create({ type, name, properties }) │
|
|
1719
|
-
│ - update(id, updates) │
|
|
1720
|
-
│ - delete(id) │
|
|
1721
|
-
│ │
|
|
1722
|
-
│ ConnectionClientService: │
|
|
1723
|
-
│ - create({ fromThingId, toThingId, relationshipType })│
|
|
1724
|
-
│ - getRelated(thingId, relationshipType, direction) │
|
|
1725
|
-
│ - getCount(thingId, relationshipType) │
|
|
1726
|
-
│ - delete(connectionId) │
|
|
1727
|
-
└──────────────────────┬──────────────────────────────────┘
|
|
1728
|
-
│
|
|
1729
|
-
↓
|
|
1730
|
-
┌─────────────────────────────────────────────────────────┐
|
|
1731
|
-
│ SPECIALIZED SERVICES (optional, add as needed) │
|
|
1732
|
-
│ │
|
|
1733
|
-
│ CourseClientService (if you repeat patterns): │
|
|
1734
|
-
│ - getCourseWithLessons() → wraps 2 calls │
|
|
1735
|
-
│ - enrollUser() → clearer vocabulary │
|
|
1736
|
-
│ - getEnrollmentCount() → specific query │
|
|
1737
|
-
│ │
|
|
1738
|
-
│ Add specialized services ONLY when: │
|
|
1739
|
-
│ ✅ You repeat the same 2-3 step operation 3+ times │
|
|
1740
|
-
│ ✅ You want clearer domain vocabulary │
|
|
1741
|
-
│ ❌ Don't add upfront for all 66 types │
|
|
1742
|
-
└─────────────────────────────────────────────────────────┘
|
|
1743
|
-
```
|
|
1744
|
-
|
|
1745
|
-
**Start with generic services. Add specialized services as patterns emerge.**
|
|
1746
|
-
|
|
1747
|
-
---
|
|
1748
|
-
|
|
1749
|
-
## Component Patterns
|
|
1750
|
-
|
|
1751
|
-
### Pattern 1: Generic Card (Pure Presentation)
|
|
1752
|
-
|
|
1753
|
-
```tsx
|
|
1754
|
-
// frontend/src/components/cards/ThingCard.tsx
|
|
1755
|
-
import { Card } from '@/components/ui/card'
|
|
1756
|
-
import { getThingConfig } from '@/ontology/config'
|
|
1757
|
-
import * as Icons from 'lucide-react'
|
|
1758
|
-
|
|
1759
|
-
interface ThingCardProps {
|
|
1760
|
-
thing: {
|
|
1761
|
-
_id: string
|
|
1762
|
-
type: string
|
|
1763
|
-
name: string
|
|
1764
|
-
properties: Record<string, any>
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
|
-
|
|
1768
|
-
export function ThingCard({ thing }: ThingCardProps) {
|
|
1769
|
-
// Get UI config
|
|
1770
|
-
const config = getThingConfig(thing.type as any)
|
|
1771
|
-
const Icon = Icons[config.icon as keyof typeof Icons]
|
|
1772
|
-
|
|
1773
|
-
// Extract display values
|
|
1774
|
-
const title = thing.properties[config.primaryField] || thing.name
|
|
1775
|
-
const subtitle = config.secondaryField
|
|
1776
|
-
? thing.properties[config.secondaryField]
|
|
1777
|
-
: null
|
|
1778
|
-
const image = config.imageField
|
|
1779
|
-
? thing.properties[config.imageField]
|
|
1780
|
-
: null
|
|
1781
|
-
|
|
1782
|
-
// Pure presentation - NO logic
|
|
1783
|
-
return (
|
|
1784
|
-
<Card>
|
|
1785
|
-
{image && <img src={image} alt={title} />}
|
|
1786
|
-
|
|
1787
|
-
<div className="p-4">
|
|
1788
|
-
<div className="flex items-center gap-2">
|
|
1789
|
-
<Icon className="w-5 h-5" />
|
|
1790
|
-
<span>{config.displayName}</span>
|
|
1791
|
-
</div>
|
|
1792
|
-
|
|
1793
|
-
<h3 className="text-xl font-bold">{title}</h3>
|
|
1794
|
-
{subtitle && <p className="text-gray-600">{subtitle}</p>}
|
|
1795
|
-
|
|
1796
|
-
<a href={`/${thing.type}s/${thing._id}`}>
|
|
1797
|
-
<button>View Details</button>
|
|
1798
|
-
</a>
|
|
1799
|
-
</div>
|
|
1800
|
-
</Card>
|
|
1801
|
-
)
|
|
1802
|
-
}
|
|
1803
|
-
```
|
|
1804
|
-
|
|
1805
|
-
**Key Points:**
|
|
1806
|
-
- ✅ Receives data as props
|
|
1807
|
-
- ✅ Uses UI config for display
|
|
1808
|
-
- ✅ Pure presentation logic
|
|
1809
|
-
- ❌ NO database calls
|
|
1810
|
-
- ❌ NO business logic
|
|
1811
|
-
- ❌ NO validation
|
|
1812
|
-
|
|
1813
|
-
---
|
|
1814
|
-
|
|
1815
|
-
## Page Patterns (SSR)
|
|
1816
|
-
|
|
1817
|
-
### Pattern: Fetch from Backend, Render HTML
|
|
1818
|
-
|
|
1819
|
-
```astro
|
|
1820
|
-
---
|
|
1821
|
-
// frontend/src/pages/courses/[id].astro
|
|
1822
|
-
import { getConvexClient } from '@/lib/convex'
|
|
1823
|
-
import { api } from '@/lib/api'
|
|
1824
|
-
import Layout from '@/layouts/Layout.astro'
|
|
1825
|
-
|
|
1826
|
-
// SSR: Fetch data from backend via HTTP
|
|
1827
|
-
const convex = getConvexClient()
|
|
1828
|
-
|
|
1829
|
-
const course = await convex.query(api.queries.things.get, {
|
|
1830
|
-
id: Astro.params.id
|
|
1831
|
-
})
|
|
1832
|
-
|
|
1833
|
-
if (!course) {
|
|
1834
|
-
return Astro.redirect('/404')
|
|
1835
|
-
}
|
|
1836
|
-
|
|
1837
|
-
// Get related lessons from backend
|
|
1838
|
-
const lessons = await convex.query(api.queries.things.getRelated, {
|
|
1839
|
-
thingId: course._id,
|
|
1840
|
-
relationshipType: 'part_of',
|
|
1841
|
-
direction: 'to'
|
|
1842
|
-
})
|
|
1843
|
-
---
|
|
1844
|
-
|
|
1845
|
-
<Layout title={course.name}>
|
|
1846
|
-
<!-- Static HTML rendered on server -->
|
|
1847
|
-
<header>
|
|
1848
|
-
<h1>{course.name}</h1>
|
|
1849
|
-
<p>{course.properties.description}</p>
|
|
1850
|
-
<span className="text-2xl">${course.properties.price}</span>
|
|
1851
|
-
</header>
|
|
1852
|
-
|
|
1853
|
-
<!-- Lessons list (static) -->
|
|
1854
|
-
<section>
|
|
1855
|
-
<h2>Lessons</h2>
|
|
1856
|
-
{lessons.map(lesson => (
|
|
1857
|
-
<div>
|
|
1858
|
-
<h3>{lesson.name}</h3>
|
|
1859
|
-
<p>{lesson.properties.content}</p>
|
|
1860
|
-
</div>
|
|
1861
|
-
))}
|
|
1862
|
-
</section>
|
|
1863
|
-
|
|
1864
|
-
<!-- Interactive enrollment button (React Island) -->
|
|
1865
|
-
<EnrollButton client:load courseId={course._id} />
|
|
1866
|
-
</Layout>
|
|
1867
|
-
```
|
|
1868
|
-
|
|
1869
|
-
**Key Points:**
|
|
1870
|
-
- ✅ Calls backend API to get data
|
|
1871
|
-
- ✅ Renders static HTML
|
|
1872
|
-
- ✅ Fast initial load (SSR)
|
|
1873
|
-
- ❌ NO database access
|
|
1874
|
-
- ❌ NO business logic in page
|
|
1875
|
-
|
|
1876
|
-
---
|
|
1877
|
-
|
|
1878
|
-
## Real-Time Components
|
|
1879
|
-
|
|
1880
|
-
### Pattern: Subscribe to Backend Changes
|
|
1881
|
-
|
|
1882
|
-
```tsx
|
|
1883
|
-
// frontend/src/components/LiveEnrollmentCount.tsx
|
|
1884
|
-
import { useQuery } from 'convex/react'
|
|
1885
|
-
import { api } from '@/lib/api'
|
|
1886
|
-
|
|
1887
|
-
export function LiveEnrollmentCount({ courseId }: Props) {
|
|
1888
|
-
// Real-time subscription to backend
|
|
1889
|
-
// When ANYONE enrolls, this updates EVERYWHERE instantly
|
|
1890
|
-
const count = useQuery(api.queries.connections.getCount, {
|
|
1891
|
-
toThingId: courseId,
|
|
1892
|
-
relationshipType: 'enrolled_in'
|
|
1893
|
-
})
|
|
1894
|
-
|
|
1895
|
-
if (count === undefined) return <div>Loading...</div>
|
|
1896
|
-
|
|
1897
|
-
return (
|
|
1898
|
-
<div>
|
|
1899
|
-
<span className="text-3xl font-bold">{count}</span>
|
|
1900
|
-
<span className="text-sm text-gray-600"> students enrolled</span>
|
|
1901
|
-
</div>
|
|
1902
|
-
)
|
|
1903
|
-
}
|
|
1904
|
-
```
|
|
1905
|
-
|
|
1906
|
-
**How It Works:**
|
|
1907
|
-
1. Component subscribes to backend query via WebSocket
|
|
1908
|
-
2. Backend watches database for changes
|
|
1909
|
-
3. When connection created → backend pushes update to frontend
|
|
1910
|
-
4. Component auto-re-renders
|
|
1911
|
-
5. **Frontend does NOTHING except display the number**
|
|
1912
|
-
|
|
1913
|
-
---
|
|
1914
|
-
|
|
1915
|
-
## Forms (Calls Backend)
|
|
1916
|
-
|
|
1917
|
-
### Pattern: Collect Input, Send to Backend
|
|
1918
|
-
|
|
1919
|
-
```tsx
|
|
1920
|
-
// frontend/src/components/forms/ThingForm.tsx
|
|
1921
|
-
import { useMutation } from 'convex/react'
|
|
1922
|
-
import { api } from '@/lib/api'
|
|
1923
|
-
import { getThingConfig } from '@/ontology/config'
|
|
1924
|
-
import { useState } from 'react'
|
|
1925
|
-
|
|
1926
|
-
interface ThingFormProps {
|
|
1927
|
-
type: ThingType
|
|
1928
|
-
onSuccess?: (id: string) => void
|
|
1929
|
-
}
|
|
1930
|
-
|
|
1931
|
-
export function ThingForm({ type, onSuccess }: ThingFormProps) {
|
|
1932
|
-
const config = getThingConfig(type)
|
|
1933
|
-
const [formData, setFormData] = useState({})
|
|
1934
|
-
const [error, setError] = useState<string | null>(null)
|
|
1935
|
-
|
|
1936
|
-
// Backend mutation (frontend just calls it)
|
|
1937
|
-
const createThing = useMutation(api.mutations.things.create)
|
|
1938
|
-
|
|
1939
|
-
const handleSubmit = async (e: React.FormEvent) => {
|
|
1940
|
-
e.preventDefault()
|
|
1941
|
-
setError(null)
|
|
1942
|
-
|
|
1943
|
-
try {
|
|
1944
|
-
// Send to backend - backend validates, creates, logs events
|
|
1945
|
-
const id = await createThing({
|
|
1946
|
-
type,
|
|
1947
|
-
name: formData[config.primaryField],
|
|
1948
|
-
properties: formData
|
|
1949
|
-
})
|
|
1950
|
-
|
|
1951
|
-
onSuccess?.(id)
|
|
1952
|
-
} catch (err) {
|
|
1953
|
-
// Display backend error
|
|
1954
|
-
setError(err.message)
|
|
1955
|
-
}
|
|
1956
|
-
}
|
|
1957
|
-
|
|
1958
|
-
return (
|
|
1959
|
-
<form onSubmit={handleSubmit}>
|
|
1960
|
-
{/* Form fields from UI config */}
|
|
1961
|
-
{Object.entries(config.fields).map(([field, fieldConfig]) => (
|
|
1962
|
-
<div key={field}>
|
|
1963
|
-
<label>{fieldConfig.label}</label>
|
|
1964
|
-
<input
|
|
1965
|
-
type={fieldConfig.type}
|
|
1966
|
-
value={formData[field] || ''}
|
|
1967
|
-
onChange={(e) => setFormData({ ...formData, [field]: e.target.value })}
|
|
1968
|
-
placeholder={fieldConfig.placeholder}
|
|
1969
|
-
required={fieldConfig.required}
|
|
1970
|
-
/>
|
|
1971
|
-
</div>
|
|
1972
|
-
))}
|
|
1973
|
-
|
|
1974
|
-
{error && <div className="text-red-600">{error}</div>}
|
|
1975
|
-
|
|
1976
|
-
<button type="submit">Create</button>
|
|
1977
|
-
</form>
|
|
1978
|
-
)
|
|
1979
|
-
}
|
|
1980
|
-
```
|
|
1981
|
-
|
|
1982
|
-
**Key Points:**
|
|
1983
|
-
- ✅ Collects user input
|
|
1984
|
-
- ✅ Sends to backend mutation
|
|
1985
|
-
- ✅ Displays backend errors
|
|
1986
|
-
- ⚠️ Frontend validation is optional (UX only)
|
|
1987
|
-
- ❌ Backend MUST validate (security)
|
|
1988
|
-
- ❌ Frontend does NOT create database records
|
|
1989
|
-
|
|
1990
|
-
---
|
|
1991
|
-
|
|
1992
|
-
## Multi-Tenant Routing
|
|
1993
|
-
|
|
1994
|
-
### Middleware: Extract Org from Subdomain
|
|
1995
|
-
|
|
1996
|
-
```typescript
|
|
1997
|
-
// frontend/src/middleware.ts
|
|
1998
|
-
import { defineMiddleware } from 'astro:middleware'
|
|
1999
|
-
import { getConvexClient } from './lib/convex'
|
|
2000
|
-
import { api } from './lib/api'
|
|
2001
|
-
|
|
2002
|
-
export const onRequest = defineMiddleware(async (context, next) => {
|
|
2003
|
-
const url = new URL(context.request.url)
|
|
2004
|
-
|
|
2005
|
-
// Extract org slug from subdomain
|
|
2006
|
-
// fitnesspro.one.ie → "fitnesspro"
|
|
2007
|
-
const hostname = url.hostname
|
|
2008
|
-
const orgSlug = hostname.split('.')[0]
|
|
2009
|
-
|
|
2010
|
-
// Skip for main domains
|
|
2011
|
-
if (['api', 'www', 'localhost'].includes(orgSlug)) {
|
|
2012
|
-
return next()
|
|
2013
|
-
}
|
|
2014
|
-
|
|
2015
|
-
// Fetch org from backend
|
|
2016
|
-
const convex = getConvexClient()
|
|
2017
|
-
const org = await convex.query(api.queries.orgs.getBySlug, {
|
|
2018
|
-
slug: orgSlug
|
|
2019
|
-
})
|
|
2020
|
-
|
|
2021
|
-
if (org) {
|
|
2022
|
-
// Inject org context for pages to use
|
|
2023
|
-
context.locals.org = org
|
|
2024
|
-
context.locals.orgId = org._id
|
|
2025
|
-
}
|
|
2026
|
-
|
|
2027
|
-
return next()
|
|
2028
|
-
})
|
|
2029
|
-
```
|
|
2030
|
-
|
|
2031
|
-
### Use Org Context in Pages
|
|
2032
|
-
|
|
2033
|
-
```astro
|
|
2034
|
-
---
|
|
2035
|
-
// frontend/src/pages/courses/index.astro
|
|
2036
|
-
import { getConvexClient } from '@/lib/convex'
|
|
2037
|
-
import { api } from '@/lib/api'
|
|
2038
|
-
|
|
2039
|
-
// Get org from middleware
|
|
2040
|
-
const org = Astro.locals.org
|
|
2041
|
-
|
|
2042
|
-
if (!org) {
|
|
2043
|
-
return Astro.redirect('/404')
|
|
2044
|
-
}
|
|
2045
|
-
|
|
2046
|
-
// Fetch org's courses from backend
|
|
2047
|
-
const convex = getConvexClient()
|
|
2048
|
-
const courses = await convex.query(api.queries.things.list, {
|
|
2049
|
-
type: 'course',
|
|
2050
|
-
groupId: org._id // Backend filters by group
|
|
2051
|
-
})
|
|
2052
|
-
---
|
|
2053
|
-
|
|
2054
|
-
<Layout title={`${org.name} - Courses`}>
|
|
2055
|
-
<h1>{org.name} Courses</h1>
|
|
2056
|
-
|
|
2057
|
-
<!-- Display org's courses -->
|
|
2058
|
-
{courses.map(course => (
|
|
2059
|
-
<CourseCard thing={course} />
|
|
2060
|
-
))}
|
|
2061
|
-
</Layout>
|
|
2062
|
-
```
|
|
2063
|
-
|
|
2064
|
-
**Result:**
|
|
2065
|
-
- `fitnesspro.one.ie/courses` → FitnessPro courses only
|
|
2066
|
-
- `techcorp.one.ie/courses` → TechCorp courses only
|
|
2067
|
-
- **Backend enforces data isolation, frontend just passes orgId**
|
|
2068
|
-
|
|
2069
|
-
---
|
|
2070
|
-
|
|
2071
|
-
## Deployment
|
|
2072
|
-
|
|
2073
|
-
### Frontend Deployment (Separate from Backend)
|
|
2074
|
-
|
|
2075
|
-
```bash
|
|
2076
|
-
# Frontend (Astro)
|
|
2077
|
-
cd frontend
|
|
2078
|
-
npm run build
|
|
2079
|
-
# Deploy to Cloudflare Pages / Vercel / Netlify
|
|
2080
|
-
|
|
2081
|
-
# Backend (Convex - separate deployment)
|
|
2082
|
-
cd backend
|
|
2083
|
-
npx convex deploy
|
|
2084
|
-
# Deployed to shocking-falcon-870.convex.cloud
|
|
2085
|
-
```
|
|
2086
|
-
|
|
2087
|
-
### Environment Setup
|
|
2088
|
-
|
|
2089
|
-
```bash
|
|
2090
|
-
# Frontend .env
|
|
2091
|
-
PUBLIC_CONVEX_URL=https://shocking-falcon-870.convex.cloud
|
|
2092
|
-
|
|
2093
|
-
# Frontend connects to this URL
|
|
2094
|
-
# Frontend NEVER deploys to Convex
|
|
2095
|
-
# Frontend is static site on Cloudflare Pages
|
|
2096
|
-
```
|
|
2097
|
-
|
|
2098
|
-
---
|
|
2099
|
-
|
|
2100
|
-
## Summary
|
|
2101
|
-
|
|
2102
|
-
### Frontend Responsibilities (ONLY These)
|
|
2103
|
-
|
|
2104
|
-
| What | How | Example |
|
|
2105
|
-
|------|-----|---------|
|
|
2106
|
-
| **Render UI** | Astro pages + React components | `<h1>{course.name}</h1>` |
|
|
2107
|
-
| **Call Backend** | Effect.ts services or Convex hooks | `yield* courseService.get(id)` or `useQuery(api.queries.things.list)` |
|
|
2108
|
-
| **Manage UI State** | `useState`, `useReducer`, `useEffectRunner` | `const { run, loading, error } = useEffectRunner()` |
|
|
2109
|
-
| **Route Users** | Astro routing, middleware | `/courses/[id].astro` |
|
|
2110
|
-
| **Display Errors** | Show typed backend errors | `Effect.catchTag('NotFoundError', ...)` |
|
|
2111
|
-
|
|
2112
|
-
### Backend Responsibilities (See ontology-backend.md)
|
|
2113
|
-
|
|
2114
|
-
| What | Where | Example |
|
|
2115
|
-
|------|-------|---------|
|
|
2116
|
-
| **Database Operations** | Backend only | `ctx.db.query('things')...` |
|
|
2117
|
-
| **Business Logic** | Backend only | Calculate prices, check quotas |
|
|
2118
|
-
| **Data Validation** | Backend only | Validate email, check permissions |
|
|
2119
|
-
| **Event Logging** | Backend only | `ctx.db.insert('events', ...)` |
|
|
2120
|
-
| **Authorization** | Backend only | Check if user can access resource |
|
|
2121
|
-
|
|
2122
|
-
### The Contract
|
|
2123
|
-
|
|
2124
|
-
```typescript
|
|
2125
|
-
// Frontend → Backend (only way to interact)
|
|
2126
|
-
|
|
2127
|
-
// ✅ Frontend calls backend query
|
|
2128
|
-
const courses = useQuery(api.queries.things.list, { type: 'course' })
|
|
2129
|
-
|
|
2130
|
-
// ✅ Frontend calls backend mutation
|
|
2131
|
-
const create = useMutation(api.mutations.things.create)
|
|
2132
|
-
await create({ type: 'course', name: 'Fitness 101', properties: {...} })
|
|
2133
|
-
|
|
2134
|
-
// ✅ Backend implements logic
|
|
2135
|
-
export const create = mutation({
|
|
2136
|
-
handler: async (ctx, args) => {
|
|
2137
|
-
// Validate
|
|
2138
|
-
// Create in database
|
|
2139
|
-
// Log event
|
|
2140
|
-
// Return result
|
|
2141
|
-
}
|
|
2142
|
-
})
|
|
2143
|
-
|
|
2144
|
-
// ❌ Frontend NEVER accesses database directly
|
|
2145
|
-
const courses = await ctx.db.query('things') // IMPOSSIBLE in frontend
|
|
2146
|
-
```
|
|
2147
|
-
|
|
2148
|
-
### Key Principles
|
|
2149
|
-
|
|
2150
|
-
1. **Separation:** Frontend renders, backend manages data
|
|
2151
|
-
2. **Type-Safe:** Effect.ts enforces error handling, backend generates types
|
|
2152
|
-
3. **Composability:** Effect.ts services combine into complex flows
|
|
2153
|
-
4. **Real-Time:** WebSocket subscriptions auto-update UI
|
|
2154
|
-
5. **Multi-Tenant:** Middleware extracts org → pages filter by org
|
|
2155
|
-
6. **Testability:** Effect.ts test layers replace mocks
|
|
2156
|
-
7. **Stateless:** Frontend has no state beyond UI, backend is source of truth
|
|
2157
|
-
|
|
2158
|
-
### Next Steps
|
|
2159
|
-
|
|
2160
|
-
1. **Setup Backend First** (see ontology-backend.md)
|
|
2161
|
-
2. **Get Backend URL** from Convex deployment
|
|
2162
|
-
3. **Create Frontend** with `npm create astro@latest`
|
|
2163
|
-
4. **Install Effect.ts** - `npm install effect @effect/schema`
|
|
2164
|
-
5. **Add Convex Client** and set `PUBLIC_CONVEX_URL`
|
|
2165
|
-
6. **Create Client Services** (ThingClientService, CourseClientService, etc.)
|
|
2166
|
-
7. **Build ClientLayer** with all service dependencies
|
|
2167
|
-
8. **Create useEffectRunner Hook** for React integration
|
|
2168
|
-
9. **Sync Types** from backend to frontend
|
|
2169
|
-
10. **Build UI Config** for all 66 thing types
|
|
2170
|
-
11. **Create Generic Components** (ThingCard, ThingList, ThingForm)
|
|
2171
|
-
12. **Add Pages** that call backend via Effect.ts services
|
|
2172
|
-
13. **Deploy Frontend** to Cloudflare Pages
|
|
2173
|
-
|
|
2174
|
-
---
|
|
2175
|
-
|
|
2176
|
-
**Frontend is pure rendering. Backend is everything else.**
|
|
2177
|
-
|
|
2178
|
-
Effect.ts for type-safe composability. Separate deployments. Real-time updates.
|
|
2179
|
-
|
|
2180
|
-
---
|
|
2181
|
-
|
|
2182
|
-
## Additional Resources
|
|
2183
|
-
|
|
2184
|
-
### Effect.ts Documentation
|
|
2185
|
-
- [Frontend Integration](../things/docs/effect/frontend.mdx) - React + Effect.ts patterns
|
|
2186
|
-
- [Testing](../things/docs/effect/testing.mdx) - Test layers and no-mock testing
|
|
2187
|
-
- [Effect.ts Official Docs](https://effect.website) - Complete Effect.ts guide
|
|
2188
|
-
|
|
2189
|
-
### Related Guides
|
|
2190
|
-
- **ontology-backend.md** - Backend implementation (Convex + Effect.ts)
|
|
2191
|
-
- **ontology-documentation.md** - Complete ontology overview
|
|
2192
|
-
- **Ontology.md** - Full technical specification
|
|
2193
|
-
|
|
2194
|
-
---
|
|
2195
|
-
|
|
2196
|
-
**END OF FRONTEND GUIDE**
|