Activepieces
Audited from github.com/activepieces/activepieces
Activepieces is an open-source, self-hostable workflow automation platform with a visual flow builder, hundreds of TypeScript integration "pieces", and AI-native features that expose those pieces as MCP servers.
- Language
- TypeScript
- Database
- PostgreSQL
- Hosting
- Docker
- Running for
- 2 years 4 months
- Team
- 2-5 people
Why this architecture
A queue-backed API/worker split on Fastify, PostgreSQL and Redis lets executions scale horizontally, while a typed pieces framework and isolated execution keep community integrations safe to load at runtime.
Tech stack by layer
17 technologies · audited Sep 17, 2026- ReactSingle-page flow builder in `packages/web`, routed with `react-router-dom`.
- ViteBuilds the web package (`@vitejs/plugin-react`, `vite-plugin-checker`); `web#build` is wired through Turborepo.
- Tailwind CSSUtility styling via `@tailwindcss/vite`, with `class-variance-authority`, `tailwind-merge` and Radix UI primitives.
- TanStack QueryServer-state caching plus `@tanstack/react-table`, `react-virtual` and `react-db` for large lists and live collections.
- ZustandLocal UI state for the builder alongside `react-hook-form` and `zod` for forms.
- React FlowThe visual flow canvas is built on `@xyflow/react`; `@dnd-kit` handles drag-and-drop of steps.
- TiptapRich-text and mention editing inside step inputs; CodeMirror powers the code editors.
- FastifyHTTP API in `packages/server/api` with `@fastify/swagger`, `rate-limit`, `multipart` and `fastify-type-provider-zod` for typed routes.
- Node.jsRuntime for the API, worker and engine containers (`node:24` base image).
- isolated-vmThe engine runs user flow code in V8 isolates; the Dockerfile also ships the `isolate` sandbox binary for stronger isolation.
- Socket.IORealtime channel between API, worker, engine and browser, with `@socket.io/redis-adapter` for multi-instance fan-out.
- Vercel AI SDKAI features use the `ai` package with provider adapters for OpenAI, Anthropic, Google, Azure, Bedrock and OpenRouter.
- Model Context ProtocolPieces are exposed as MCP servers through `@modelcontextprotocol/sdk` in the API and server utils.
- PostgreSQLPrimary database via TypeORM (`pg`); the compose file runs the `pgvector/pgvector` image for embeddings.
- TypeORMEntities and migrations (`db-migration`, `check-migrations` scripts); `typeorm-pglite` and `sqlite3` back lighter local setups.
- RedisQueues, locks (`redlock`) and Socket.IO adapter; `redis-memory-server` provides an embedded Redis for single-container installs.
- BullMQJob queues for flow runs and scheduled triggers, inspected through `@bull-board/fastify`.
- S3Optional file and log storage through `@aws-sdk/client-s3` and presigned URLs.
- DockerOne image (`ghcr.io/activepieces/activepieces`) runs as APP or WORKER via `AP_CONTAINER_TYPE`; a separate `Dockerfile.worker` exists.
- KubernetesHelm chart and Pulumi program under `deploy/` for cluster installs.
- SentryError tracking in both the API (`@sentry/node`) and the web app (`@sentry/react`).
- PostHogProduct analytics from the server (`posthog-node`) and the browser (`posthog-js`).
- TurborepoTask graph for the Bun workspace (`turbo.json`) with per-package build inputs and pass-through `AP_*` env vars.
- BunPackage manager for the monorepo (`packageManager: bun@1.4.0`, `bun.lock`).
- VitestUnit tests across core, server and web packages (`test-unit`, `test-api` scripts).
- PlaywrightEnd-to-end suites in `packages/tests-e2e`, run for community and enterprise editions in CI.
- GitHub ActionsCI, e2e, DAST (OWASP ZAP), benchmark, canary/stage/cloud delivery and rollback workflows.
Activepieces architecture diagram
Open SVGDiagram as text
- Flow builder (React · React Flow) → API (APP) (Fastify · Socket.IO): REST · Socket.IO
- Triggers (webhooks · schedules) → API (APP) (Fastify · Socket.IO): webhooks
- MCP clients (pieces as tools) → API (APP) (Fastify · Socket.IO): MCP
- API (APP) (Fastify · Socket.IO) → PostgreSQL (TypeORM · pgvector): TypeORM
- API (APP) (Fastify · Socket.IO) → Redis (queues · locks · Socket.IO): enqueue
- Redis (queues · locks · Socket.IO) → Worker (BullMQ consumer): jobs
- Worker (BullMQ consumer) → Engine (isolated-vm sandbox): run flow
- Engine (isolated-vm sandbox) → Pieces (npm integrations · AI): actions
Key architectural decisions
6 decisions- 01
Integrations are npm packages ("pieces") built on a typed framework
Every integration lives under
packages/pieces/community/*orcore/*and depends onpackages/pieces/framework. Pieces are published to npm byrelease-pieces.ymland loaded by the server at runtime, which is how a community can contribute connectors without touching the core. - 02
One image, two roles: APP and WORKER
The compose file runs the same
ghcr.io/activepieces/activepiecesimage as anapp(API + UI) and asworkerreplicas selected byAP_CONTAINER_TYPE. Flow executions are queued in BullMQ on Redis and picked up by workers, so capacity scales by adding worker containers. - 03
Flow code executes in isolates, optionally hardened by a sandbox binary
packages/server/engineruns steps withisolated-vm, and the Dockerfile compiles theisolatesandbox (withlibcap2) for process-level isolation.packages/server/sandboxand thesmoke-test/verify-isolation.shscript exist specifically to verify these boundaries. - 04
Postgres + Redis are the only required services, with embedded fallbacks
TypeORM targets PostgreSQL in production, but
typeorm-pglite(@electric-sql/pglite) andsqlite3allow database-less trials, andredis-memory-server(pinned in the Dockerfile) stands in for Redis whenAP_REDIS_TYPE=MEMORY. - 05
AI is a first-class subsystem, not a piece
packages/core/ai-providerswraps the Vercel AI SDK with a catalog of providers (OpenAI, Anthropic, Google, Azure, Bedrock, OpenRouter), and the API exposes pieces as MCP servers via@modelcontextprotocol/sdk.sync-model-catalog.ymlkeeps the model list current. - 06
Community and enterprise code share one monorepo
packages/ee(for exampleee/embed-sdk) sits next to the community packages, and CI runs separatetests-e2e-ce.ymlandtests-e2e-ee.ymlsuites. GitHub reports the repository license as "Other" while the README badge advertises MIT, so checkLICENSEand theeedirectory before reusing code.
How Activepieces is built
How Activepieces is structured
The repository is a Bun workspace (packageManager: bun@1.4.0) orchestrated by Turborepo. The root package.json lists the workspace groups explicitly: packages/cli, packages/core/*, the server packages (server/api, server/engine, server/worker, server/sandbox, server/utils), packages/web, packages/ee/embed-sdk, packages/tests-e2e, and the pieces tree (pieces/framework, pieces/common, pieces/core/*, pieces/community/*, pieces/custom/*).
packages/core/*holds shared, dependency-light libraries:sharedtypes,execution,formula(expression evaluation withexpr-eval),piece-typesandai-providers.packages/server/apiis the Fastify application;server/engineexecutes flow steps;server/workerandserver/sandboxrun and isolate those executions;server/utilswraps AI providers and MCP helpers.packages/webis the flow builder UI;packages/ee/embed-sdklets customers embed the builder in their own products.packages/pieces/*is the integration catalog. The README describes pieces as TypeScript npm packages, most of them contributed by the community.
turbo.json defines build, web#build, api#build and @activepieces/engine#build tasks with explicit inputs, and passes through the AP_* environment variables (edition, database, SMTP, OpenAI key) that configure a deployment.
Frontend
packages/web is a React single-page app built with Vite. The flow canvas is @xyflow/react, with @dnd-kit for reordering steps. Data fetching uses TanStack Query, and the package also pulls in @tanstack/react-table, react-virtual and @tanstack/react-db for large, live-updating lists. Forms use react-hook-form with zod resolvers; local state is Zustand. Editors inside steps are Tiptap (rich text and mentions) and CodeMirror (code and JSON). Styling is Tailwind CSS through @tailwindcss/vite with Radix UI primitives, cmdk, sonner and lucide-react. The app streams AI output with the ai package, tracks usage with PostHog and reports errors to Sentry. Internationalisation runs on i18next with Crowdin workflows generating translations.
Backend & APIs
The API is Fastify with the usual plugin set (@fastify/cors, multipart, rate-limit, static, swagger, http-proxy) and fastify-type-provider-zod so route schemas are Zod types. Authentication covers password (bcrypt), JWT (jsonwebtoken, jwks-rsa) and SAML (samlify) for enterprise SSO. Realtime updates flow over Socket.IO with the Redis adapter so several API instances can broadcast. Email goes through nodemailer; schedules use node-cron and BullMQ delayed jobs.
The engine (packages/server/engine) executes steps with isolated-vm and talks back to the API over socket.io-client. The Dockerfile also compiles the isolate sandbox binary, and packages/server/sandbox plus smoke-test/verify-isolation.sh exist to verify that boundary.
AI is a subsystem in its own right: packages/core/ai-providers wraps the Vercel AI SDK with adapters for OpenAI, Anthropic, Google, Azure, Amazon Bedrock and OpenRouter, and the API exposes pieces as MCP servers through @modelcontextprotocol/sdk.
Data & persistence
TypeORM is the data layer, with migrations managed by the db-migration, check-migrations and rollback scripts. Production uses PostgreSQL; the compose file runs pgvector/pgvector so embeddings can live in the same database. For lighter setups the API also depends on typeorm-pglite (@electric-sql/pglite) and sqlite3. Redis backs BullMQ queues, redlock locks and the Socket.IO adapter; @bull-board/fastify mounts a queue dashboard. Files and logs can be stored in S3-compatible storage through the AWS SDK with presigned URLs.
Realtime / collaboration
Run status, logs and test results are pushed to the browser over Socket.IO; the @socket.io/redis-adapter dependency means events raised on one API instance reach clients connected to another.
Build, test & deploy
- Unit tests run on Vitest (
test-unit,test-api), end-to-end tests on Playwright inpackages/tests-e2e, with separatetests-e2e-ce.ymlandtests-e2e-ee.ymlworkflows. ci.yml,e2e.yml,smoke-test.yml,benchmark.yml,dast.yml(OWASP ZAP plan in.zap/) andagent-evals.ymlgate changes;continuous-delivery-*.ymlworkflows deploy canary, staging and cloud with rollback jobs.release-self-hosted.ymlpublishes the container image,release-pieces.ymlpublishes pieces to npm,publish-embed-sdk.ymlpublishes the embed SDK andrelease-cli.ymlthe CLI.- Linting is ESLint with a large plugin set (React, a11y, Tailwind, Vitest) plus Prettier,
commitlintand husky hooks.
Self-hosting notes
docker-compose.yml is the reference deployment: one app container on port 8080, five worker replicas of the same image with AP_CONTAINER_TYPE=WORKER, a pgvector PostgreSQL 14 image and Redis 7, all configured from a .env file. The Dockerfile starts from node:24 on Debian bullseye, installs the isolate sandbox and pins redis-memory-server so a single container can run without external Redis. For Kubernetes the deploy/activepieces-helm chart and deploy/pulumi program are included, and .devcontainer/ provides a Codespaces-ready setup.
What to copy (and what not to)
Copy the single-image APP/WORKER role switch: it keeps deployments simple while letting execution capacity scale independently of the API. Copy the "integrations as typed npm packages" model if you want outside contributors; the framework package and the release workflow are the two pieces that make it work. Think twice before copying the execution sandbox as a whole: isolated-vm plus a native sandbox binary plus a benchmark harness is a large investment that only pays off when you run untrusted user code at scale.
Sources & repo audit
- Audited
- Sep 17, 2026
- Commit
- 70790de
- License
- NOASSERTION
- Root package.json (bun workspaces, turbo, vitest, playwright)
- packages/server/api/package.json (fastify, typeorm, bullmq, socket.io, ai, mcp)
- packages/server/engine/package.json (isolated-vm)
- packages/web/package.json (react, vite, tailwind, tanstack, xyflow)
- docker-compose.yml (app + worker replicas, pgvector, redis)
- Dockerfile (node 24, isolate sandbox, redis-memory-server)
Independent analysis of repository at github.com/activepieces/activepieces. Spotted an inaccuracy? Use the claim form to request a correction.
Show this stack on your README or website
[](https://stackitfast.com/project/activepieces)Paste it into your README. It shows your current stack and links to this page.
Scaffold it with your agent
Paste this prompt into Claude Code, Cursor, Windsurf or AGY to start a project with Activepieces's architecture.
- 1Copy the promptThe full markdown spec, with every layer and decision.
- 2Open your AI toolClaude Code, Cursor, Windsurf or Copilot, in a new repo.
- 3Paste and scaffoldUse it as the first instruction; review before you ship.
# MISSION: Scaffold "Activepieces" Production Architecture
You are an expert Senior Staff Software Architect and Full-Stack Engineer. Your mission is to scaffold and implement a production-grade, highly reliable, and modular codebase following the proven architecture of **Activepieces**.
---
## 1. PROJECT SPECIFICATIONS & BENCHMARK
- **Reference Architecture**: Activepieces
- **What It Does**: Activepieces is an open-source, self-hostable workflow automation platform with a visual flow builder, hundreds of TypeScript integration "pieces", and AI-native features that expose those pieces as MCP servers.
- **Domain & Category**: Workflow Automation & AI Orchestration
- **Production Scale**: 2-5 people
- **Development Mode**: HYBRID
- **Architectural Rationale**: A queue-backed API/worker split on Fastify, PostgreSQL and Redis lets executions scale horizontally, while a typed pieces framework and isolated execution keep community integrations safe to load at runtime.
- **Live Website Reference**: https://www.activepieces.com
- **Source Repository**: https://github.com/activepieces/activepieces
---
## 2. PRODUCTION TECH STACK
- **Full Stack Array**: TypeScript, Node.js, Bun, Turborepo, React, Vite, Tailwind CSS, TanStack Query, Fastify, TypeORM, PostgreSQL, Redis, BullMQ, Socket.IO, Docker, Kubernetes, Vercel AI SDK
- **Primary Language(s)**: TypeScript
- **License of the reference repo**: NOASSERTION
- **Frontend**: React — Single-page flow builder in `packages/web`, routed with `react-router-dom`.; Vite — Builds the web package (`@vitejs/plugin-react`, `vite-plugin-checker`); `web#build` is wired through Turborepo.; Tailwind CSS — Utility styling via `@tailwindcss/vite`, with `class-variance-authority`, `tailwind-merge` and Radix UI primitives.; TanStack Query — Server-state caching plus `@tanstack/react-table`, `react-virtual` and `react-db` for large lists and live collections.; Zustand — Local UI state for the builder alongside `react-hook-form` and `zod` for forms.; React Flow — The visual flow canvas is built on `@xyflow/react`; `@dnd-kit` handles drag-and-drop of steps.; Tiptap — Rich-text and mention editing inside step inputs; CodeMirror powers the code editors.
- **Backend & APIs**: Fastify — HTTP API in `packages/server/api` with `@fastify/swagger`, `rate-limit`, `multipart` and `fastify-type-provider-zod` for typed routes.; Node.js — Runtime for the API, worker and engine containers (`node:24` base image).; isolated-vm — The engine runs user flow code in V8 isolates; the Dockerfile also ships the `isolate` sandbox binary for stronger isolation.; Socket.IO — Realtime channel between API, worker, engine and browser, with `@socket.io/redis-adapter` for multi-instance fan-out.; Vercel AI SDK — AI features use the `ai` package with provider adapters for OpenAI, Anthropic, Google, Azure, Bedrock and OpenRouter.; Model Context Protocol — Pieces are exposed as MCP servers through `@modelcontextprotocol/sdk` in the API and server utils.
- **Data & persistence**: PostgreSQL — Primary database via TypeORM (`pg`); the compose file runs the `pgvector/pgvector` image for embeddings.; TypeORM — Entities and migrations (`db-migration`, `check-migrations` scripts); `typeorm-pglite` and `sqlite3` back lighter local setups.; Redis — Queues, locks (`redlock`) and Socket.IO adapter; `redis-memory-server` provides an embedded Redis for single-container installs.; BullMQ — Job queues for flow runs and scheduled triggers, inspected through `@bull-board/fastify`.; S3 — Optional file and log storage through `@aws-sdk/client-s3` and presigned URLs.
- **Infrastructure & deploy**: Docker — One image (`ghcr.io/activepieces/activepieces`) runs as APP or WORKER via `AP_CONTAINER_TYPE`; a separate `Dockerfile.worker` exists.; Kubernetes — Helm chart and Pulumi program under `deploy/` for cluster installs.; Sentry — Error tracking in both the API (`@sentry/node`) and the web app (`@sentry/react`).; PostHog — Product analytics from the server (`posthog-node`) and the browser (`posthog-js`).
- **Tooling, testing & ops**: Turborepo — Task graph for the Bun workspace (`turbo.json`) with per-package build inputs and pass-through `AP_*` env vars.; Bun — Package manager for the monorepo (`packageManager: bun@1.4.0`, `bun.lock`).; Vitest — Unit tests across core, server and web packages (`test-unit`, `test-api` scripts).; Playwright — End-to-end suites in `packages/tests-e2e`, run for community and enterprise editions in CI.; GitHub Actions — CI, e2e, DAST (OWASP ZAP), benchmark, canary/stage/cloud delivery and rollback workflows.
---
## 3. KEY ARCHITECTURAL DECISIONS (audited from https://github.com/activepieces/activepieces @ 70790de)
1. **Integrations are npm packages ("pieces") built on a typed framework**: Every integration lives under `packages/pieces/community/*` or `core/*` and depends on `packages/pieces/framework`. Pieces are published to npm by `release-pieces.yml` and loaded by the server at runtime, which is how a community can contribute connectors without touching the core.
2. **One image, two roles: APP and WORKER**: The compose file runs the same `ghcr.io/activepieces/activepieces` image as an `app` (API + UI) and as `worker` replicas selected by `AP_CONTAINER_TYPE`. Flow executions are queued in BullMQ on Redis and picked up by workers, so capacity scales by adding worker containers.
3. **Flow code executes in isolates, optionally hardened by a sandbox binary**: `packages/server/engine` runs steps with `isolated-vm`, and the Dockerfile compiles the `isolate` sandbox (with `libcap2`) for process-level isolation. `packages/server/sandbox` and the `smoke-test/verify-isolation.sh` script exist specifically to verify these boundaries.
4. **Postgres + Redis are the only required services, with embedded fallbacks**: TypeORM targets PostgreSQL in production, but `typeorm-pglite` (`@electric-sql/pglite`) and `sqlite3` allow database-less trials, and `redis-memory-server` (pinned in the Dockerfile) stands in for Redis when `AP_REDIS_TYPE=MEMORY`.
5. **AI is a first-class subsystem, not a piece**: `packages/core/ai-providers` wraps the Vercel AI SDK with a catalog of providers (OpenAI, Anthropic, Google, Azure, Bedrock, OpenRouter), and the API exposes pieces as MCP servers via `@modelcontextprotocol/sdk`. `sync-model-catalog.yml` keeps the model list current.
6. **Community and enterprise code share one monorepo**: `packages/ee` (for example `ee/embed-sdk`) sits next to the community packages, and CI runs separate `tests-e2e-ce.yml` and `tests-e2e-ee.yml` suites. GitHub reports the repository license as "Other" while the README badge advertises MIT, so check `LICENSE` and the `ee` directory before reusing code.
---
## 4. NON-NEGOTIABLE ARCHITECTURAL GUARDRAILS
1. **Monorepo & Modular Separation**:
- Structure as a Turborepo monorepo with strict package boundaries:
- `apps/web`: Application UI, routing, layouts, and server endpoints.
- `packages/ui`: Shared design tokens, CSS variables, and Radix UI primitive components.
- `packages/db`: Database schemas, client singleton, declarative migrations, and seed scripts.
- `packages/config`: Shared TypeScript, ESLint, and build configurations.
2. **Strict Type Safety & Zero `any` Policy**:
- Enable `strict: true`, `noImplicitAny: true`, and `strictNullChecks: true`.
- Validate ALL external inputs, API request bodies, and query parameters with **Zod** schemas before execution.
3. **Frontend & Rendering Guidelines**:
- Utilize Vite 6 with TanStack Router for fully type-safe routing. Manage server state and caching via TanStack Query v5 with optimistic UI updates.
4. **Design System & Aesthetics**:
- Keep every color, radius, shadow and font in a single token file (CSS variables) and consume tokens everywhere; never hardcode hex values in components.
- Prefer crisp 1px borders and one subtle shadow scale over blurry default shadows. Pair one sans-serif for body/headings with one monospace for tags, badges, metrics, and code.
5. **Data Layer & Reliability**:
- Write declarative schema definitions with foreign keys, composite indexes on queried filters, and automated timestamp triggers.
- Use connection pooling and prepared statements for serverless database execution.
---
## 5. STEP-BY-STEP SCAFFOLDING ROADMAP
- **Phase 1: Workspace & Root Config**: Initialize package manager, monorepo configuration (`turbo.json`, `tsconfig.base.json`, `package.json`).
- **Phase 2: Database Schema & Client**: Set up the data layer (PostgreSQL, TypeORM, Redis, BullMQ, S3): client, connection pool, models, and migration scripts.
- **Phase 3: Design Tokens & UI Primitives**: Build accessible `Button`, `Input`, `Card`, `Badge`, and layout wrappers inside `packages/ui`.
- **Phase 4: Core Application Routes & Handlers**: Implement primary authentication, user session handling, and application routes.
- **Phase 5: Quality Assurance & Build Verification**: Run `tsc --noEmit`, ESLint, Prettier, and smoke test suites to ensure zero compilation or runtime errors.
---
## 6. EXECUTION INSTRUCTIONS
1. Review all specifications, architectural guardrails, and stack choices above.
2. Present the full monorepo directory tree structure.
3. Systematically generate the complete, production-ready codebase according to the 5-phase roadmap above — starting with the root workspace setup, followed by the database schema, UI design system package, and full-stack application routes until the repository is fully scaffolded and ready to run.Copied 1 time
Frequently asked about Activepieces
What is Activepieces built with?
Activepieces is a TypeScript monorepo managed with Bun and Turborepo. The API is Fastify with TypeORM on PostgreSQL, Redis and BullMQ handle queues, Socket.IO provides realtime updates, and the flow builder is a React app built with Vite, Tailwind CSS, TanStack Query and React Flow. AI features use the Vercel AI SDK and pieces are exposed as MCP servers.
How does Activepieces run workflows safely?
Flow steps are executed by the engine package inside V8 isolates (isolated-vm). The official Docker image additionally builds the isolate sandbox binary for process-level isolation, and worker containers are separate from the API container.
Can I self-host Activepieces?
Yes. The repository ships a docker-compose.yml with an app container, worker replicas, PostgreSQL (pgvector image) and Redis, plus a Helm chart and a Pulumi program under deploy/ for Kubernetes. Configuration is done through AP_* environment variables.
How do you add a new integration to Activepieces?
Integrations are "pieces": TypeScript npm packages created with the pieces framework under packages/pieces. They are published to npm through the release-pieces workflow and, according to the README, automatically become available as MCP servers for LLM clients.
Does Activepieces need Redis and PostgreSQL?
In production, yes: PostgreSQL through TypeORM and Redis for BullMQ queues, locks and the Socket.IO adapter. For trials the repo includes fallbacks: PGlite or SQLite via TypeORM adapters and an embedded redis-memory-server enabled with AP_REDIS_TYPE=MEMORY.
One email a month: new deep dives and stack trends
New source-audited architectures, head-to-head comparisons and the monthly stack report. No spam, unsubscribe anytime.
Similar architectures
- n8nHybridFair-Code Workflow Automation & AI Integrator · 20+ peopleShares TypeScript · Node.js · PostgreSQL
- NovuHybridNotification Infra · 6-20 peopleShares TypeScript · React · Redis
- TypebotAI-agentConversational Form Builder · SoloShares TypeScript · React · Tailwind CSS
- Cal.comClassicScheduling SaaS · 6-20 peopleShares TypeScript · React · PostgreSQL
- AFFiNEHybridCollaborative Workspace · 6-20 peopleShares TypeScript · React · PostgreSQL
- KestraClassicDeclarative Orchestration & Data Flow Engine · 6-20 peopleShares TypeScript · PostgreSQL · Docker