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
TypeScript
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 workspaceconfig.title: A display name for the workspaceconfig.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:
TypeScript
@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:
- Navigate to the Workspaces section
- Create a new instance of your workspace
- Run any of the workflows included in the workspace via the Run button