Local Setup & Development
Relevant source files
The following files were used as context for generating this wiki page:
The superglue project utilizes a monorepo architecture managed by Turborepo to orchestrate its web interface, core engine, and shared utilities. Local development requires Node.js and focuses on maintaining a clear distinction between the Open Source Software (OSS) core and Enterprise Edition (EE) features.
Development workflows emphasize Type-safe integration via TypeScript, automated testing with Vitest, and a standardized REST API registration pattern. Developers interact with the system through a combination of the web-based playground, a dedicated CLI tool, and MCP (Model Context Protocol) servers for AI agent compatibility.
Sources: CLAUDE.md:1-25, packages/web/src/lib/agent/skills/content/superglue-concepts.md:95-110
Environment Architecture
The local development environment runs three primary services on specific ports. The frontend web application provides the user interface for building tools, while the core packages handle workflow execution and external system integrations.
Service Ports and Structure
| Service | Port | Description |
|---|---|---|
| GraphQL | 3000 | Legacy data interface |
| Web Interface | 3001 | Next.js based frontend application |
| REST API | 3002 | Primary API for tool execution and management |
Sources: CLAUDE.md:12
Monorepo Organization
The project separates logic into three main packages to ensure code reuse and clean boundaries:
packages/core: Contains the execution engine, documentation scrapers, and API registries.packages/web: The React-based user interface and agent-specific logic.packages/shared: Shared types, constants, and utility functions used by both core and web.ee/: Subdirectories within packages containing Enterprise-only features like the scheduler and notifications.
Sources: CLAUDE.md:14-22
Development Workflow
Starting the local environment requires running the Turborepo development script from the root directory.
Essential Commands
- Start Services:
npm run dev(starts GraphQL, Web, and REST API). - Run Tests:
npm run test(executes Vitest suites). - Format Code:
npm run lint:fix(runs Prettier). - Type Check:
npm run type-check(verifies TypeScript integrity).
Sources: CLAUDE.md:5-10
Local Execution Flow
The following diagram illustrates how a user request flows through the local architecture during development:
A brief explanation: Developers interact with the Web Interface, which communicates with the REST API. The Core Engine manages worker pools for async tasks and interacts with the Datastore or external systems.
Sources: CLAUDE.md:40-60, packages/web/src/lib/agent/registries/tool-registry.ts:1010-1050
Implementation Conventions
Developers must follow specific patterns when adding new functionality to maintain the "KISS and DRY" (Keep It Simple, Stupid and Don't Repeat Yourself) principle.
REST API Registration
New endpoints must be added to packages/core/api/ using the registerApiModule pattern rather than adding to the legacy GraphQL interface.
// Example from packages/core/api/ee/
registerApiModule({
name: "feature-name",
routes: [
{
method: "GET",
path: "/endpoint",
handler: myHandler,
permissions: { type: "read", resource: "resource-name" },
},
],
});
Sources: CLAUDE.md:43-65
Coding Standards
- Imports: Place all imports at the top; avoid inline imports.
- Extensions: Always use the
.jsextension for local imports (e.g.,import { x } from "./file.js"). - Dates: Convert all API response dates to ISO strings using
.toISOString(). - Types: Define all shared structures in
packages/shared/types.ts.
Sources: CLAUDE.md:25-38
Testing and Verification
The project uses Vitest for unit and integration testing. Test files are co-located with the source code using the .test.ts suffix.
Test Execution Logic
When testing components that interact with external services, superglue utilizes heavy mocking for Playwright and Axios to simulate browser environments and network requests.
The diagram shows the sequence of a test run where external dependencies are intercepted by mocks to ensure deterministic results.
Sources: packages/core/documentation/documentation.test.ts:11-45, CLAUDE.md:95-115
CLI and External Interfaces
Local development often involves testing how the platform interacts with external agents or terminal environments.
CLI Setup
Developers can install the superglue CLI locally to run tools without using the web interface:
npm install -g @superglue/cli
Key CLI commands include:
sg init: Configure API keys and endpoints.sg tool build: Create a new tool from a local JSON configuration.sg system call: Test connectivity to an external system.
Sources: packages/web/src/lib/agent/skills/content/superglue-concepts.md:120-150
MCP Server Integration
AI agents (like Cursor or Claude Desktop) connect to superglue via a remote MCP server. In a local development context, this usually involves pointing the agent to the local API endpoint (http://localhost:3002) or a hosted proxy.
Sources: packages/web/src/lib/agent/skills/content/superglue-concepts.md:110-120
Summary
Setting up superglue locally requires initializing a monorepo environment with Turborepo, running core services on ports 3000-3002, and adhering to strict TypeScript and REST registration conventions. The development cycle is supported by a robust Vitest framework and a dedicated CLI for workflow verification.
Sources: CLAUDE.md:5-12, packages/web/src/lib/agent/skills/content/superglue-concepts.md:95-100