a8n

RoleFull-Stack Engineer & Architect
CategoryWorkflow Automation
TimelineOct 2025 – Present (10 Months)
Status
Production Deployed (Evolving Architecture)

PROJECT
OVERVIEW

a8n is a self-hosted workflow automation platform that lets both humans and AI agents build, execute, and monitor multi-step pipelines. The architecture is a layered monolith on Next.js 16 — tRPC provides type-safe web APIs, Inngest provides durable event-driven execution with per-step retry, and a parallel MCP server exposes 22 tools for AI-client access over Streamable HTTP.

Workflow automation platform combining a visual React Flow DAG editor with durable Inngest execution and a parallel MCP server — built so humans design workflows visually while AI agents automate them programmatically.

The same platform serves humans through a visual canvas and AI agents through the Model Context Protocol — two interaction paradigms, one execution engine underneath.
Architecture Vision
Key Details
01

Why Layered Monolith

A startup-velocity decision: one deployable unit with clear internal layers (UI → tRPC → Inngest → Prisma) instead of premature microservices. The monolith boundary is the right size for a solo-operated automation product.

02

Why Inngest for Execution

Workflows can take seconds to minutes (AI API calls, HTTP requests). Inngest step functions provide per-step durability — if step 3 fails, steps 1–2 don't re-execute. Each step is individually retryable with automatic failure recovery.

03

Why MCP Alongside tRPC

tRPC gives the web UI end-to-end type safety (Prisma → Router → Client → React). MCP gives AI agents (Claude Desktop, Cursor) programmatic access to the same platform via a standard protocol. Two interfaces, one engine.

04

Why React Flow + Topological Sort

React Flow provides the visual DAG editor. Before execution, nodes are topologically sorted so upstream dependencies always complete before downstream consumers. This separates visual layout from execution order.

SYSTEM
ARCHITECTURE

Engineered for production durability, type safety, and scalable domain isolation. Every module operates with strict boundaries and predictable failure handling.

MODULAR DOMAIN ISOLATION — BUILT FOR ZERO-DOWNTIME DEPLOYMENTS, TYPE-SAFE CONTRACTS, AND FAIL-SAFE EXCEPTION BOUNDARIES.

SYSTEM BLUEPRINTOpen Vector View
a8n Architecture Diagram
Architectural Modules
01

Dual API Surface

tRPC for web UI type safety (Prisma → Router → Client → React). MCP server for AI clients via Streamable HTTP. Both call the same Prisma layer and Inngest engine — no duplication.

02

Durable Execution Engine

Inngest step functions provide per-step durability with configurable retry (3 in production, 0 in dev). 9 dedicated realtime channels stream node-level execution status to the browser via SSE.

03

Topological DAG Sorting

Before execution, the workflow DAG is topologically sorted to ensure nodes run in dependency order. Disconnected nodes are included via self-edges. Cycles are detected and rejected.

04

AES-256 Credential Vault

Third-party API keys are encrypted with AES-256 (Cryptr) at rest. Decryption happens only at execution time, scoped to the workflow owner. Credentials never appear in Inngest event payloads.

05

5-Layer Security Model

Better Auth sessions → tRPC authorization middleware (protected + premium tiers) → row-level data isolation (userId filtering) → AES-256 credential encryption → Zod input validation on every procedure.

PROJECT
IMPACT

Production performance measured under live traffic load, latency stress profiles, and automated system profiling.

ALL OUTCOMES ARE EMPIRICALLY VERIFIED IN PRODUCTION ENVIRONMENTS — MEASURED UNDER HIGH CONCURRENCY, PEAK LATENCY PROFILES, AND AUTOMATED SYSTEM HEALTH AUDITS.

01
22

MCP Tools

02
10

Custom Node Types

03
9

Realtime Channels

04
8

Architecture Decision Records

KEY
CAPABILITIES

Core capabilities engineered for high-scale reliability, intuitive operator workflows, and real-time production execution.

PRODUCTION-TESTED SYSTEM FEATURES — ARCHITECTED FOR LOW-LATENCY INTERACTION, DETERMINISTIC STATE HANDLING, AND COMPREHENSIVE TELEMETRY.

MODULE / 01
React FlowtoposortDAG

Visual DAG Editor with Topological Execution

