oneie 2.0.1 → 2.0.3
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/AGENTS.md +245 -0
- package/CLAUDE.md +534 -0
- package/README.md +61 -4
- package/one/.obsidian/app.json +1 -0
- package/one/.obsidian/appearance.json +1 -0
- package/one/.obsidian/core-plugins.json +33 -0
- package/one/.obsidian/workspace.json +211 -0
- package/one/connections/a2a.md +551 -0
- package/one/connections/acp.md +761 -0
- package/one/connections/acps.md +731 -0
- package/one/connections/agui.md +767 -0
- package/one/connections/any-backend.md +1702 -0
- package/one/connections/ap2.md +998 -0
- package/one/connections/api-docs.md +1891 -0
- package/one/connections/api.md +2190 -0
- package/one/connections/architecture-diagram.md +94 -0
- package/one/connections/communications.md +449 -0
- package/one/connections/connections.md +339 -0
- package/one/connections/cryptonetworks.md +781 -0
- package/one/connections/documentation.md +1120 -0
- package/one/connections/effect.md +279 -0
- package/one/connections/elizaos.md +1290 -0
- package/one/connections/inference.md +58 -0
- package/one/connections/kyc.md +632 -0
- package/one/connections/mcp.md +842 -0
- package/one/connections/membership.md +1152 -0
- package/one/connections/middleware.md +1067 -0
- package/one/connections/multitenant.md +1341 -0
- package/one/connections/n8n.md +1015 -0
- package/one/connections/patterns.md +89 -0
- package/one/connections/protocols.md +279 -0
- package/one/connections/relationships.md +107 -0
- package/one/connections/schema.md +587 -0
- package/one/connections/service-layer.md +550 -0
- package/one/connections/structure.md +0 -0
- package/one/connections/vectors.md +207 -0
- package/one/connections/wordpress.md +1302 -0
- package/one/connections/workflow-copy.md +905 -0
- package/one/connections/workflow-examples.md +741 -0
- package/one/connections/workflow.md +905 -0
- package/one/connections/workflows/delegation.md +885 -0
- package/one/connections/workflows/frontend.md +1037 -0
- package/one/connections/workflows/strategy.md +903 -0
- package/one/connections/workflows/tasks.md +698 -0
- package/one/connections/x402.md +1249 -0
- package/one/events/events.md +545 -0
- package/one/knowledge/ai-platform.md +305 -0
- package/one/knowledge/architecture-diagram.md +94 -0
- package/one/knowledge/architecture-frontend.md +930 -0
- package/one/knowledge/architecture.md +2077 -0
- package/one/knowledge/crypto.md +960 -0
- package/one/knowledge/dsl.md +1660 -0
- package/one/knowledge/files.md +2471 -0
- package/one/knowledge/frontend.md +1038 -0
- package/one/knowledge/hono.md +2109 -0
- package/one/knowledge/implementation-examples.md +2536 -0
- package/one/knowledge/inference-score.md +159 -0
- package/one/knowledge/knowledge.md +642 -0
- package/one/knowledge/language.md +980 -0
- package/one/knowledge/lessons-learned.md +70 -0
- package/one/knowledge/ontology-6-dimensions.md +0 -0
- package/one/knowledge/ontology-documentation.md +356 -0
- package/one/knowledge/ontology-engineering-specification.md +1292 -0
- package/one/knowledge/ontology-engineering.md +1652 -0
- package/one/knowledge/ontology-frontend-copy-2.md +1492 -0
- package/one/knowledge/ontology-frontend-copy.md +753 -0
- package/one/knowledge/ontology-frontend-specifications.md +2188 -0
- package/one/knowledge/ontology-frontend.md +2427 -0
- package/one/knowledge/ontology-minimal.yaml +299 -0
- package/one/knowledge/ontology.md +2819 -0
- package/one/knowledge/ontology.yaml +1165 -0
- package/one/knowledge/patterns/backend/convex-mutation-pattern.md +100 -0
- package/one/knowledge/patterns/backend/convex-query-pattern.md +88 -0
- package/one/knowledge/patterns/backend/mutation-template.md +231 -0
- package/one/knowledge/patterns/backend/query-template.md +267 -0
- package/one/knowledge/patterns/backend/service-template.md +237 -0
- package/one/knowledge/patterns/design/component-architecture.md +399 -0
- package/one/knowledge/patterns/design/test-driven-design-pattern.md +162 -0
- package/one/knowledge/patterns/design/wireframe-template.md +216 -0
- package/one/knowledge/patterns/frontend/component-template.md +195 -0
- package/one/knowledge/patterns/frontend/form-template.md +276 -0
- package/one/knowledge/patterns/frontend/page-template.md +178 -0
- package/one/knowledge/patterns/frontend/react-component-pattern.md +128 -0
- package/one/knowledge/patterns/test/acceptance-criteria-template.md +378 -0
- package/one/knowledge/patterns/test/technical-test-template.md +544 -0
- package/one/knowledge/patterns/test/test-driven-pattern.md +140 -0
- package/one/knowledge/patterns/test/user-flow-template.md +254 -0
- package/one/knowledge/quality-loop.md +401 -0
- package/one/knowledge/readme.md +131 -0
- package/one/knowledge/rules.md +626 -0
- package/one/knowledge/score.md +67 -0
- package/one/knowledge/specifications.md +855 -0
- package/one/knowledge/tags.md +130 -0
- package/one/organisation/one.md +599 -0
- package/one/organisation/organisation.md +438 -0
- package/one/organisation/revenue.md +673 -0
- package/one/organisation/strategy.md +869 -0
- package/one/organisation/vision.md +98 -0
- package/one/people/anthony-o-connell.md +440 -0
- package/one/people/people.md +567 -0
- package/one/repomix-output.md +92634 -0
- package/one/things/agentkit.md +349 -0
- package/one/things/agents/agent-backend.md +1401 -0
- package/one/things/agents/agent-builder.md +955 -0
- package/one/things/agents/agent-clean.md +709 -0
- package/one/things/agents/agent-clone.md +1341 -0
- package/one/things/agents/agent-designer.md +2177 -0
- package/one/things/agents/agent-director.md +1508 -0
- package/one/things/agents/agent-documenter.md +1049 -0
- package/one/things/agents/agent-frontend.md +1119 -0
- package/one/things/agents/agent-integrator.md +1192 -0
- package/one/things/agents/agent-problem-solver.md +1379 -0
- package/one/things/agents/agent-quality.md +1353 -0
- package/one/things/agents/agent-sales.md +986 -0
- package/one/things/cascade/cascade.yaml +464 -0
- package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +470 -0
- package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +264 -0
- package/one/things/cascade/docs/examples/1-1-agent-prompts.md +486 -0
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +497 -0
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +227 -0
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +516 -0
- package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +544 -0
- package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +223 -0
- package/one/things/cascade/docs/examples/1-3-event-coordination.md +508 -0
- package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +609 -0
- package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +195 -0
- package/one/things/cascade/docs/examples/1-4-knowledge-management.md +577 -0
- package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +797 -0
- package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +212 -0
- package/one/things/cascade/docs/examples/1-5-quality-loops.md +641 -0
- package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +610 -0
- package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +213 -0
- package/one/things/cascade/docs/examples/1-6-numbering-structure.md +575 -0
- package/one/things/cascade/docs/examples/readme.md +222 -0
- package/one/things/cascade/docs/getting-started.md +515 -0
- package/one/things/cascade/docs/workflow.md +1372 -0
- package/one/things/cascade/readme.md +336 -0
- package/one/things/cascade/templates/feature-template.md +267 -0
- package/one/things/claude/agents/advocacy-activation-manager.md +685 -0
- package/one/things/claude/agents/advocacy-campaign-designer.md +663 -0
- package/one/things/claude/agents/analyst.md +483 -0
- package/one/things/claude/agents/architect.md +480 -0
- package/one/things/claude/agents/brand-identity-specialist.md +513 -0
- package/one/things/claude/agents/bstp-token-strategist.md +667 -0
- package/one/things/claude/agents/builder-repo.md +489 -0
- package/one/things/claude/agents/bullstamp-community-builder.md +574 -0
- package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +506 -0
- package/one/things/claude/agents/bulltilt-platform-growth.md +567 -0
- package/one/things/claude/agents/company-bullstamp-character.md +587 -0
- package/one/things/claude/agents/company-bullstamp-community.md +292 -0
- package/one/things/claude/agents/company-bullstamp-marketing.md +292 -0
- package/one/things/claude/agents/company-bullstamp-token.md +292 -0
- package/one/things/claude/agents/company-bulltilt-growth.md +292 -0
- package/one/things/claude/agents/content-bibliography-formatter.md +381 -0
- package/one/things/claude/agents/content-calendar-planner.md +448 -0
- package/one/things/claude/agents/content-chapter-formatter.md +488 -0
- package/one/things/claude/agents/content-formatter.md +546 -0
- package/one/things/claude/agents/content-hook-specialist.md +462 -0
- package/one/things/claude/agents/content-image-formatter.md +535 -0
- package/one/things/claude/agents/content-introduction-formatter.md +485 -0
- package/one/things/claude/agents/content-multiplication-engine.md +556 -0
- package/one/things/claude/agents/content-playbook-writer.md +448 -0
- package/one/things/claude/agents/content-team-manager.md +622 -0
- package/one/things/claude/agents/content-toc-formatter.md +522 -0
- package/one/things/claude/agents/convex-backend-specialist.md +2561 -0
- package/one/things/claude/agents/core-manager.md +582 -0
- package/one/things/claude/agents/core-master.md +403 -0
- package/one/things/claude/agents/cross-functional-manager.md +471 -0
- package/one/things/claude/agents/crypto-airdrop-strategist.md +602 -0
- package/one/things/claude/agents/crypto-analytics-educator.md +553 -0
- package/one/things/claude/agents/crypto-architecture-specialist.md +466 -0
- package/one/things/claude/agents/crypto-community-analyst.md +298 -0
- package/one/things/claude/agents/crypto-community-psychologist.md +509 -0
- package/one/things/claude/agents/crypto-dex-optimization-expert.md +538 -0
- package/one/things/claude/agents/crypto-dex-optimizer.md +292 -0
- package/one/things/claude/agents/crypto-diamond-formation-specialist.md +513 -0
- package/one/things/claude/agents/crypto-diamond-hands.md +292 -0
- package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +554 -0
- package/one/things/claude/agents/crypto-engagement-specialist.md +540 -0
- package/one/things/claude/agents/crypto-market-researcher.md +292 -0
- package/one/things/claude/agents/crypto-marketing-orchestrator.md +523 -0
- package/one/things/claude/agents/crypto-network-effect-amplifier.md +569 -0
- package/one/things/claude/agents/crypto-optimization-analyst.md +554 -0
- package/one/things/claude/agents/crypto-strategic-synthesizer.md +517 -0
- package/one/things/claude/agents/crypto-team-manager.md +387 -0
- package/one/things/claude/agents/crypto-token-analyst.md +278 -0
- package/one/things/claude/agents/crypto-viral-content-creator.md +546 -0
- package/one/things/claude/agents/crypto-wallet-identification-expert.md +517 -0
- package/one/things/claude/agents/crypto-wallet-identifier.md +292 -0
- package/one/things/claude/agents/customer-journey-designer.md +481 -0
- package/one/things/claude/agents/customer-success-manager.md +581 -0
- package/one/things/claude/agents/dev.md +413 -0
- package/one/things/claude/agents/documenter.md +546 -0
- package/one/things/claude/agents/elevate-marketing-orchestrator.md +410 -0
- package/one/things/claude/agents/engagement-specialist.md +509 -0
- package/one/things/claude/agents/engineering-architect.md +387 -0
- package/one/things/claude/agents/engineering-business-analyst.md +537 -0
- package/one/things/claude/agents/engineering-developer.md +387 -0
- package/one/things/claude/agents/engineering-director.md +282 -0
- package/one/things/claude/agents/engineering-ingestor.md +649 -0
- package/one/things/claude/agents/engineering-product-manager.md +537 -0
- package/one/things/claude/agents/engineering-product-owner.md +537 -0
- package/one/things/claude/agents/engineering-project-coordinator.md +537 -0
- package/one/things/claude/agents/engineering-quality-assurance.md +393 -0
- package/one/things/claude/agents/engineering-team-manager.md +512 -0
- package/one/things/claude/agents/engineering-user-experience.md +387 -0
- package/one/things/claude/agents/framework-elevate-manager.md +294 -0
- package/one/things/claude/agents/improver.md +763 -0
- package/one/things/claude/agents/intelligence-team-manager.md +385 -0
- package/one/things/claude/agents/lead-capture-expert.md +466 -0
- package/one/things/claude/agents/lead-magnet-creator.md +453 -0
- package/one/things/claude/agents/market-research-analyst.md +412 -0
- package/one/things/claude/agents/marketing-brand-identity.md +314 -0
- package/one/things/claude/agents/marketing-content-hooks.md +450 -0
- package/one/things/claude/agents/marketing-content-multiplier.md +326 -0
- package/one/things/claude/agents/marketing-content-poster.md +361 -0
- package/one/things/claude/agents/marketing-customer-journey.md +326 -0
- package/one/things/claude/agents/marketing-director.md +397 -0
- package/one/things/claude/agents/marketing-engagement.md +326 -0
- package/one/things/claude/agents/marketing-lead-capture.md +326 -0
- package/one/things/claude/agents/marketing-lead-magnet.md +326 -0
- package/one/things/claude/agents/marketing-network-effects.md +326 -0
- package/one/things/claude/agents/marketing-nurture-campaigns.md +326 -0
- package/one/things/claude/agents/marketing-share-optimizer.md +326 -0
- package/one/things/claude/agents/marketing-team-manager.md +446 -0
- package/one/things/claude/agents/marketing-viral-growth.md +201 -0
- package/one/things/claude/agents/mission-commander.md +373 -0
- package/one/things/claude/agents/network-effect-analyst.md +587 -0
- package/one/things/claude/agents/nextjs-15-specialist.md +1547 -0
- package/one/things/claude/agents/npx.md +890 -0
- package/one/things/claude/agents/nurture-campaign-manager.md +531 -0
- package/one/things/claude/agents/one-master.md +355 -0
- package/one/things/claude/agents/one-orchestrator.md +315 -0
- package/one/things/claude/agents/one.md +601 -0
- package/one/things/claude/agents/playbook-generator.md +503 -0
- package/one/things/claude/agents/pm.md +326 -0
- package/one/things/claude/agents/po.md +345 -0
- package/one/things/claude/agents/qa.md +336 -0
- package/one/things/claude/agents/research-foundation-analyst.md +307 -0
- package/one/things/claude/agents/research-intelligence-gatherer.md +408 -0
- package/one/things/claude/agents/research-market-analyst.md +307 -0
- package/one/things/claude/agents/research-team-manager.md +482 -0
- package/one/things/claude/agents/sales-environment-optimizer.md +494 -0
- package/one/things/claude/agents/sales-team-manager.md +400 -0
- package/one/things/claude/agents/sales-upsell-strategist.md +307 -0
- package/one/things/claude/agents/service-advocacy-campaigns.md +307 -0
- package/one/things/claude/agents/service-advocacy-manager.md +307 -0
- package/one/things/claude/agents/service-success-manager.md +307 -0
- package/one/things/claude/agents/service-team-manager.md +400 -0
- package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +2302 -0
- package/one/things/claude/agents/share-optimization-specialist.md +551 -0
- package/one/things/claude/agents/sm.md +327 -0
- package/one/things/claude/agents/story-teller.md +473 -0
- package/one/things/claude/agents/task-master.md +596 -0
- package/one/things/claude/agents/tauri-cross-platform-specialist.md +1827 -0
- package/one/things/claude/agents/tester.md +556 -0
- package/one/things/claude/agents/the-bull-character-manager.md +580 -0
- package/one/things/claude/agents/tools-playbook-generator.md +489 -0
- package/one/things/claude/agents/turbo-repo-builder.md +316 -0
- package/one/things/claude/agents/upsell-strategist.md +480 -0
- package/one/things/claude/agents/ux-expert.md +335 -0
- package/one/things/claude/agents/viral-growth-orchestrator.md +497 -0
- package/one/things/claude/claude-code-hooks-development.json +21 -0
- package/one/things/claude/claude-code-hooks-production.json +21 -0
- package/one/things/claude/claude-code-hooks.json +25 -0
- package/one/things/claude/commands/agent.md +104 -0
- package/one/things/claude/commands/cascade-status.md +128 -0
- package/one/things/claude/commands/ingest.md +290 -0
- package/one/things/claude/commands/ingestor.md +136 -0
- package/one/things/claude/commands/mission.md +83 -0
- package/one/things/claude/commands/npx.md +133 -0
- package/one/things/claude/commands/one.md +440 -0
- package/one/things/claude/commands/quality-check.md +204 -0
- package/one/things/claude/commands/smart-route.md +220 -0
- package/one/things/claude/commands/start.md +121 -0
- package/one/things/claude/commands/story.md +83 -0
- package/one/things/claude/commands/task.md +173 -0
- package/one/things/claude/hook-bypass.json +32 -0
- package/one/things/claude/hooks/agent-hook-config.json +427 -0
- package/one/things/claude/hooks/agent-hook-manager.js +525 -0
- package/one/things/claude/hooks/agent-load-balancer.js +271 -0
- package/one/things/claude/hooks/agent-request-interceptor.js +70 -0
- package/one/things/claude/hooks/build-hook.sh +156 -0
- package/one/things/claude/hooks/cascade-feedback.js +297 -0
- package/one/things/claude/hooks/cascade-integration-hooks.js +648 -0
- package/one/things/claude/hooks/cleanup-hook.sh +201 -0
- package/one/things/claude/hooks/continuous-improvement-monitor.js +510 -0
- package/one/things/claude/hooks/file-organization-engine.js +427 -0
- package/one/things/claude/hooks/file-organization-hook.sh +80 -0
- package/one/things/claude/hooks/file-organization-monitor.js +269 -0
- package/one/things/claude/hooks/format-hook.sh +43 -0
- package/one/things/claude/hooks/hook-bypass.sh +293 -0
- package/one/things/claude/hooks/hook-config-manager.js +202 -0
- package/one/things/claude/hooks/hook-debouncer.sh +62 -0
- package/one/things/claude/hooks/hook-logger.sh +89 -0
- package/one/things/claude/hooks/hook-orchestrator.js +662 -0
- package/one/things/claude/hooks/hook-performance-report.js +120 -0
- package/one/things/claude/hooks/lint-hook.sh +140 -0
- package/one/things/claude/hooks/mcp-cascade-integration.js +816 -0
- package/one/things/claude/hooks/memory-optimizer.js +510 -0
- package/one/things/claude/hooks/notification-hook.sh +204 -0
- package/one/things/claude/hooks/ontology-compliance.js +394 -0
- package/one/things/claude/hooks/ontology-hook-manager.js +316 -0
- package/one/things/claude/hooks/ontology-validation-engine.js +317 -0
- package/one/things/claude/hooks/ontology-validation-hook.sh +86 -0
- package/one/things/claude/hooks/performance-metrics.json +25 -0
- package/one/things/claude/hooks/performance-monitoring-hook.js +422 -0
- package/one/things/claude/hooks/quality-scoring-engine.js +834 -0
- package/one/things/claude/hooks/security-hook.sh +256 -0
- package/one/things/claude/hooks/simple-load-balancer.js +238 -0
- package/one/things/claude/hooks/startup-optimizer.js +625 -0
- package/one/things/claude/hooks/story-scoring-system.js +445 -0
- package/one/things/claude/hooks/story-validation-engine.js +473 -0
- package/one/things/claude/hooks/story-validation-hook-enhanced.sh +210 -0
- package/one/things/claude/hooks/story-validation-hook.sh +145 -0
- package/one/things/claude/hooks/structure-synchronizer.js +194 -0
- package/one/things/claude/hooks/sub-agent-output-validator.js +647 -0
- package/one/things/claude/hooks/sub-agent-validation-hook.js +343 -0
- package/one/things/claude/hooks/test-hook.sh +145 -0
- package/one/things/claude/hooks/test-story-validation.sh +170 -0
- package/one/things/claude/hooks/trinity-validation-system.js +392 -0
- package/one/things/claude/settings-local.json +86 -0
- package/one/things/cli-code.md +652 -0
- package/one/things/cli-compiler-code.md +652 -0
- package/one/things/cli.md +1045 -0
- package/one/things/components/card-shadcn.md +929 -0
- package/one/things/components/card.md +1050 -0
- package/one/things/components.md +1669 -0
- package/one/things/componets.md +4 -0
- package/one/things/copilotkit.md +1559 -0
- package/one/things/creator-diagram.md +166 -0
- package/one/things/examples/children/lemonade-stand.md +366 -0
- package/one/things/examples/enterprise/crm-saas.md +1429 -0
- package/one/things/features/1-1-agent-prompts/design.md +470 -0
- package/one/things/features/1-1-agent-prompts/tests.md +264 -0
- package/one/things/features/1-1-agent-prompts.md +486 -0
- package/one/things/features/1-2-yaml-orchestrator/design.md +497 -0
- package/one/things/features/1-2-yaml-orchestrator/tests.md +227 -0
- package/one/things/features/1-2-yaml-orchestrator.md +516 -0
- package/one/things/features/1-3-event-coordination/design.md +544 -0
- package/one/things/features/1-3-event-coordination/tests.md +223 -0
- package/one/things/features/1-3-event-coordination.md +508 -0
- package/one/things/features/1-4-knowledge-management/design.md +609 -0
- package/one/things/features/1-4-knowledge-management/tests.md +195 -0
- package/one/things/features/1-4-knowledge-management.md +577 -0
- package/one/things/features/1-5-quality-loops/design.md +797 -0
- package/one/things/features/1-5-quality-loops/tests.md +212 -0
- package/one/things/features/1-5-quality-loops.md +641 -0
- package/one/things/features/1-6-numbering-structure/design.md +610 -0
- package/one/things/features/1-6-numbering-structure/tests.md +213 -0
- package/one/things/features/1-6-numbering-structure.md +575 -0
- package/one/things/features/2-cli.md +1235 -0
- package/one/things/features/use-one-backend.md +1180 -0
- package/one/things/ideas/1-create-workflow.md +189 -0
- package/one/things/plans/1-create-workflow-status.md +555 -0
- package/one/things/plans/1-create-workflow.md +713 -0
- package/one/things/plans/app.md +761 -0
- package/one/things/plans/better-auth-any-backend-revised.md +1065 -0
- package/one/things/plans/better-auth-any-backend.md +1852 -0
- package/one/things/plans/better-auth-available-features.md +235 -0
- package/one/things/plans/big-plan.md +38 -0
- package/one/things/plans/convex-better-auth.md +1109 -0
- package/one/things/plans/convex-on-off.md +389 -0
- package/one/things/plans/desktop.md +1121 -0
- package/one/things/plans/effect-components.md +1669 -0
- package/one/things/plans/effect.md +973 -0
- package/one/things/plans/email.md +953 -0
- package/one/things/plans/enhance-auth.md +1669 -0
- package/one/things/plans/install-components.md +198 -0
- package/one/things/plans/landing.md +728 -0
- package/one/things/plans/layout.md +205 -0
- package/one/things/plans/mail-backend.md +1308 -0
- package/one/things/plans/mail.md +2624 -0
- package/one/things/plans/next-features.md +83 -0
- package/one/things/plans/one.md +658 -0
- package/one/things/plans/ontology-6-dimensions.md +2216 -0
- package/one/things/plans/ontology-driven-strategy.md +866 -0
- package/one/things/plans/ontology-ui-approach.md +357 -0
- package/one/things/plans/open-agent.md +785 -0
- package/one/things/plans/performace.md +90 -0
- package/one/things/plans/releases.md +809 -0
- package/one/things/plans/repos.md +76 -0
- package/one/things/plans/separate-copy-2.md +1293 -0
- package/one/things/plans/separate-copy-3.md +2458 -0
- package/one/things/plans/separate-copy.md +1293 -0
- package/one/things/plans/separate.md +1983 -0
- package/one/things/plans/shadcn-integration-summary.md +450 -0
- package/one/things/plans/sidebar.md +172 -0
- package/one/things/plans/small-fixes.md +5 -0
- package/one/things/plans/test-backend-connection.md +476 -0
- package/one/things/plans/workflow-files.md +1196 -0
- package/one/things/plans/workflow.md +1372 -0
- package/one/things/products/cascade-landing-page.md +737 -0
- package/one/things/products/cascade.md +1518 -0
- package/one/things/products/context-engineering.md +1427 -0
- package/one/things/products/onthology.md +0 -0
- package/one/things/products/ontology-ui-shadcn.md +1280 -0
- package/one/things/products/ontology-ui.md +1387 -0
- package/one/things/products/ontology.md +717 -0
- package/one/things/products/sdk.md +557 -0
- package/one/things/promptkit.md +903 -0
- package/one/things/service-providers-new.md +982 -0
- package/one/things/service-providers.md +1092 -0
- package/one/things/things.md +349 -0
- package/one/things/todo.md +1248 -0
- package/package.json +5 -2
|
@@ -0,0 +1,1180 @@
|
|
|
1
|
+
# Use ONE Backend - Backend as a Service
|
|
2
|
+
|
|
3
|
+
**Enable any developer to use ONE's 6-dimension backend without building their own**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Executive Summary
|
|
8
|
+
|
|
9
|
+
The "Use ONE Backend" feature transforms the ONE platform from a standalone product into a **Backend as a Service (BaaS)** that any developer can opt into. With a single toggle, developers get instant access to:
|
|
10
|
+
|
|
11
|
+
- ✅ **Auth System**: 6 authentication methods via Better Auth + ONE ontology
|
|
12
|
+
- ✅ **6-Dimension Database**: Organizations, People, Things, Connections, Events, Knowledge
|
|
13
|
+
- ✅ **Real-time Sync**: Convex-powered subscriptions
|
|
14
|
+
- ✅ **Multi-tenancy**: Automatic organization isolation
|
|
15
|
+
- ✅ **Effect.ts SDK**: Type-safe, composable operations
|
|
16
|
+
- ✅ **API Keys**: Secure programmatic access
|
|
17
|
+
- ✅ **Free Tier**: Start with zero cost
|
|
18
|
+
|
|
19
|
+
**Architecture:**
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
┌─────────────────────────────────────────────────────────┐
|
|
23
|
+
│ Developer's Frontend (React/Astro/Vue) │
|
|
24
|
+
│ - Install: npm install @oneie/sdk │
|
|
25
|
+
│ - Configure: USE_ONE_BACKEND=true │
|
|
26
|
+
│ - Deploy: Anywhere (Vercel, Netlify, Cloudflare) │
|
|
27
|
+
└────────────────┬────────────────────────────────────────┘
|
|
28
|
+
│ DataProvider + API Key
|
|
29
|
+
↓
|
|
30
|
+
┌─────────────────────────────────────────────────────────┐
|
|
31
|
+
│ ONE Backend (BaaS) │
|
|
32
|
+
│ - URL: https://api.one.ie │
|
|
33
|
+
│ - Auth: Better Auth (6 methods) │
|
|
34
|
+
│ - Database: 6-dimension ontology │
|
|
35
|
+
│ - Real-time: Convex subscriptions │
|
|
36
|
+
│ - Rate Limiting: Per API key │
|
|
37
|
+
│ - Multi-tenant: Automatic isolation │
|
|
38
|
+
└─────────────────────────────────────────────────────────┘
|
|
39
|
+
│
|
|
40
|
+
↓
|
|
41
|
+
┌─────────────────────────────────────────────────────────┐
|
|
42
|
+
│ ONE Platform (Convex Backend) │
|
|
43
|
+
│ Production: https://shocking-falcon-870.convex.cloud │
|
|
44
|
+
│ │
|
|
45
|
+
│ Tables: │
|
|
46
|
+
│ - organizations: Multi-tenant isolation │
|
|
47
|
+
│ - people: Users with roles │
|
|
48
|
+
│ - things: Domain entities (66+ types) │
|
|
49
|
+
│ - connections: Relationships (25+ types) │
|
|
50
|
+
│ - events: Complete audit trail (67+ types) │
|
|
51
|
+
│ - knowledge: Vector embeddings for AI │
|
|
52
|
+
└─────────────────────────────────────────────────────────┘
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**What This Enables:**
|
|
56
|
+
|
|
57
|
+
1. **Instant Auth**: Sign up users via Google/GitHub/Email without building auth
|
|
58
|
+
2. **Instant Database**: Store people, products, posts, etc. in the ontology
|
|
59
|
+
3. **Instant Real-time**: Subscribe to changes without WebSocket setup
|
|
60
|
+
4. **Instant Multi-tenancy**: Organizations automatically isolate data
|
|
61
|
+
5. **Instant AI**: Vector search on knowledge without embedding infrastructure
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Table of Contents
|
|
66
|
+
|
|
67
|
+
1. [How It Works](#how-it-works)
|
|
68
|
+
2. [Developer Onboarding Flow](#developer-onboarding-flow)
|
|
69
|
+
3. [Configuration & Environment Variables](#configuration--environment-variables)
|
|
70
|
+
4. [API Key Management](#api-key-management)
|
|
71
|
+
5. [Authentication Integration](#authentication-integration)
|
|
72
|
+
6. [Database Operations](#database-operations)
|
|
73
|
+
7. [SDK & DataProvider](#sdk--dataprovider)
|
|
74
|
+
8. [Rate Limiting & Quotas](#rate-limiting--quotas)
|
|
75
|
+
9. [Pricing Tiers](#pricing-tiers)
|
|
76
|
+
10. [Migration Path](#migration-path)
|
|
77
|
+
11. [Security & Isolation](#security--isolation)
|
|
78
|
+
12. [Example Use Cases](#example-use-cases)
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## How It Works
|
|
83
|
+
|
|
84
|
+
### Toggle-Based Opt-In
|
|
85
|
+
|
|
86
|
+
Developers opt in via environment variable:
|
|
87
|
+
|
|
88
|
+
```env
|
|
89
|
+
# .env
|
|
90
|
+
USE_ONE_BACKEND=true
|
|
91
|
+
PUBLIC_ONE_API_KEY=ok_live_abc123def456
|
|
92
|
+
PUBLIC_ONE_ORG_ID=org_789xyz
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**When `USE_ONE_BACKEND=true`:**
|
|
96
|
+
|
|
97
|
+
1. ✅ Auth requests route to `api.one.ie` instead of local backend
|
|
98
|
+
2. ✅ Database operations use ONE's Convex deployment
|
|
99
|
+
3. ✅ Organization & people created automatically via API
|
|
100
|
+
4. ✅ API key injected into all requests
|
|
101
|
+
5. ✅ Multi-tenancy enforced by ONE backend
|
|
102
|
+
|
|
103
|
+
**When `USE_ONE_BACKEND=false` (default):**
|
|
104
|
+
|
|
105
|
+
- Everything runs locally (self-hosted)
|
|
106
|
+
- Developer owns the backend
|
|
107
|
+
- Full control, full responsibility
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Developer Onboarding Flow
|
|
112
|
+
|
|
113
|
+
### Step 1: Sign Up on ONE Platform
|
|
114
|
+
|
|
115
|
+
Developer visits **https://one.ie/signup**:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
1. Create account (john@example.com)
|
|
119
|
+
2. Verify email
|
|
120
|
+
3. Choose plan: Starter (free) → Pro → Enterprise
|
|
121
|
+
4. Organization created: "john-example" (org_abc123)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Step 2: Enable "Use ONE Backend"
|
|
125
|
+
|
|
126
|
+
Dashboard toggle:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
┌────────────────────────────────────────────────┐
|
|
130
|
+
│ Backend Settings │
|
|
131
|
+
├────────────────────────────────────────────────┤
|
|
132
|
+
│ │
|
|
133
|
+
│ ☑ Use ONE Backend (BaaS) │
|
|
134
|
+
│ │
|
|
135
|
+
│ Your applications can connect to our │
|
|
136
|
+
│ managed backend instead of self-hosting. │
|
|
137
|
+
│ │
|
|
138
|
+
│ ✅ Auth (6 methods) │
|
|
139
|
+
│ ✅ Database (6 dimensions) │
|
|
140
|
+
│ ✅ Real-time sync │
|
|
141
|
+
│ ✅ Free tier: 10K API calls/month │
|
|
142
|
+
│ │
|
|
143
|
+
│ [Enable Backend Access] ← Click │
|
|
144
|
+
└────────────────────────────────────────────────┘
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**What Happens:**
|
|
148
|
+
|
|
149
|
+
1. **Organization Thing Created** (if not exists):
|
|
150
|
+
```typescript
|
|
151
|
+
{
|
|
152
|
+
_id: "org_abc123",
|
|
153
|
+
type: "organization",
|
|
154
|
+
name: "john-example",
|
|
155
|
+
slug: "john-example",
|
|
156
|
+
status: "active",
|
|
157
|
+
plan: "starter",
|
|
158
|
+
limits: {
|
|
159
|
+
users: 100,
|
|
160
|
+
apiCalls: 10000,
|
|
161
|
+
storage: 1000000, // 1 GB
|
|
162
|
+
inference: 100 // AI queries
|
|
163
|
+
},
|
|
164
|
+
settings: {
|
|
165
|
+
allowSignups: true,
|
|
166
|
+
requireEmailVerification: true,
|
|
167
|
+
enableTwoFactor: false
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
2. **Person Thing Created** (developer):
|
|
173
|
+
```typescript
|
|
174
|
+
{
|
|
175
|
+
_id: "person_john_123",
|
|
176
|
+
type: "creator",
|
|
177
|
+
email: "john@example.com",
|
|
178
|
+
role: "org_owner",
|
|
179
|
+
organizationId: "org_abc123",
|
|
180
|
+
organizations: ["org_abc123"]
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
3. **API Key Generated**:
|
|
185
|
+
```typescript
|
|
186
|
+
{
|
|
187
|
+
key: "ok_live_abc123def456",
|
|
188
|
+
organizationId: "org_abc123",
|
|
189
|
+
createdBy: "person_john_123",
|
|
190
|
+
permissions: ["read", "write", "auth"],
|
|
191
|
+
rateLimit: {
|
|
192
|
+
calls: 10000, // per month
|
|
193
|
+
window: "monthly"
|
|
194
|
+
},
|
|
195
|
+
status: "active",
|
|
196
|
+
expiresAt: null // never expires (unless revoked)
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Step 3: Install SDK
|
|
201
|
+
|
|
202
|
+
Developer installs SDK in their project:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
npm install @oneie/sdk
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Step 4: Configure Environment
|
|
209
|
+
|
|
210
|
+
Add credentials to `.env`:
|
|
211
|
+
|
|
212
|
+
```env
|
|
213
|
+
# .env
|
|
214
|
+
|
|
215
|
+
# Toggle ONE Backend usage
|
|
216
|
+
USE_ONE_BACKEND=true
|
|
217
|
+
|
|
218
|
+
# ONE Platform credentials
|
|
219
|
+
PUBLIC_ONE_API_URL=https://api.one.ie
|
|
220
|
+
PUBLIC_ONE_API_KEY=ok_live_abc123def456
|
|
221
|
+
PUBLIC_ONE_ORG_ID=org_abc123
|
|
222
|
+
|
|
223
|
+
# Backend URL (when USE_ONE_BACKEND=true)
|
|
224
|
+
PUBLIC_CONVEX_URL=https://shocking-falcon-870.convex.cloud
|
|
225
|
+
CONVEX_DEPLOYMENT=prod:shocking-falcon-870
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Step 5: Initialize SDK
|
|
229
|
+
|
|
230
|
+
Configure SDK in app:
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
// src/services/ClientLayer.ts
|
|
234
|
+
import { OneBackendProvider } from '@oneie/sdk'
|
|
235
|
+
import { Layer } from 'effect'
|
|
236
|
+
|
|
237
|
+
const useOneBackend = import.meta.env.USE_ONE_BACKEND === 'true'
|
|
238
|
+
|
|
239
|
+
export const ClientLayer = useOneBackend
|
|
240
|
+
? OneBackendProvider({
|
|
241
|
+
apiUrl: import.meta.env.PUBLIC_ONE_API_URL,
|
|
242
|
+
apiKey: import.meta.env.PUBLIC_ONE_API_KEY,
|
|
243
|
+
organizationId: import.meta.env.PUBLIC_ONE_ORG_ID
|
|
244
|
+
})
|
|
245
|
+
: LocalBackendProvider({
|
|
246
|
+
convexUrl: import.meta.env.PUBLIC_CONVEX_URL
|
|
247
|
+
})
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Step 6: Use Auth & Database
|
|
251
|
+
|
|
252
|
+
Developer uses same API, different backend:
|
|
253
|
+
|
|
254
|
+
```typescript
|
|
255
|
+
// src/pages/signup.astro
|
|
256
|
+
import { AuthService } from '@oneie/sdk'
|
|
257
|
+
import { Effect } from 'effect'
|
|
258
|
+
|
|
259
|
+
const program = Effect.gen(function* () {
|
|
260
|
+
const auth = yield* AuthService
|
|
261
|
+
|
|
262
|
+
// Routes to ONE backend if USE_ONE_BACKEND=true
|
|
263
|
+
return yield* auth.signUp({
|
|
264
|
+
email: 'user@example.com',
|
|
265
|
+
password: 'password123',
|
|
266
|
+
name: 'New User'
|
|
267
|
+
})
|
|
268
|
+
})
|
|
269
|
+
|
|
270
|
+
const user = await Effect.runPromise(
|
|
271
|
+
program.pipe(Effect.provide(ClientLayer))
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
// User created in ONE backend → organizationId: org_abc123
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**Result:**
|
|
278
|
+
|
|
279
|
+
- ✅ User stored in ONE's Convex deployment
|
|
280
|
+
- ✅ Scoped to developer's organization (`org_abc123`)
|
|
281
|
+
- ✅ Auth works via ONE's Better Auth integration
|
|
282
|
+
- ✅ Developer didn't build any backend
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Configuration & Environment Variables
|
|
287
|
+
|
|
288
|
+
### Complete `.env` Setup
|
|
289
|
+
|
|
290
|
+
```env
|
|
291
|
+
# ============================================
|
|
292
|
+
# ONE Backend Configuration
|
|
293
|
+
# ============================================
|
|
294
|
+
|
|
295
|
+
# Toggle: Use ONE's managed backend
|
|
296
|
+
USE_ONE_BACKEND=true
|
|
297
|
+
|
|
298
|
+
# ONE Platform API
|
|
299
|
+
PUBLIC_ONE_API_URL=https://api.one.ie
|
|
300
|
+
PUBLIC_ONE_API_KEY=ok_live_abc123def456 # From dashboard
|
|
301
|
+
PUBLIC_ONE_ORG_ID=org_abc123 # From dashboard
|
|
302
|
+
|
|
303
|
+
# Backend URL (ONE's Convex deployment)
|
|
304
|
+
PUBLIC_CONVEX_URL=https://shocking-falcon-870.convex.cloud
|
|
305
|
+
CONVEX_DEPLOYMENT=prod:shocking-falcon-870
|
|
306
|
+
|
|
307
|
+
# ============================================
|
|
308
|
+
# Auth Configuration (Better Auth)
|
|
309
|
+
# ============================================
|
|
310
|
+
|
|
311
|
+
# Better Auth secret (for session tokens)
|
|
312
|
+
BETTER_AUTH_SECRET=your-secret-key-here
|
|
313
|
+
|
|
314
|
+
# OAuth Providers (optional)
|
|
315
|
+
GOOGLE_CLIENT_ID=your-google-client-id
|
|
316
|
+
GOOGLE_CLIENT_SECRET=your-google-secret
|
|
317
|
+
|
|
318
|
+
GITHUB_CLIENT_ID=your-github-client-id
|
|
319
|
+
GITHUB_CLIENT_SECRET=your-github-secret
|
|
320
|
+
|
|
321
|
+
# Email (for verification, password reset)
|
|
322
|
+
SMTP_HOST=smtp.resend.com
|
|
323
|
+
SMTP_PORT=587
|
|
324
|
+
SMTP_USER=your-smtp-user
|
|
325
|
+
SMTP_PASSWORD=your-smtp-password
|
|
326
|
+
|
|
327
|
+
# ============================================
|
|
328
|
+
# Optional: Local Backend (USE_ONE_BACKEND=false)
|
|
329
|
+
# ============================================
|
|
330
|
+
|
|
331
|
+
# LOCAL_CONVEX_URL=http://localhost:3000
|
|
332
|
+
# LOCAL_CONVEX_DEPLOYMENT=dev:local
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### Auto-Injection via SDK
|
|
336
|
+
|
|
337
|
+
The `@oneie/sdk` automatically injects API key into requests:
|
|
338
|
+
|
|
339
|
+
```typescript
|
|
340
|
+
// SDK handles this internally
|
|
341
|
+
const headers = {
|
|
342
|
+
'Authorization': `Bearer ${apiKey}`,
|
|
343
|
+
'X-Organization-ID': organizationId,
|
|
344
|
+
'Content-Type': 'application/json'
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## API Key Management
|
|
351
|
+
|
|
352
|
+
### API Key Structure
|
|
353
|
+
|
|
354
|
+
```
|
|
355
|
+
ok_live_abc123def456
|
|
356
|
+
│ │ │
|
|
357
|
+
│ │ └─ Random string (secret)
|
|
358
|
+
│ └────── Environment (live, test)
|
|
359
|
+
└───────── Prefix (identifies as ONE key)
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### Key Types
|
|
363
|
+
|
|
364
|
+
1. **Live Keys** (`ok_live_*`): Production use, real data
|
|
365
|
+
2. **Test Keys** (`ok_test_*`): Development, sandbox data
|
|
366
|
+
|
|
367
|
+
### Dashboard Management
|
|
368
|
+
|
|
369
|
+
Developers manage keys in dashboard:
|
|
370
|
+
|
|
371
|
+
```
|
|
372
|
+
┌─────────────────────────────────────────────────────────┐
|
|
373
|
+
│ API Keys │
|
|
374
|
+
├─────────────────────────────────────────────────────────┤
|
|
375
|
+
│ │
|
|
376
|
+
│ 📝 Live Keys (Production) │
|
|
377
|
+
│ │
|
|
378
|
+
│ ok_live_abc123def456 │
|
|
379
|
+
│ Created: Oct 11, 2025 │
|
|
380
|
+
│ Last used: 2 minutes ago │
|
|
381
|
+
│ Calls this month: 1,234 / 10,000 │
|
|
382
|
+
│ [Revoke] [Regenerate] │
|
|
383
|
+
│ │
|
|
384
|
+
│ ────────────────────────────────────────────────────── │
|
|
385
|
+
│ │
|
|
386
|
+
│ 🧪 Test Keys (Development) │
|
|
387
|
+
│ │
|
|
388
|
+
│ ok_test_xyz789ghi012 │
|
|
389
|
+
│ Created: Oct 10, 2025 │
|
|
390
|
+
│ Last used: Never │
|
|
391
|
+
│ Calls this month: 0 / Unlimited │
|
|
392
|
+
│ [Revoke] [Regenerate] │
|
|
393
|
+
│ │
|
|
394
|
+
│ [+ Create New Key] │
|
|
395
|
+
│ │
|
|
396
|
+
└─────────────────────────────────────────────────────────┘
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### Key Permissions
|
|
400
|
+
|
|
401
|
+
Fine-grained control:
|
|
402
|
+
|
|
403
|
+
```typescript
|
|
404
|
+
{
|
|
405
|
+
key: "ok_live_abc123",
|
|
406
|
+
organizationId: "org_abc123",
|
|
407
|
+
permissions: [
|
|
408
|
+
"auth:signup", // Allow user signups
|
|
409
|
+
"auth:signin", // Allow user signins
|
|
410
|
+
"things:read", // Read things
|
|
411
|
+
"things:write", // Create/update things
|
|
412
|
+
"connections:read", // Read connections
|
|
413
|
+
"connections:write", // Create connections
|
|
414
|
+
"events:write", // Log events
|
|
415
|
+
"knowledge:query" // Query vector embeddings
|
|
416
|
+
],
|
|
417
|
+
rateLimit: {
|
|
418
|
+
calls: 10000,
|
|
419
|
+
window: "monthly",
|
|
420
|
+
burstLimit: 100 // Max 100 req/second
|
|
421
|
+
},
|
|
422
|
+
ipWhitelist: [ // Optional IP restrictions
|
|
423
|
+
"203.0.113.0/24"
|
|
424
|
+
]
|
|
425
|
+
}
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
### Revocation
|
|
429
|
+
|
|
430
|
+
Instant key revocation:
|
|
431
|
+
|
|
432
|
+
1. Click "Revoke" in dashboard
|
|
433
|
+
2. Key status → `revoked`
|
|
434
|
+
3. All requests with this key → 401 Unauthorized
|
|
435
|
+
4. Effect: Immediate (< 1 second globally)
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
## Authentication Integration
|
|
440
|
+
|
|
441
|
+
Developers get full Better Auth integration without setup.
|
|
442
|
+
|
|
443
|
+
### Reference: Better Auth + ONE Ontology
|
|
444
|
+
|
|
445
|
+
See: [`one/things/plans/better-auth-any-backend.md`](../plans/better-auth-any-backend.md)
|
|
446
|
+
|
|
447
|
+
**Key Points:**
|
|
448
|
+
|
|
449
|
+
- ✅ Users stored as **people** (dimension 2) with roles
|
|
450
|
+
- ✅ Sessions stored as **connections** (type: session)
|
|
451
|
+
- ✅ All auth actions logged as **events**
|
|
452
|
+
- ✅ 6 auth methods: Email, Google, GitHub, Apple, Magic Link, Passkey
|
|
453
|
+
|
|
454
|
+
### Usage in Developer's App
|
|
455
|
+
|
|
456
|
+
```typescript
|
|
457
|
+
// src/components/auth/SignUpForm.tsx
|
|
458
|
+
import { AuthService } from '@oneie/sdk'
|
|
459
|
+
import { Effect } from 'effect'
|
|
460
|
+
import { useEffectRunner } from '@oneie/sdk/react'
|
|
461
|
+
|
|
462
|
+
export function SignUpForm() {
|
|
463
|
+
const { run, loading, error } = useEffectRunner()
|
|
464
|
+
|
|
465
|
+
const handleSignUp = async (email: string, password: string) => {
|
|
466
|
+
const program = Effect.gen(function* () {
|
|
467
|
+
const auth = yield* AuthService
|
|
468
|
+
|
|
469
|
+
// Routes to ONE backend → creates person in org_abc123
|
|
470
|
+
const user = yield* auth.signUp({
|
|
471
|
+
email,
|
|
472
|
+
password,
|
|
473
|
+
name: 'New User'
|
|
474
|
+
// organizationId auto-injected from env
|
|
475
|
+
})
|
|
476
|
+
|
|
477
|
+
return user
|
|
478
|
+
})
|
|
479
|
+
|
|
480
|
+
await run(program)
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
return (
|
|
484
|
+
<form onSubmit={handleSignUp}>
|
|
485
|
+
{/* ... */}
|
|
486
|
+
</form>
|
|
487
|
+
)
|
|
488
|
+
}
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
**What Happens:**
|
|
492
|
+
|
|
493
|
+
1. Request sent to `https://api.one.ie/auth/signup`
|
|
494
|
+
2. API key validated → `org_abc123` verified
|
|
495
|
+
3. Person created in ONE's Convex:
|
|
496
|
+
```typescript
|
|
497
|
+
{
|
|
498
|
+
_id: "person_user_456",
|
|
499
|
+
type: "creator",
|
|
500
|
+
email: "user@example.com",
|
|
501
|
+
organizationId: "org_abc123", // Developer's org
|
|
502
|
+
role: "org_user"
|
|
503
|
+
}
|
|
504
|
+
```
|
|
505
|
+
4. Event logged:
|
|
506
|
+
```typescript
|
|
507
|
+
{
|
|
508
|
+
eventType: "sign_up",
|
|
509
|
+
actorId: "person_user_456",
|
|
510
|
+
organizationId: "org_abc123",
|
|
511
|
+
metadata: { method: "email", success: true }
|
|
512
|
+
}
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
## Database Operations
|
|
518
|
+
|
|
519
|
+
Developers use the same **DataProvider** interface, but operations route to ONE backend.
|
|
520
|
+
|
|
521
|
+
### Create Things
|
|
522
|
+
|
|
523
|
+
```typescript
|
|
524
|
+
// src/services/ProductService.ts
|
|
525
|
+
import { ThingService } from '@oneie/sdk'
|
|
526
|
+
import { Effect } from 'effect'
|
|
527
|
+
|
|
528
|
+
const createProduct = (name: string, price: number) =>
|
|
529
|
+
Effect.gen(function* () {
|
|
530
|
+
const things = yield* ThingService
|
|
531
|
+
|
|
532
|
+
// Routes to ONE backend if USE_ONE_BACKEND=true
|
|
533
|
+
const productId = yield* things.create({
|
|
534
|
+
type: 'product',
|
|
535
|
+
name,
|
|
536
|
+
properties: {
|
|
537
|
+
price,
|
|
538
|
+
currency: 'USD',
|
|
539
|
+
stock: 100
|
|
540
|
+
}
|
|
541
|
+
// organizationId auto-injected → org_abc123
|
|
542
|
+
})
|
|
543
|
+
|
|
544
|
+
return productId
|
|
545
|
+
})
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
**Result:**
|
|
549
|
+
|
|
550
|
+
- ✅ Product stored in ONE's Convex deployment
|
|
551
|
+
- ✅ Scoped to `org_abc123` (automatic isolation)
|
|
552
|
+
- ✅ Real-time subscriptions work (Convex)
|
|
553
|
+
- ✅ Event logged: `product_created`
|
|
554
|
+
|
|
555
|
+
### Query Things
|
|
556
|
+
|
|
557
|
+
```typescript
|
|
558
|
+
// Get all products for this organization
|
|
559
|
+
const listProducts = Effect.gen(function* () {
|
|
560
|
+
const things = yield* ThingService
|
|
561
|
+
|
|
562
|
+
// Routes to ONE backend → filtered by org_abc123
|
|
563
|
+
const products = yield* things.list({
|
|
564
|
+
type: 'product',
|
|
565
|
+
filters: {
|
|
566
|
+
'properties.price': { $gte: 10, $lte: 100 }
|
|
567
|
+
}
|
|
568
|
+
})
|
|
569
|
+
|
|
570
|
+
return products
|
|
571
|
+
})
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
**Result:**
|
|
575
|
+
|
|
576
|
+
- ✅ Only returns products from `org_abc123`
|
|
577
|
+
- ✅ Other orgs' data invisible (multi-tenancy)
|
|
578
|
+
- ✅ Real-time updates via Convex subscriptions
|
|
579
|
+
|
|
580
|
+
### Create Connections
|
|
581
|
+
|
|
582
|
+
```typescript
|
|
583
|
+
// Connect user to product (e.g., purchase)
|
|
584
|
+
const purchaseProduct = (userId: string, productId: string) =>
|
|
585
|
+
Effect.gen(function* () {
|
|
586
|
+
const connections = yield* ConnectionService
|
|
587
|
+
|
|
588
|
+
const connectionId = yield* connections.create({
|
|
589
|
+
fromPersonId: userId, // User (person)
|
|
590
|
+
toThingId: productId, // Product (thing)
|
|
591
|
+
relationshipType: 'purchased',
|
|
592
|
+
metadata: {
|
|
593
|
+
purchaseDate: Date.now(),
|
|
594
|
+
price: 49.99,
|
|
595
|
+
paymentMethod: 'stripe'
|
|
596
|
+
}
|
|
597
|
+
})
|
|
598
|
+
|
|
599
|
+
return connectionId
|
|
600
|
+
})
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
**Result:**
|
|
604
|
+
|
|
605
|
+
- ✅ Connection stored in ONE backend
|
|
606
|
+
- ✅ Scoped to `org_abc123`
|
|
607
|
+
- ✅ Event logged: `purchase_created`
|
|
608
|
+
|
|
609
|
+
### Vector Search (Knowledge)
|
|
610
|
+
|
|
611
|
+
```typescript
|
|
612
|
+
// Query knowledge base with AI
|
|
613
|
+
const searchDocs = (query: string) =>
|
|
614
|
+
Effect.gen(function* () {
|
|
615
|
+
const knowledge = yield* KnowledgeService
|
|
616
|
+
|
|
617
|
+
// Routes to ONE backend → uses Convex vector search
|
|
618
|
+
const results = yield* knowledge.query({
|
|
619
|
+
query,
|
|
620
|
+
k: 5, // Top 5 results
|
|
621
|
+
filters: {
|
|
622
|
+
labels: ['docs', 'tutorial']
|
|
623
|
+
}
|
|
624
|
+
})
|
|
625
|
+
|
|
626
|
+
return results
|
|
627
|
+
})
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
**Result:**
|
|
631
|
+
|
|
632
|
+
- ✅ Vector search on ONE's knowledge table
|
|
633
|
+
- ✅ Scoped to `org_abc123`
|
|
634
|
+
- ✅ Uses OpenAI embeddings (automatic)
|
|
635
|
+
|
|
636
|
+
---
|
|
637
|
+
|
|
638
|
+
## SDK & DataProvider
|
|
639
|
+
|
|
640
|
+
### Installation
|
|
641
|
+
|
|
642
|
+
```bash
|
|
643
|
+
npm install @oneie/sdk effect
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
### Configuration
|
|
647
|
+
|
|
648
|
+
```typescript
|
|
649
|
+
// src/services/ClientLayer.ts
|
|
650
|
+
import { OneBackendProvider, LocalBackendProvider } from '@oneie/sdk'
|
|
651
|
+
import { Layer } from 'effect'
|
|
652
|
+
|
|
653
|
+
const useOneBackend = import.meta.env.USE_ONE_BACKEND === 'true'
|
|
654
|
+
|
|
655
|
+
export const ClientLayer = useOneBackend
|
|
656
|
+
? OneBackendProvider({
|
|
657
|
+
apiUrl: import.meta.env.PUBLIC_ONE_API_URL,
|
|
658
|
+
apiKey: import.meta.env.PUBLIC_ONE_API_KEY,
|
|
659
|
+
organizationId: import.meta.env.PUBLIC_ONE_ORG_ID
|
|
660
|
+
})
|
|
661
|
+
: LocalBackendProvider({
|
|
662
|
+
convexUrl: import.meta.env.PUBLIC_CONVEX_URL
|
|
663
|
+
})
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
### DataProvider Interface
|
|
667
|
+
|
|
668
|
+
```typescript
|
|
669
|
+
// Same interface for both ONE backend and local backend
|
|
670
|
+
export interface DataProvider {
|
|
671
|
+
things: {
|
|
672
|
+
get: (id: string) => Effect.Effect<Thing, ThingNotFoundError>
|
|
673
|
+
list: (params: { type: ThingType; filters?: any }) => Effect.Effect<Thing[], Error>
|
|
674
|
+
create: (input: { type: ThingType; name: string; properties: any }) => Effect.Effect<string, Error>
|
|
675
|
+
update: (id: string, updates: Partial<Thing>) => Effect.Effect<void, Error>
|
|
676
|
+
delete: (id: string) => Effect.Effect<void, Error>
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
connections: {
|
|
680
|
+
create: (input: { fromPersonId: string; toThingId: string; relationshipType: string }) => Effect.Effect<string, Error>
|
|
681
|
+
list: (params: { relationshipType: string; filters?: any }) => Effect.Effect<Connection[], Error>
|
|
682
|
+
delete: (id: string) => Effect.Effect<void, Error>
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
events: {
|
|
686
|
+
log: (event: { type: string; actorId: string; metadata?: any }) => Effect.Effect<void, Error>
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
knowledge: {
|
|
690
|
+
query: (params: { query: string; k: number; filters?: any }) => Effect.Effect<KnowledgeChunk[], Error>
|
|
691
|
+
create: (input: { text: string; sourcePersonId?: string }) => Effect.Effect<string, Error>
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
### OneBackendProvider Implementation
|
|
697
|
+
|
|
698
|
+
```typescript
|
|
699
|
+
// @oneie/sdk/src/providers/OneBackendProvider.ts
|
|
700
|
+
import { Effect, Layer } from 'effect'
|
|
701
|
+
import { DataProvider } from './DataProvider'
|
|
702
|
+
|
|
703
|
+
export class OneBackendProvider implements DataProvider {
|
|
704
|
+
constructor(
|
|
705
|
+
private config: {
|
|
706
|
+
apiUrl: string
|
|
707
|
+
apiKey: string
|
|
708
|
+
organizationId: string
|
|
709
|
+
}
|
|
710
|
+
) {}
|
|
711
|
+
|
|
712
|
+
things = {
|
|
713
|
+
create: (input) =>
|
|
714
|
+
Effect.tryPromise({
|
|
715
|
+
try: async () => {
|
|
716
|
+
const response = await fetch(`${this.config.apiUrl}/things`, {
|
|
717
|
+
method: 'POST',
|
|
718
|
+
headers: {
|
|
719
|
+
'Authorization': `Bearer ${this.config.apiKey}`,
|
|
720
|
+
'X-Organization-ID': this.config.organizationId,
|
|
721
|
+
'Content-Type': 'application/json'
|
|
722
|
+
},
|
|
723
|
+
body: JSON.stringify({
|
|
724
|
+
...input,
|
|
725
|
+
organizationId: this.config.organizationId // Auto-inject
|
|
726
|
+
})
|
|
727
|
+
})
|
|
728
|
+
|
|
729
|
+
if (!response.ok) {
|
|
730
|
+
throw new Error(`API error: ${response.statusText}`)
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
const data = await response.json()
|
|
734
|
+
return data.thingId
|
|
735
|
+
},
|
|
736
|
+
catch: (error) => new Error(String(error))
|
|
737
|
+
}),
|
|
738
|
+
|
|
739
|
+
list: (params) =>
|
|
740
|
+
Effect.tryPromise({
|
|
741
|
+
try: async () => {
|
|
742
|
+
const url = new URL(`${this.config.apiUrl}/things`)
|
|
743
|
+
url.searchParams.set('type', params.type)
|
|
744
|
+
url.searchParams.set('organizationId', this.config.organizationId)
|
|
745
|
+
|
|
746
|
+
if (params.filters) {
|
|
747
|
+
url.searchParams.set('filters', JSON.stringify(params.filters))
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
const response = await fetch(url.toString(), {
|
|
751
|
+
headers: {
|
|
752
|
+
'Authorization': `Bearer ${this.config.apiKey}`
|
|
753
|
+
}
|
|
754
|
+
})
|
|
755
|
+
|
|
756
|
+
if (!response.ok) {
|
|
757
|
+
throw new Error(`API error: ${response.statusText}`)
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
return response.json()
|
|
761
|
+
},
|
|
762
|
+
catch: (error) => new Error(String(error))
|
|
763
|
+
}),
|
|
764
|
+
|
|
765
|
+
// ... other methods
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
// ... connections, events, knowledge
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
// Factory function
|
|
772
|
+
export const OneBackendProvider = (config: {
|
|
773
|
+
apiUrl: string
|
|
774
|
+
apiKey: string
|
|
775
|
+
organizationId: string
|
|
776
|
+
}) =>
|
|
777
|
+
Layer.succeed(
|
|
778
|
+
DataProvider,
|
|
779
|
+
new OneBackendProvider(config)
|
|
780
|
+
)
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
**Key Points:**
|
|
784
|
+
|
|
785
|
+
- ✅ Same `DataProvider` interface as local backend
|
|
786
|
+
- ✅ Auto-injects `organizationId` into requests
|
|
787
|
+
- ✅ Auto-injects `Authorization` header with API key
|
|
788
|
+
- ✅ Routes to ONE's API (`https://api.one.ie`)
|
|
789
|
+
- ✅ Returns typed Effect errors
|
|
790
|
+
|
|
791
|
+
---
|
|
792
|
+
|
|
793
|
+
## Rate Limiting & Quotas
|
|
794
|
+
|
|
795
|
+
### Per-Organization Limits
|
|
796
|
+
|
|
797
|
+
```typescript
|
|
798
|
+
{
|
|
799
|
+
organizationId: "org_abc123",
|
|
800
|
+
plan: "starter",
|
|
801
|
+
limits: {
|
|
802
|
+
// API calls
|
|
803
|
+
apiCalls: {
|
|
804
|
+
monthly: 10000,
|
|
805
|
+
burst: 100 // Max 100 req/sec
|
|
806
|
+
},
|
|
807
|
+
|
|
808
|
+
// Database
|
|
809
|
+
things: 1000, // Max 1K things
|
|
810
|
+
connections: 5000, // Max 5K connections
|
|
811
|
+
storage: 1000000, // 1 GB (bytes)
|
|
812
|
+
|
|
813
|
+
// Auth
|
|
814
|
+
users: 100, // Max 100 people
|
|
815
|
+
|
|
816
|
+
// AI
|
|
817
|
+
inferenceTokens: 100000, // 100K tokens/month
|
|
818
|
+
embeddingTokens: 500000 // 500K tokens/month
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
### Rate Limit Headers
|
|
824
|
+
|
|
825
|
+
ONE API returns rate limit info:
|
|
826
|
+
|
|
827
|
+
```
|
|
828
|
+
HTTP/1.1 200 OK
|
|
829
|
+
X-RateLimit-Limit: 10000
|
|
830
|
+
X-RateLimit-Remaining: 9876
|
|
831
|
+
X-RateLimit-Reset: 1696118400
|
|
832
|
+
X-RateLimit-Burst: 100
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
### Quota Exceeded
|
|
836
|
+
|
|
837
|
+
When quota exceeded:
|
|
838
|
+
|
|
839
|
+
```
|
|
840
|
+
HTTP/1.1 429 Too Many Requests
|
|
841
|
+
X-RateLimit-Limit: 10000
|
|
842
|
+
X-RateLimit-Remaining: 0
|
|
843
|
+
X-RateLimit-Reset: 1696118400
|
|
844
|
+
|
|
845
|
+
{
|
|
846
|
+
"error": "quota_exceeded",
|
|
847
|
+
"message": "Monthly API call limit reached (10,000). Upgrade to Pro for higher limits.",
|
|
848
|
+
"upgradeUrl": "https://one.ie/pricing"
|
|
849
|
+
}
|
|
850
|
+
```
|
|
851
|
+
|
|
852
|
+
**SDK Handling:**
|
|
853
|
+
|
|
854
|
+
```typescript
|
|
855
|
+
// SDK automatically retries with exponential backoff
|
|
856
|
+
const program = Effect.gen(function* () {
|
|
857
|
+
const things = yield* ThingService
|
|
858
|
+
|
|
859
|
+
return yield* things.create({
|
|
860
|
+
type: 'product',
|
|
861
|
+
name: 'Widget'
|
|
862
|
+
})
|
|
863
|
+
}).pipe(
|
|
864
|
+
// Retry on rate limit (429)
|
|
865
|
+
Effect.retry({
|
|
866
|
+
times: 3,
|
|
867
|
+
schedule: Schedule.exponential(1000) // 1s, 2s, 4s
|
|
868
|
+
})
|
|
869
|
+
)
|
|
870
|
+
```
|
|
871
|
+
|
|
872
|
+
---
|
|
873
|
+
|
|
874
|
+
## Pricing Tiers
|
|
875
|
+
|
|
876
|
+
### Starter (Free)
|
|
877
|
+
|
|
878
|
+
```
|
|
879
|
+
$0/month
|
|
880
|
+
|
|
881
|
+
✅ 10K API calls/month
|
|
882
|
+
✅ 100 users
|
|
883
|
+
✅ 1K things
|
|
884
|
+
✅ 1 GB storage
|
|
885
|
+
✅ 100K AI tokens
|
|
886
|
+
✅ Email support
|
|
887
|
+
```
|
|
888
|
+
|
|
889
|
+
### Pro ($29/month)
|
|
890
|
+
|
|
891
|
+
```
|
|
892
|
+
$29/month
|
|
893
|
+
|
|
894
|
+
✅ 100K API calls/month
|
|
895
|
+
✅ 1K users
|
|
896
|
+
✅ 10K things
|
|
897
|
+
✅ 10 GB storage
|
|
898
|
+
✅ 1M AI tokens
|
|
899
|
+
✅ Priority support
|
|
900
|
+
✅ Custom domain
|
|
901
|
+
```
|
|
902
|
+
|
|
903
|
+
### Enterprise (Custom)
|
|
904
|
+
|
|
905
|
+
```
|
|
906
|
+
Custom pricing
|
|
907
|
+
|
|
908
|
+
✅ Unlimited API calls
|
|
909
|
+
✅ Unlimited users
|
|
910
|
+
✅ Unlimited things
|
|
911
|
+
✅ Unlimited storage
|
|
912
|
+
✅ Unlimited AI tokens
|
|
913
|
+
✅ Dedicated support
|
|
914
|
+
✅ SLA guarantees
|
|
915
|
+
✅ Custom deployment
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
---
|
|
919
|
+
|
|
920
|
+
## Migration Path
|
|
921
|
+
|
|
922
|
+
### From Local Backend → ONE Backend
|
|
923
|
+
|
|
924
|
+
**Step 1:** Backup local data
|
|
925
|
+
|
|
926
|
+
```bash
|
|
927
|
+
bun scripts/backup-local-data.ts
|
|
928
|
+
```
|
|
929
|
+
|
|
930
|
+
**Step 2:** Enable ONE backend
|
|
931
|
+
|
|
932
|
+
```env
|
|
933
|
+
USE_ONE_BACKEND=true
|
|
934
|
+
PUBLIC_ONE_API_KEY=ok_live_abc123
|
|
935
|
+
PUBLIC_ONE_ORG_ID=org_abc123
|
|
936
|
+
```
|
|
937
|
+
|
|
938
|
+
**Step 3:** Migrate data
|
|
939
|
+
|
|
940
|
+
```typescript
|
|
941
|
+
// scripts/migrate-to-one-backend.ts
|
|
942
|
+
import { Effect } from 'effect'
|
|
943
|
+
import { ThingService } from '@oneie/sdk'
|
|
944
|
+
import { ClientLayer } from './services/ClientLayer'
|
|
945
|
+
|
|
946
|
+
const migrateData = Effect.gen(function* () {
|
|
947
|
+
const things = yield* ThingService
|
|
948
|
+
|
|
949
|
+
// Read local backup
|
|
950
|
+
const localThings = readBackup('./backup-data.json')
|
|
951
|
+
|
|
952
|
+
// Upload to ONE backend
|
|
953
|
+
for (const thing of localThings) {
|
|
954
|
+
yield* things.create({
|
|
955
|
+
type: thing.type,
|
|
956
|
+
name: thing.name,
|
|
957
|
+
properties: thing.properties
|
|
958
|
+
})
|
|
959
|
+
}
|
|
960
|
+
})
|
|
961
|
+
|
|
962
|
+
await Effect.runPromise(
|
|
963
|
+
migrateData.pipe(Effect.provide(ClientLayer))
|
|
964
|
+
)
|
|
965
|
+
```
|
|
966
|
+
|
|
967
|
+
### From ONE Backend → Local Backend
|
|
968
|
+
|
|
969
|
+
Reverse migration:
|
|
970
|
+
|
|
971
|
+
1. Export data via API
|
|
972
|
+
2. Set `USE_ONE_BACKEND=false`
|
|
973
|
+
3. Import data to local Convex
|
|
974
|
+
|
|
975
|
+
---
|
|
976
|
+
|
|
977
|
+
## Security & Isolation
|
|
978
|
+
|
|
979
|
+
### Multi-Tenant Isolation
|
|
980
|
+
|
|
981
|
+
**Automatic:**
|
|
982
|
+
|
|
983
|
+
- ✅ All queries filtered by `organizationId`
|
|
984
|
+
- ✅ API key scoped to single organization
|
|
985
|
+
- ✅ No cross-org data leakage
|
|
986
|
+
|
|
987
|
+
**Enforcement:**
|
|
988
|
+
|
|
989
|
+
```typescript
|
|
990
|
+
// Backend enforces org isolation
|
|
991
|
+
export const listThings = query({
|
|
992
|
+
args: { type: v.string() },
|
|
993
|
+
handler: async (ctx, args) => {
|
|
994
|
+
// Extract org from API key (validated middleware)
|
|
995
|
+
const organizationId = ctx.auth.organizationId
|
|
996
|
+
|
|
997
|
+
// ALWAYS filter by organizationId
|
|
998
|
+
return await ctx.db
|
|
999
|
+
.query('things')
|
|
1000
|
+
.withIndex('by_type', q => q.eq('type', args.type))
|
|
1001
|
+
.filter(q => q.eq(q.field('organizationId'), organizationId))
|
|
1002
|
+
.collect()
|
|
1003
|
+
}
|
|
1004
|
+
})
|
|
1005
|
+
```
|
|
1006
|
+
|
|
1007
|
+
### Row-Level Security
|
|
1008
|
+
|
|
1009
|
+
Data isolation at database level:
|
|
1010
|
+
|
|
1011
|
+
```typescript
|
|
1012
|
+
// Convex schema with auth rules
|
|
1013
|
+
export default defineSchema({
|
|
1014
|
+
things: defineTable({
|
|
1015
|
+
// ... fields
|
|
1016
|
+
})
|
|
1017
|
+
.index('by_organization', ['organizationId'])
|
|
1018
|
+
.searchIndex('by_name', {
|
|
1019
|
+
searchField: 'name',
|
|
1020
|
+
filterFields: ['organizationId'] // Filter by org in search
|
|
1021
|
+
})
|
|
1022
|
+
})
|
|
1023
|
+
```
|
|
1024
|
+
|
|
1025
|
+
### API Key Security
|
|
1026
|
+
|
|
1027
|
+
- ✅ Keys hashed at rest (bcrypt)
|
|
1028
|
+
- ✅ HTTPS-only (TLS 1.3)
|
|
1029
|
+
- ✅ Rotation supported
|
|
1030
|
+
- ✅ IP whitelist optional
|
|
1031
|
+
- ✅ Permissions granular
|
|
1032
|
+
|
|
1033
|
+
---
|
|
1034
|
+
|
|
1035
|
+
## Example Use Cases
|
|
1036
|
+
|
|
1037
|
+
### 1. SaaS Product Builder
|
|
1038
|
+
|
|
1039
|
+
**Scenario:** Developer building a CRM
|
|
1040
|
+
|
|
1041
|
+
```typescript
|
|
1042
|
+
// Create customer
|
|
1043
|
+
const createCustomer = (email: string, name: string) =>
|
|
1044
|
+
Effect.gen(function* () {
|
|
1045
|
+
const things = yield* ThingService
|
|
1046
|
+
|
|
1047
|
+
// Routes to ONE backend
|
|
1048
|
+
const customerId = yield* things.create({
|
|
1049
|
+
type: 'customer',
|
|
1050
|
+
name,
|
|
1051
|
+
properties: {
|
|
1052
|
+
email,
|
|
1053
|
+
status: 'active',
|
|
1054
|
+
createdAt: Date.now()
|
|
1055
|
+
}
|
|
1056
|
+
})
|
|
1057
|
+
|
|
1058
|
+
return customerId
|
|
1059
|
+
})
|
|
1060
|
+
```
|
|
1061
|
+
|
|
1062
|
+
**Benefits:**
|
|
1063
|
+
|
|
1064
|
+
- ✅ No backend to build
|
|
1065
|
+
- ✅ Multi-tenancy automatic (each CRM user = separate org)
|
|
1066
|
+
- ✅ Real-time updates (Convex)
|
|
1067
|
+
- ✅ Auth included (Better Auth)
|
|
1068
|
+
|
|
1069
|
+
### 2. Mobile App Backend
|
|
1070
|
+
|
|
1071
|
+
**Scenario:** React Native app needs backend
|
|
1072
|
+
|
|
1073
|
+
```typescript
|
|
1074
|
+
// Mobile SDK usage
|
|
1075
|
+
import { OneBackendProvider } from '@oneie/sdk/native'
|
|
1076
|
+
|
|
1077
|
+
const app = OneBackendProvider({
|
|
1078
|
+
apiUrl: 'https://api.one.ie',
|
|
1079
|
+
apiKey: 'ok_live_abc123',
|
|
1080
|
+
organizationId: 'org_abc123'
|
|
1081
|
+
})
|
|
1082
|
+
|
|
1083
|
+
// Sign in
|
|
1084
|
+
const user = await app.auth.signIn({
|
|
1085
|
+
email: 'user@example.com',
|
|
1086
|
+
password: 'password123'
|
|
1087
|
+
})
|
|
1088
|
+
|
|
1089
|
+
// Store data
|
|
1090
|
+
const postId = await app.things.create({
|
|
1091
|
+
type: 'post',
|
|
1092
|
+
name: 'My First Post',
|
|
1093
|
+
properties: {
|
|
1094
|
+
content: 'Hello world!',
|
|
1095
|
+
likes: 0
|
|
1096
|
+
}
|
|
1097
|
+
})
|
|
1098
|
+
```
|
|
1099
|
+
|
|
1100
|
+
**Benefits:**
|
|
1101
|
+
|
|
1102
|
+
- ✅ No server needed
|
|
1103
|
+
- ✅ Works on iOS/Android
|
|
1104
|
+
- ✅ Real-time sync
|
|
1105
|
+
- ✅ Offline-first (Convex)
|
|
1106
|
+
|
|
1107
|
+
### 3. AI-Powered Knowledge Base
|
|
1108
|
+
|
|
1109
|
+
**Scenario:** Documentation site with AI search
|
|
1110
|
+
|
|
1111
|
+
```typescript
|
|
1112
|
+
// Index documentation
|
|
1113
|
+
const indexDocs = (markdown: string) =>
|
|
1114
|
+
Effect.gen(function* () {
|
|
1115
|
+
const knowledge = yield* KnowledgeService
|
|
1116
|
+
|
|
1117
|
+
// Routes to ONE backend → embeds with OpenAI
|
|
1118
|
+
yield* knowledge.create({
|
|
1119
|
+
text: markdown,
|
|
1120
|
+
labels: ['docs', 'tutorial']
|
|
1121
|
+
})
|
|
1122
|
+
})
|
|
1123
|
+
|
|
1124
|
+
// Search with AI
|
|
1125
|
+
const searchDocs = (query: string) =>
|
|
1126
|
+
Effect.gen(function* () {
|
|
1127
|
+
const knowledge = yield* KnowledgeService
|
|
1128
|
+
|
|
1129
|
+
// Vector search on ONE backend
|
|
1130
|
+
const results = yield* knowledge.query({
|
|
1131
|
+
query,
|
|
1132
|
+
k: 5
|
|
1133
|
+
})
|
|
1134
|
+
|
|
1135
|
+
return results
|
|
1136
|
+
})
|
|
1137
|
+
```
|
|
1138
|
+
|
|
1139
|
+
**Benefits:**
|
|
1140
|
+
|
|
1141
|
+
- ✅ No vector DB setup (Convex built-in)
|
|
1142
|
+
- ✅ No embedding API (OpenAI automatic)
|
|
1143
|
+
- ✅ No infrastructure cost (Starter plan free)
|
|
1144
|
+
|
|
1145
|
+
---
|
|
1146
|
+
|
|
1147
|
+
## Summary
|
|
1148
|
+
|
|
1149
|
+
### What "Use ONE Backend" Provides
|
|
1150
|
+
|
|
1151
|
+
✅ **Instant Auth**: 6 methods (Email, Google, GitHub, Apple, Magic Link, Passkey)
|
|
1152
|
+
✅ **Instant Database**: 6-dimension ontology (organizations, people, things, connections, events, knowledge)
|
|
1153
|
+
✅ **Instant Real-time**: Convex-powered subscriptions
|
|
1154
|
+
✅ **Instant Multi-tenancy**: Organizations automatically isolate data
|
|
1155
|
+
✅ **Instant AI**: Vector search without infrastructure
|
|
1156
|
+
✅ **Instant API**: RESTful + Effect.ts SDK
|
|
1157
|
+
✅ **Free Tier**: Start with zero cost
|
|
1158
|
+
|
|
1159
|
+
### Developer Experience
|
|
1160
|
+
|
|
1161
|
+
1. **Sign up** at https://one.ie/signup
|
|
1162
|
+
2. **Enable** "Use ONE Backend" toggle
|
|
1163
|
+
3. **Copy** API key from dashboard
|
|
1164
|
+
4. **Install** `@oneie/sdk`
|
|
1165
|
+
5. **Configure** `.env` with credentials
|
|
1166
|
+
6. **Build** app using same DataProvider interface
|
|
1167
|
+
7. **Deploy** anywhere (Vercel, Netlify, Cloudflare)
|
|
1168
|
+
|
|
1169
|
+
### No Lock-In
|
|
1170
|
+
|
|
1171
|
+
- ✅ Same API for local backend and ONE backend
|
|
1172
|
+
- ✅ Switch with single env variable: `USE_ONE_BACKEND=true/false`
|
|
1173
|
+
- ✅ Export data anytime
|
|
1174
|
+
- ✅ Migrate to self-hosted when ready
|
|
1175
|
+
|
|
1176
|
+
---
|
|
1177
|
+
|
|
1178
|
+
**Use ONE Backend = Firebase + Supabase + Better Auth, but with the 6-dimension ontology**
|
|
1179
|
+
|
|
1180
|
+
Toggle on. Build instantly. Scale effortlessly.
|