Comprehensive examples demonstrating all ObjectStack protocols and features
Welcome to the ObjectStack examples catalog! This directory contains carefully crafted examples organized by complexity and use case to help you get started quickly and learn the platform effectively.
| Level | Examples | Description |
|---|---|---|
| 🟢 Beginner | Todo, Basic | Start here - simple, focused examples |
| 🟡 Intermediate | CRM, Plugin Advanced CRM | Real-world applications |
| 🔴 Advanced | MSW React CRUD, Host Server | Complex integrations |
| Protocol | Examples | Status |
|---|---|---|
| Data (ObjectQL) | Basic Data, CRM Objects, Todo | ✅ Complete |
| UI (ObjectUI) | Basic UI, CRM UI, MSW React | ✅ Complete |
| System (ObjectOS) | Basic System, Host Server, Middleware | ✅ Complete |
| AI | AI Sales, AI Support, AI Analyst, AI Codegen, Basic AI/RAG | ✅ Complete |
| Automation | Basic Automation, CRM Workflows | ✅ Complete |
| Auth & Permissions | Basic Auth, CRM Permissions | ✅ Complete |
| API | REST Server, API Discovery, Host Server | ✅ Complete |
| Integration | Plugin BI, Advanced CRM Plugin | 🟡 Partial |
| Hub & Marketplace | Coming soon | 🔴 Missing |
Path: examples/todo/
Level: 🟢 Beginner
Protocols: Data, UI, System
The simplest complete example. Perfect for your first ObjectStack application.
What you'll learn:
- Basic object definitions
- Simple CRUD operations
- Basic UI configuration
- Package structure with
objectstack.config.ts
Quick Start:
cd examples/todo
pnpm install
pnpm typecheckPath: examples/basic/
Level: 🟢 Beginner
Protocols: All (70+ protocols)
Comprehensive standalone examples for every core protocol. Each file is self-contained and runnable.
Examples included:
stack-definition-example.ts- Complete stack configuration patternscapabilities-example.ts- Runtime capabilitiesapi-discovery-example.ts- API introspectionai-rag-example.ts- RAG pipeline and AI agentsauth-permission-example.ts- RBAC, RLS, sharingautomation-example.ts- Workflows, flows, ETLlogger-example.ts- Structured logging
Quick Start:
# Run any example directly
npx tsx examples/basic/stack-definition-example.ts
# Or type check all examples
cd examples/basic
pnpm typecheckPath: examples/crm/
Level: 🟡 Intermediate
Protocols: Data, UI, Automation, Auth
Full-featured CRM demonstrating enterprise-grade patterns and all major field types.
What's included:
- 6 interconnected objects (Account, Contact, Opportunity, Lead, Case, Task)
- All 28 field types demonstrated
- Multiple view types (Grid, Kanban, Calendar, Gantt)
- Validation rules and workflows
- Dashboards and reports
- Actions and automation
Object Highlights:
- Account: Formulas, validation, workflows, autonumber
- Contact: Master-detail relationships, avatars
- Opportunity: State machines, complex workflows, history tracking
- Lead: Conversion processes, status management
- Case: SLA tracking, escalation automation
- Task: Polymorphic relationships, time tracking
Quick Start:
cd examples/crm
pnpm install
pnpm buildPath: examples/msw-react-crud/
Level: 🔴 Advanced
Protocols: Data, UI, API, Client
Frontend-first development - Run ObjectStack entirely in the browser with Service Workers.
What you'll learn:
- Browser-based ObjectStack kernel
- MSW (Mock Service Worker) integration
- React client with
@objectstack/client-react - In-memory data persistence
- Full CRUD without backend
Architecture:
React App → Service Worker → ObjectStack Kernel → In-Memory Driver
Quick Start:
cd examples/msw-react-crud
pnpm install
pnpm dev
# Open http://localhost:5173Path: examples/host/
Level: 🔴 Advanced
Protocols: System, API, Data
Complete server implementation showing how to build a metadata-driven backend.
Features:
- Dynamic schema loading from plugins
- Auto-generated REST APIs
- Unified metadata API
- Plugin orchestration
- Production-ready patterns
Quick Start:
cd examples/host
pnpm install
pnpm dev
# API available at http://localhost:3000Path: examples/ai-sales/
Protocols: AI (Agent, RAG, NLQ)
Intelligent sales automation with lead qualification, email personalization, and opportunity insights.
Path: examples/ai-support/
Protocols: AI (Agent, RAG, Model Registry)
RAG-powered customer support with vector search knowledge base.
Path: examples/ai-analyst/
Protocols: AI (NLQ, Agent)
Natural language query system transforming questions into ObjectQL queries.
Path: examples/ai-codegen/
Protocols: AI (Agent, Orchestration)
Generate complete ObjectStack applications from natural language descriptions.
Path: examples/plugin-advanced-crm/
Protocols: System (Plugin, Capabilities, Services)
Demonstrates plugin architecture with capability manifests, protocol conformance, and service interfaces.
Path: examples/plugin-bi/
Protocols: UI (Dashboard, Report, Chart), Integration
Business intelligence plugin with advanced analytics and data visualization.
Path: examples/rest-server-example.ts
Protocols: API (REST, Endpoint, Router)
Single-file REST API server implementation showing minimal server setup.
Path: examples/middleware-example.ts
Protocols: System (Plugin, Lifecycle), API (HTTP)
Demonstrates plugin middleware patterns and HTTP interceptors.
| Protocol | Example | Location |
|---|---|---|
| Object Definition | ✅ Complete | CRM Objects, Todo |
| Field Types (28 types) | ✅ Complete | CRM Account |
| Validation Rules | ✅ Complete | CRM Examples, Basic |
| Relationships | ✅ Complete | CRM Contact |
| Formulas | ✅ Complete | CRM Account |
| Hooks | ✅ Complete | CRM Hooks |
| Query & Filters | ✅ Complete | Basic |
| External Lookup | 🟡 Partial | Plugin BI |
| Document Storage | 🔴 Missing | Planned |
| Protocol | Example | Location |
|---|---|---|
| List Views | ✅ Complete | CRM - Grid, Kanban, Calendar, Gantt |
| Form Views | ✅ Complete | CRM - Simple, Tabbed, Wizard |
| Actions | ✅ Complete | CRM Actions |
| Dashboards | ✅ Complete | CRM Dashboards |
| Reports | ✅ Complete | CRM Reports |
| Charts | ✅ Complete | CRM, Plugin BI |
| Widgets | ✅ Complete | CRM Dashboards |
| Themes | 🟡 Partial | Basic |
| Pages | 🟡 Partial | Basic |
| Components | 🔴 Missing | Planned |
| Protocol | Example | Location |
|---|---|---|
| Manifest | ✅ Complete | All examples with objectstack.config.ts |
| Plugin System | ✅ Complete | Plugin Advanced CRM, Host |
| Capabilities | ✅ Complete | Basic Capabilities |
| Logging | ✅ Complete | Basic Logger |
| Events | ✅ Complete | Middleware |
| Service Registry | ✅ Complete | Plugin Advanced CRM |
| Datasources | 🟡 Partial | Basic |
| Job Scheduling | 🔴 Missing | Planned |
| Metrics | 🔴 Missing | Planned |
| Tracing | 🔴 Missing | Planned |
| Object Storage | 🔴 Missing | Planned |
| Search Engine | 🔴 Missing | Planned |
| Message Queue | 🔴 Missing | Planned |
| Cache | 🔴 Missing | Planned |
| Encryption | 🔴 Missing | Planned |
| Compliance | 🔴 Missing | Planned |
| Audit | 🔴 Missing | Planned |
| Protocol | Example | Location |
|---|---|---|
| Agent | ✅ Complete | AI Sales, AI Support |
| RAG Pipeline | ✅ Complete | AI Support, Basic RAG |
| Model Registry | ✅ Complete | AI Support |
| NLQ (Natural Language Query) | ✅ Complete | AI Analyst |
| Conversation | ✅ Complete | AI Sales |
| Orchestration | ✅ Complete | AI Codegen |
| Cost Tracking | 🟡 Partial | AI Examples |
| Predictive Analytics | 🔴 Missing | Planned |
| Protocol | Example | Location |
|---|---|---|
| Workflow Rules | ✅ Complete | CRM, Basic |
| Flow (Visual) | ✅ Complete | Basic Automation |
| Approval Processes | ✅ Complete | Basic Automation |
| ETL Pipelines | ✅ Complete | Basic Automation |
| Webhooks | 🟡 Partial | Basic |
| Triggers | ✅ Complete | CRM |
| Sync | 🔴 Missing | Planned |
| Protocol | Example | Location |
|---|---|---|
| Identity & Sessions | ✅ Complete | Basic Auth |
| Roles & RBAC | ✅ Complete | Basic Auth |
| Permissions | ✅ Complete | Basic Auth, CRM |
| Row-Level Security (RLS) | ✅ Complete | Basic Auth |
| Sharing Rules | ✅ Complete | Basic Auth |
| Territory Management | ✅ Complete | Basic Auth |
| OAuth/OIDC Config | 🟡 Partial | Plugin Advanced CRM |
| SCIM | 🔴 Missing | Planned |
| Organizations | 🔴 Missing | Planned |
| Protocol | Example | Location |
|---|---|---|
| REST Server | ✅ Complete | REST Server, Host |
| API Discovery | ✅ Complete | Basic Discovery |
| GraphQL | 🟡 Partial | Basic |
| OData | 🔴 Missing | Planned |
| WebSocket/Realtime | 🔴 Missing | Planned |
| Batch Operations | 🔴 Missing | Planned |
| HTTP Cache | 🔴 Missing | Planned |
| Error Handling | 🟡 Partial | REST Server |
| Protocol | Example | Location |
|---|---|---|
| Database Connectors | 🟡 Partial | Plugin Advanced CRM |
| File Storage Connectors | 🔴 Missing | Planned |
| Message Queue Connectors | 🔴 Missing | Planned |
| SaaS Connectors | 🔴 Missing | Planned |
| Protocol | Example | Location |
|---|---|---|
| Plugin Registry | 🟡 Partial | Plugin Examples |
| Marketplace | 🔴 Missing | Planned |
| Licensing | 🔴 Missing | Planned |
| Composer | 🔴 Missing | Planned |
| Spaces | 🔴 Missing | Planned |
| Multi-tenancy | 🔴 Missing | Planned |
# Ensure you have Node.js 18+ and pnpm installed
node --version # >= 18.0.0
pnpm --version # >= 8.0.0# 1. Clone and install
git clone https://github.com/objectstack-ai/spec.git
cd spec
pnpm install
# 2. Build the spec package
pnpm --filter @objectstack/spec build
# 3. Run any example
npx tsx examples/basic/stack-definition-example.ts
# 4. Or explore a full app
cd examples/crm
pnpm build- Read Todo Example - Understand basic structure
- Run Basic Stack Definition - See patterns
- Explore CRM Example - Learn advanced features
- Complete Path 1
- Study all Basic Examples - Master each protocol
- Build Plugin Advanced CRM - Understand plugins
- Try MSW React CRUD - Frontend integration
- Complete Path 1 & 2
- Study AI Support - RAG patterns
- Try AI Analyst - NLQ patterns
- Explore AI Codegen - AI orchestration
- Build Host Server - Production backend
All examples in this directory follow these standards:
- ✅ Type-safe: All examples use TypeScript and pass
typecheck - ✅ Zod-first: Schemas defined with Zod, types inferred
- ✅ Naming conventions:
camelCasefor config,snake_casefor data - ✅ Documented: Comprehensive inline comments
- ✅ Best practices: Follow ObjectStack conventions
example-name/
├── README.md # Comprehensive documentation
├── package.json # Package definition
├── tsconfig.json # TypeScript config
├── objectstack.config.ts # Main configuration
└── src/ # Source code
├── domains/ # Object definitions
├── ui/ # UI components
└── ...
Each example MUST have:
- Clear purpose statement
- Prerequisites and dependencies
- Quick start instructions
- Protocol coverage explanation
- Key concepts highlighted
- Related examples linked
Want to add an example? Great! Please ensure:
- Follow the standards above
- Fill a gap in protocol coverage
- Add documentation (README.md)
- Test thoroughly (must compile and run)
- Submit PR with clear description
See CONTRIBUTING.md for details.
- Main Documentation - Complete protocol reference
- Architecture Guide - System architecture
- Quick Reference - Fast lookup
- Package Dependencies - Build order
All examples are licensed under Apache 2.0. See LICENSE for details.
Last Updated: 2026-01-31
Protocol Version: 0.6.1
Total Examples: 15
Protocol Coverage: 60/108 (56%)