Skip to Content
DocumentationBuilding with LoopstackπŸ“ WorkspacesCreating 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 extending the Workspace base class and decorating it with @BlockConfig. In most cases, you can define all configuration directly in the decorator without needing a separate YAML file.

Basic Workspace Definition

import { BlockConfig } from '@loopstack/shared'; import { Workspace } from '@loopstack/core'; import { MyFirstWorkflow } from './workflows/my-first-workflow'; import { DataProcessingWorkflow } from './workflows/data-processing-workflow'; @BlockConfig({ imports: [ MyFirstWorkflow, DataProcessingWorkflow, ], config: { title: 'Customer Analytics Workspace', description: 'This workspace processes customer data and generates insights for the marketing team', }, }) export class CustomerAnalyticsWorkspace extends Workspace {}

Key Components

  • imports: List all workflows that should be available in this workspace
  • config.title: A display name for the workspace
  • config.description: A detailed explanation of the workspace’s purpose

This is the recommended approach for workspaces since the configuration is typically simple and keeping everything in one file improves readability.

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:

@BlockConfig({ imports: [ MyFirstWorkflow, DataProcessingWorkflow, ], configFile: __dirname + '/customer-analytics-workspace.yaml', }) export class CustomerAnalyticsWorkspace extends Workspace {}

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 { ModuleFactory } from '@loopstack/shared'; import { CustomerAnalyticsWorkspace } from './customer-analytics-workspace'; @Module({ imports: [ LoopCoreModule, ], providers: [ CustomerAnalyticsWorkspace, // ... other providers ], exports: [ // ... exports ] }) @ModuleFactory(YourModuleFactoryService) 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