Skip to content

Building business logic

This section explains how to implement business logic with strong types and clear boundaries.

Core flow

  1. Scaffold service artifacts with the PURISTA CLI (purista add ...).
  2. Define a Service and shared Builders.
  3. Capture Schemas & validation to power types/OpenAPI.
  4. Add Commands with request/response contracts.
  5. Stream multi-frame responses through Streams.
  6. React to events via Subscriptions.
  7. Configure Queues for pull-based workloads.
  8. Add queue-backed AI agents for model-driven or conversational workflows.
  9. Emit Custom event messages, wire Logging, and Error handling.
  10. Connect Stores and expose APIs through exposing commands + HTTP clients.
  11. Operate/observe services via Connect to PURISTA and the Advanced topics (message structure, delivery semantics, protocol internals).

Suggested chapter order

  1. Builders
  2. Schemas & Validation
  3. Service
  4. Command
  5. Stream and The Stream Builder
  6. Subscription
  7. Queues
  8. AI Agents
  9. Custom Event Messages
  10. Logging
  11. Error Handling
  12. Stores
  13. Exposing Commands
  14. HTTP Client
  15. Connect To PURISTA
  16. Advanced -> Structure Of A Message, Delivery Semantics And Reliability