React Flow canvas with 10 custom node types (triggers, HTTP, AI providers, integrations). Before execution, the DAG is topologically sorted using the toposort library — upstream nodes always complete before their downstream consumers. Cycles are detected and rejected.

10Node Types
SortedExecution Order
MODULE / 02
Inngest v4SSEStep DurabilityHandlebars

Inngest Durable Execution with Realtime Streaming

Each workflow runs as an Inngest step function with 5 durable steps. If step 3 fails, steps 1–2 don't re-execute. 9 dedicated realtime channels publish per-node execution status (loading → success → error) to the browser via SSE. Context propagates through the chain — each node's output becomes the next node's input via Handlebars templates.

Per-StepDurability
9Realtime Channels
MODULE / 03
MCPStreamable HTTPBearer Auth

MCP Server (22 Tools, 4 Resources, 3 Prompts)

Production-grade Model Context Protocol server at /api/mcp exposing workflow automation to AI clients (Claude Desktop, Cursor, MCP Inspector). Runs parallel to tRPC — tools call Prisma and Inngest directly. Bearer token auth with scoped API keys. Streamable HTTP transport.

22Tools
4Resources
MODULE / 04
Vercel AI SDKAES-256Cryptr

Multi-Provider AI Nodes with Credential Scoping

AI executor nodes support OpenAI, Anthropic, and Gemini through the Vercel AI SDK. API keys are encrypted with AES-256 at rest and decrypted only at execution time. Credential queries are scoped to the workflow owner — users can only use their own keys.

3AI Providers
EncryptedAt Rest
MODULE / 05
Better AuthPolar.shZodRow-Level Isolation

5-Layer Security Architecture

Layer 1: Better Auth session management with OAuth (GitHub/Google). Layer 2: tRPC middleware (protected + premium tiers via Polar.sh). Layer 3: Row-level data isolation (every query filtered by userId). Layer 4: AES-256 credential encryption. Layer 5: Zod input validation on every tRPC procedure.

5Security Layers
Per-QueryIsolation

DEVELOPMENT
PROCESS

A rigorous, phased engineering lifecycle designed to transform architectural requirements into scalable, production-ready systems.

DISCIPLINED SYSTEM METHODOLOGY — ARCHITECTED FOR END-TO-END OBSERVABILITY, DETERMINISTIC REVIEWS, AND ZERO-REGRESSION RELEASE CYCLES.

Connected Lifecycle Grid
PHASE / 01Dual Interface Design

Architecture

Chose a layered monolith (Next.js 16) with two parallel API surfaces: tRPC for web UI type safety and MCP for AI-agent access. Both share the same Prisma data layer and Inngest execution engine.

System DesignADR-001
PHASE / 02Durable Pipeline

Execution Engine

Implemented the Inngest-based execution pipeline with topological DAG sorting, per-step durability, context propagation via Handlebars templates, and 9 realtime channels for live status streaming.

InngestDAGSSE
PHASE / 03Extensible Nodes

Node Executor Pattern

Designed a uniform NodeExecutor interface where every node type (trigger, HTTP, AI, integration) follows the same pattern: publish loading → validate → execute in step.run → publish success → return merged context.

Registry PatternExtensibility
PHASE / 04AI-Agent Access

MCP Integration

Exposed 22 tools across 6 domains through a secured MCP server with Bearer token auth, API key scoping, and Streamable HTTP transport. Tested with Claude Desktop, Cursor, and MCP Inspector.

MCPProtocol Integration
ARCHITECTURE STACK // COMPONENT MATRIX

TECHNOLOGY
STACK

An engineered architectural map outlining foundational nodes, runtime environments, and type-safe deployment frameworks.

DETERMINISTIC ARCHITECTURE STACK — PROFILED FOR PRODUCTION LATENCY, STRICT TYPE SAFETY, AND HIGH-CONCURRENCY SCALABILITY.

Total Nodes
28+
Architectural Components
Type Safety
100%%
System Expansion Slot
Layer 1

frontend

Next.js 16
React Flow
TanStack Query
Jotai
shadcn/ui
Layer 2

backend

tRPC v11
Inngest v4
Prisma v7
Better Auth
MCP Server
Layer 3

ai

Vercel AI SDK
OpenAI GPT-4
Anthropic Claude
Google Gemini