| field | Description |
|---|---|
| constant.ts | Defines data models using the via() function pattern for type-safe schema definitions |
| document.ts | MongoDB schema with filters, methods, and middleware using from(), by(), into(), beyond() |
| service.ts | Business logic implementation using serve() with dependency injection |
| signal.ts | API endpoints using slice() and endpoint() for type-safe client-server communication |
| store.ts | Client-side state management using store() with automatic slice integration |
Defines data models using the via() function pattern for type-safe schema definitions
MongoDB schema with filters, methods, and middleware using from(), by(), into(), beyond()
Business logic implementation using serve() with dependency injection
API endpoints using slice() and endpoint() for type-safe client-server communication
Client-side state management using store() with automatic slice integration
| field | Description |
|---|---|
| enumOf() | Creates a type-safe enum class with the given name and values. Use 'as const' to preserve literal types for strict type checking. |
| via((field) => ({...})) | The field() function defines each property with its type, default value, validation, and other options like .optional() for nullable fields. |
| Class Hierarchy | Input → Object → Light → Model. Each layer adds specific functionality. Light classes select specific fields for optimized list queries. |
Creates a type-safe enum class with the given name and values. Use 'as const' to preserve literal types for strict type checking.
The field() function defines each property with its type, default value, validation, and other options like .optional() for nullable fields.
Input → Object → Light → Model. Each layer adds specific functionality. Light classes select specific fields for optimized list queries.
| field | Description |
|---|---|
| from() - Filter Definition | Defines reusable query patterns with .arg() for required parameters and .opt() for optional ones. The .query() method returns the MongoDB query object. |
| by() - Document Methods | Creates a document class with instance methods that operate on individual documents. Methods can modify the document and should return 'this' for chaining. |
| into() - Model Operations | Creates a model class with collection-level operations. Auto-generates query methods from filters (e.g., queryInCategory from inCategory filter). |
| beyond() - Middleware | Adds schema-level configurations like indexes, pre/post hooks, and virtual fields through the onSchema method. |
Defines reusable query patterns with .arg() for required parameters and .opt() for optional ones. The .query() method returns the MongoDB query object.
Creates a document class with instance methods that operate on individual documents. Methods can modify the document and should return 'this' for chaining.
Creates a model class with collection-level operations. Auto-generates query methods from filters (e.g., queryInCategory from inCategory filter).
Adds schema-level configurations like indexes, pre/post hooks, and virtual fields through the onSchema method.
| field | Description |
|---|---|
| serve() | Creates a service class that automatically inherits CRUD operations from the document model (getProduct, loadProductMany, etc.). |
| service<T>() | Dependency injection for other services. Declared services are automatically available as this.serviceName in methods. |
| Method Chaining | Document methods return 'this' allowing chains like product.sell(5).save(). Always call .save() to persist changes. |
Creates a service class that automatically inherits CRUD operations from the document model (getProduct, loadProductMany, etc.).
Dependency injection for other services. Declared services are automatically available as this.serviceName in methods.
Document methods return 'this' allowing chains like product.sell(5).save(). Always call .save() to persist changes.
| field | Description |
|---|---|
| slice() | Defines data-fetching endpoints that support pagination, search, and real-time updates. Use .param() for URL params and .search() for query strings. |
| endpoint() + mutation() | Defines mutation endpoints that modify data. First argument is the return type, then guards, params (.param()), and body data (.body()). |
| guards | Access control with Admin, User, Every, Public guards. Use .with(Self) to inject the current user context into the exec function. |
| srv.product.with() | Combines multiple services for cross-module operations. All combined services are available as this.serviceName in exec functions. |
Defines data-fetching endpoints that support pagination, search, and real-time updates. Use .param() for URL params and .search() for query strings.
Defines mutation endpoints that modify data. First argument is the return type, then guards, params (.param()), and body data (.body()).
Access control with Admin, User, Every, Public guards. Use .with(Self) to inject the current user context into the exec function.
Combines multiple services for cross-module operations. All combined services are available as this.serviceName in exec functions.
| field | Description |
|---|---|
| store(sig.module, state) | Creates a store class connected to the signal. Auto-generates state and setters for slices (productList, setProduct, productForm, etc.). |
| fetch | Type-safe API client auto-generated from signals. Methods match signal endpoint names (fetch.sellProduct, fetch.createProduct). |
| msg | Toast notification helper using dictionary keys. msg.loading(), msg.success(), msg.error() with translation support. |
Creates a store class connected to the signal. Auto-generates state and setters for slices (productList, setProduct, productForm, etc.).
Type-safe API client auto-generated from signals. Methods match signal endpoint names (fetch.sellProduct, fetch.createProduct).
Toast notification helper using dictionary keys. msg.loading(), msg.success(), msg.error() with translation support.
| field | Description |
|---|---|
| Template - Form Components | Form components that use st.use.[model]Form() for state and st.do.set[Field]On[Model] for updates. Wrapped in Layout.Template. |
| Unit - Card Components | Displays LightModel data in card/list format. Receives the model as a prop and renders summarized information with optional actions. |
| View - Detail Components | Shows full model details. Receives the complete model (not Light) and displays all relevant information in a structured layout. |
| Zone - Layout Components | Container components that handle data loading via Load.Units and organize Unit/View components. Often include modals and real-time refresh. |
| Util - Action Components | Reusable action buttons and utilities (Process, Serve, Cancel). Accept modelId and disabled props, call store methods on click. |
Form components that use st.use.[model]Form() for state and st.do.set[Field]On[Model] for updates. Wrapped in Layout.Template.
Displays LightModel data in card/list format. Receives the model as a prop and renders summarized information with optional actions.
Shows full model details. Receives the complete model (not Light) and displays all relevant information in a structured layout.
Container components that handle data loading via Load.Units and organize Unit/View components. Often include modals and real-time refresh.
Reusable action buttons and utilities (Process, Serve, Cancel). Accept modelId and disabled props, call store methods on click.