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. Workflows are registered using the @Workflow() decorator on class properties.

Basic Workspace Definition

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

Key Components

  • @Injectable(): Required NestJS decorator for dependency injection
  • @Workflow(): 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 { Injectable } from '@nestjs/common'; import { BlockConfig, Workflow } from '@loopstack/common'; import { WorkspaceBase } from '@loopstack/core'; import { MyFirstWorkflow } from './workflows/my-first-workflow'; import { DataProcessingWorkflow } from './workflows/data-processing-workflow'; @Injectable() @BlockConfig({ configFile: __dirname + '/customer-analytics-workspace.yaml', }) export class CustomerAnalyticsWorkspace extends WorkspaceBase { @Workflow() myFirstWorkflow: MyFirstWorkflow; @Workflow() 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