Booster Framework Documentation

repository·main·Indexed 19 days ago

https://github.com/boostercloud/booster

A TypeScript-based framework for building event-driven microservices using CQRS, Event Sourcing, and Domain-Driven Design (DDD). It automates the creation of GraphQL APIs and cloud infrastructure for AWS and Azure by analyzing domain models. Includes the Metadata Booster TypeScript transformer for runtime class metadata and the @boostercloud/application-tester package for testing application logic, GraphQL operations, and provider implementations.

Tokens
124.8K
Snippets
400
Records
515
Agent score
65%

What's inside Booster Framework

  1. What is Metadata Booster?

    main

    Metadata Booster is a TypeScript transformer (plugin) that generates detailed runtime metadata for all your classes.

    Standard TypeScript metadata (via emitDecoratorMetadata) is limited: it lacks property names, type parameters, and method details. Metadata Booster solves this by providing a comprehensive schema of your classes, including fields, methods, return types, and generic type parameters, accessible at runtime via Reflect.

  2. What is Booster Framework?

    main

    Booster Framework is a software development framework for creating event-driven backend microservices. It is designed for extreme developer productivity by providing a highly opinionated implementation of CQRS (Command Query Responsibility Segregation) and Event Sourcing patterns using TypeScript and Domain-Driven Design (DDD) semantics.

    Key capabilities include:

    • Automatic API Generation: Automatically builds a fully functional GraphQL API from your code semantics, eliminating the need to maintain schemas, resolvers, or DTOs.
    • Infrastructure as Code (IaC) Automation: Acts as a "TypeScript-to-Cloud compiler," automatically generating optimal, scalable cloud infrastructure for AWS or Azure based on your code structure.
    • Reduced Boilerplate: Automatically handles JSON serialization/deserialization, URL path management, ORM mappings, database queries, and WebSocket subscriptions for GraphQL.
    • Extensibility: Supports extensions called "Rockets" to add custom functionality.
  3. What is a Read Model

    main
    A Read Model is a cached projection of one or more entities, optimized for read operations and exposed to clients via a GraphQL API. Instead of exposing raw entities directly, you create Read Models that contain only the data needed for specific client views. Read Models are updated reactively whenever the underlying entities are modified after reducing events.
  4. The `/inspect` endpoint for type definitions

    main

    The /inspect endpoint is a service-level feature in Booster that provides direct access to the .d.ts files of all project components within an agent. It organizes these files by component type (e.g., commands, events, read-models), allowing the TypeScript compiler plugin to resolve remote imports.

    Security Note: Access to the /inspect endpoint is protected by security measures and access controls. In its initial implementation, it is an opt-in feature that should only be enabled in non-production environments (local, testing, staging).

  5. What are Rockets in Booster?

    main

    In the Booster ecosystem, Rockets are the term used for plugins. A Rocket is a standard Node package that integrates seamlessly with Booster to provide:

    • New end-to-end abstractions.
    • Support for new cloud services.
    • Pre-built functionalities that can be installed into your project to extend its capabilities.
  6. Understand the Booster package structure

    main

    Booster is a multi-package monorepo managed with rush. Packages are split based on whether they run separately (e.g., CLI vs. Cloud), share code across multiple packages, or provide vendor-specific specializations (e.g., AWS or Azure).

    All packages are published to npm under the @boostercloud/ prefix. To build all packages in the repository, use the rush build command.

    # Build all packages in the monorepo
    rush build
  7. Understand the Booster GraphQL API model

    main

    Booster automatically generates a GraphQL API based on your defined commands and read models. This API allows you to interact with your application using three types of GraphQL operations:

    1. Mutations: Used to send commands (modify data).
    2. Queries: Used to read read models (get data on-demand).
    3. Subscriptions: Used to subscribe to read models (receive real-time data updates).

    To enable complex GraphQL filtering, especially over nested attributes, always use class types instead of interface types for attributes in your commands and read models.

    // Use 'class', not 'interface', to enable complex GraphQL filtering
    export class ItemWithQuantity {
      public constructor(sku: string, quantity: number) {}
    }
    
    @ReadModel({ authorize: 'all' })
    export class CartReadModel {
      public constructor(
        readonly id: UUID,
        item: ItemWithQuantity // Nested attributes like 'item.quantity' can now be queried
      ) {}
    }
  8. How Booster environments work

    main

    Booster environments allow for flexible deployment workflows by isolating configurations based on a unique name.

    • Team Environments: Standard environments like dev, stage, and prod are typically managed by CI/CD processes.
    • Developer Environments: Developers can create private environments in separate configuration files (e.g., src/config/username.ts) to test changes in realistic settings without affecting shared environments.
    • Isolation: To deploy a completely independent copy of your application, simply use a new environment name.
    • Credentials: Booster utilizes the local machine's credentials (e.g., ~/.aws/credentials for AWS) to perform deployments, allowing developers to work across different cloud accounts independently of the production or staging environments.