Jay Stack Conceptual Model
Jay Stack Conceptual Model
Written for AI agents. See Log Methodology Note below for details.
Overview
This design log provides a conceptual diagram showing the relationships between the key building blocks of Jay Stack:
- Services - Server-side singletons (database, API clients)
- Contexts - Client-side hierarchical dependency injection
- Pages - Page definitions that generate website pages
- Plugins - NPM packages providing reusable contracts, components, actions
- Headless Components - Plugin-provided components with data contracts
- Init - Server and client initialization via
makeJayInit
Conceptual Relationships Diagram
Component Lifecycle Diagram
Entity Relationships
Key Concepts Summary
| Concept | Runtime | Scope | Lifecycle | Purpose |
|---|---|---|---|---|
| Service | Server | Global singleton | Application lifetime | Database, API clients, config |
| Context | Client | Hierarchical (parent→child) | Page lifetime | Theme, auth state, feature flags |
| Page | Both | Per-route | Per request | Define website routes and content |
| Plugin | Both | Global | Application lifetime | Package reusable functionality |
| Headless Component | Both | Per-usage | Component lifetime | Provide data+behavior without template |
| Init | Both | Global | Application startup | Register services/contexts |
| Action | Server (callable from client) | Per-call | Stateless | Server-side mutations/queries |
Data Flow Overview
File Structure Reference
project/
├── src/
│ ├── init.ts # Project init (makeJayInit)
│ ├── pages/
│ │ └── products/
│ │ ├── page.ts # Page logic
│ │ ├── page.jay-html # Page template
│ │ └── page.jay-contract # Generated contract
│ ├── services/
│ │ └── database.service.ts # Service definitions
│ ├── contexts/
│ │ └── theme.context.ts # Context definitions
│ └── actions/
│ └── cart.actions.ts # Server actions
├── node_modules/
│ └── @wix/stores/ # Example plugin
│ ├── plugin.yaml
│ ├── lib/
│ │ ├── init.ts # Plugin init
│ │ ├── contracts/
│ │ └── components/
│ └── dist/
└── package.json
Related Design Logs
- #34 - Jay Stack - Overall Jay Stack architecture
- #48 - Jay Stack Services - Server-side services pattern
- #30 - Jay Context API - Client-side context system
- #60 - Plugin System Refinement - Plugin structure
- #63 - Server Actions - Client-server action calls
- #64 - Client Context Init - Init patterns
- #65 - makeJayInit Builder - Unified init pattern
- #66 - Transitive Plugin Dependencies - Plugin discovery
Log Methodology Note
Note: These design logs are written primarily for AI agents as part of the Design Log methodology and made accessible here for human readers. The language and structure are optimized for machine consumption — expect precise, specification-style prose rather than narrative documentation.