Skip to Content
DocumentationBuilding with LoopstackWorkspacesCreating Workspaces

Creating Workspaces

Workspaces are organizational containers that group related workflows together. They provide a structured way to organize your automations and make them accessible through the Loopstack Studio interface.

Creating a Workspace

A workspace is created by decorating it with @Workspace. Workflows are registered using the @InjectWorkflow() decorator on class properties.

Basic Workspace Definition

import { Workspace, InjectWorkflow } from '@loopstack/common'; import { MyFirstWorkflow } from './workflows/my-first-workflow'; import { DataProcessingWorkflow } from './workflows/data-processing-workflow'; @Workspace({ config: { title: 'Customer Analytics Workspace', description: 'This workspace processes customer data and generates insights for the marketing team', }, }) export class CustomerAnalyticsWorkspace { // Make workflows available in the workspace @InjectWorkflow() myFirstWorkflow: MyFirstWorkflow; @InjectWorkflow() dataProcessingWorkflow: DataProcessingWorkflow; }

Key Components

  • @InjectWorkflow(): Decorator used to inject workflows
  • config.title: A display name for the workspace
  • config.description: A detailed explanation of the workspace’s purpose

Using a Separate YAML File (Optional)

For consistency with other blocks or if you prefer external configuration, you can define workspace properties in a separate YAML file:

import { BlockConfig, Workflow } from '@loopstack/common'; import { MyFirstWorkflow } from './workflows/my-first-workflow'; import { DataProcessingWorkflow } from './workflows/data-processing-workflow'; @Workspace({ configFile: __dirname + '/customer-analytics-workspace.yaml', }) export class CustomerAnalyticsWorkspace { @InjectWorkflow() myFirstWorkflow: MyFirstWorkflow; @InjectWorkflow() dataProcessingWorkflow: DataProcessingWorkflow; }

Registering the Workspace

Add your workspace to your module’s providers to make it available:

import { Module } from '@nestjs/common'; import { LoopCoreModule } from '@loopstack/core'; import { CustomerAnalyticsWorkspace } from './customer-analytics-workspace'; @Module({ imports: [ LoopCoreModule, ], providers: [ CustomerAnalyticsWorkspace, // ... other providers ], }) export class YourModule {}

Using Your Workspace

Once registered, your workspace will appear in the Loopstack Studio:

  1. Navigate to the Workspaces section
  2. Create a new instance of your workspace
  3. Run any of the workflows included in the workspace via the Run button
Last updated on