Skip to content
STACK IT FAST

Temporal

Curated OSSClassicDistributed Workflow Orchestrator20+ People

Audited from github.com/temporalio/temporal

Open-source durable execution platform and distributed workflow orchestrator built in Go.

Language
Go
Database
PostgreSQL
License
MIT
Running for
4 years
Team
20+ People

Why this architecture

Temporal keeps workflow code in external workers and persists every state transition as an event history that the Go gRPC cluster (Frontend, History and Matching services) replays after crashes or restarts, so long-running workflows survive failures on PostgreSQL, MySQL, SQLite or Cassandra storage.

Tech stack by layer

7 technologies · audited Sep 17, 2026
Backend & APIs
  • TemporalCore durable execution and distributed workflow orchestration platform
  • GoPrimary systems language powering internal microservices and state transitions
Data & Persistence
  • PostgreSQLRelational persistence layer storing workflow execution history and task queues
  • CassandraDistributed NoSQL persistence driver for high-throughput clustered deployments
  • ElasticsearchAdvanced visibility query engine supporting custom search attributes
Infrastructure & Deploy
  • PrometheusNative metrics instrumentation and scrape endpoint exporter
  • OpenTelemetryEnd-to-end distributed tracing across gRPC RPC boundaries and activity dispatches

Temporal architecture diagram

Open SVG
Temporal architecture diagramClient SDKs → Frontend (start · signal); Your workers → Frontend (poll tasks); Frontend → History (route); Frontend → Matching (poll); History → Matching (dispatch tasks); History → Persistence (event history); Matching → Persistence (queues); History → Visibility (visibility); Worker service → Frontend (system workflows)CLIENTSSERVICESWORKERS & JOBSDATA & STORAGEClient SDKsGo · Java · TS · PythonYour workersworkflow + activity codeFrontendgRPC gatewayHistoryshard state machineMatchingtask queuesWorker servicesystem workflowsPersistencePostgres / MySQL / CassandraVisibilityElasticsearch (optional)routepolldispatch tasksstart · signalpoll taskssystem workflowsevent historyqueuesvisibility
How the main components of Temporal connect, drawn from the audited repository.
Diagram as text
  • Client SDKs (Go · Java · TS · Python) → Frontend (gRPC gateway): start · signal
  • Your workers (workflow + activity code) → Frontend (gRPC gateway): poll tasks
  • Frontend (gRPC gateway) → History (shard state machine): route
  • Frontend (gRPC gateway) → Matching (task queues): poll
  • History (shard state machine) → Matching (task queues): dispatch tasks
  • History (shard state machine) → Persistence (Postgres / MySQL / Cassandra): event history
  • Matching (task queues) → Persistence (Postgres / MySQL / Cassandra): queues
  • History (shard state machine) → Visibility (Elasticsearch (optional)): visibility
  • Worker service (system workflows) → Frontend (gRPC gateway): system workflows

Key architectural decisions

4 decisions
  1. 01

    Event Sourced Durable Execution Engine

    Preserves deterministic workflow execution state as an append-only sequence of event history records, enabling full recovery across hardware failures.

  2. 02

    Service Decomposition into Four Internal Roles

    Splits server processes into Frontend, History, Matching, and Worker services that can be scaled horizontally and deployed independently.

  3. 03

    Pluggable Multi-Database Persistence Layer

    Uses database abstraction adapters supporting PostgreSQL, MySQL, SQLite, and Apache Cassandra through unified transaction interfaces.

  4. 04

    Nexus RPC Integration for Cross-Cluster Workflows

    Adopts the Nexus RPC standard to coordinate long-running distributed operations across organizational boundaries and multi-region clusters.

How Temporal is built

How Temporal is structured

The Temporal server is architected as a distributed system decomposed into four specialized internal microservices that communicate over gRPC:

  • Frontend Service: Serves as the public gateway handling external gRPC requests from client SDKs, workers, and administrative tools. It manages authentication, request routing, rate limiting, and authorization.
  • History Service: The core state machine of the cluster. It manages workflow execution state transitions, timer schedules, workflow event histories, and transactional consistency across shard partitions.
  • Matching Service: Hosts task queues, matching available worker pollers with pending workflow tasks and activity dispatches.
  • Worker Service: Executes background system workflows, such as namespace reclamation, archiving pipelines, and schedule evaluations.

The codebase isolates public API contracts into api/ and proto/ definitions using Protocol Buffers and gRPC Gateway. Low-level cluster membership and gossip routing are maintained in common/cluster using Ringpop.

Frontend

The Temporal server repository contains the backend systems engine. The web management interface is developed as a separate project (temporalio/ui) and connects to the Frontend service's gRPC endpoints to inspect running workflows, visualize execution history trees, evaluate pending activities, and trigger workflow signals.

Backend & APIs

Temporal exposes rich gRPC interfaces defined in go.temporal.io/api:

  • Workflow & Activity APIs: Provide endpoints for starting workflows, signaling executions, querying in-memory states, requesting cancellations, and resetting executions to past event checkpoints.
  • Task Queue Polling: Bidirectional gRPC streaming channels allow worker processes to poll for work and report task completion tokens with payload results or error stack traces.
  • Nexus RPC Integration: Incorporates nexus-rpc/sdk-go to facilitate arbitrary durable RPC calls and service orchestration across separate Temporal clusters.
  • Administrative CLI: The repository provides command-line diagnostic tools (tdbg, temporal-sql-tool, temporal-cassandra-tool) in cmd/tools/.

Data & persistence

Persistence in Temporal is decoupled through abstract interfaces in common/persistence:

  • Primary Data Store: Persists execution history shards, active executions, transfer tasks, timer tasks, and replication logs. Supported backends include PostgreSQL (pgx/v5, lib/pq), MySQL (go-sql-driver/mysql), SQLite (modernc.org/sqlite), and Apache Cassandra (gocql).
  • Visibility Store: Enables rich querying across workflow executions (filtering by status, custom search attributes, and timestamps). Uses Elasticsearch (olivere/elastic/v7) or native SQL visibility schemas.
  • Archival Layer: Offloads closed workflow execution histories to cold object storage (such as AWS S3 or Google Cloud Storage) to control database growth.

Realtime / collaboration

Temporal provides realtime workflow interaction mechanisms:

  • Signals: Asynchronous messages sent to running workflows that trigger immediate state machine evaluation.
  • Queries: Synchronous read-only calls handled by active workers that inspect workflow memory without recording events in execution history.
  • Updates: Synchronous request-response invocations that mutate workflow state and return output immediately upon transaction commit.

Build, test & deploy

The build environment is controlled by the root Makefile:

  • Binaries are compiled with Go (go 1.27.0) with CGO disabled by default for portable static binaries.
  • Protocol buffers are validated and generated with Buf (buf-breaking, proto-codegen).
  • Comprehensive testing includes unit tests, integration tests across database engines (common/persistence/tests), and multi-datacenter replication tests (tests/xdc, tests/ndc).
  • CI workflows on GitHub Actions enforce golangci-lint, govulncheck, and flaky test analysis before building multi-stage container images.

Self-hosting notes

Temporal can be deployed as an all-in-one standalone binary for local development or as a horizontally scalable containerized cluster on Kubernetes:

  • Development: temporal server start-dev launches an in-memory or SQLite-backed single process server.
  • Production: Separate pods are deployed for frontend, history, matching, and worker roles, backed by a managed PostgreSQL or Cassandra cluster.
  • Database schemas must be initialized prior to server boot using temporal-sql-tool or temporal-cassandra-tool.

What to copy (and what not to)

What to copy:

  • The event sourcing architecture that models long-running computations as append-only event histories, eliminating complex custom rollback routines.
  • Sharding the History service state across fixed consistent-hashing keyspaces to scale stateful transactions horizontally.
  • The separation between state tracking (History service) and poller dispatching (Matching service).

What not to copy:

  • Implementing custom gossip protocols like Ringpop for service discovery in greenfield projects; modern Kubernetes DNS and gRPC service meshes provide simpler operational patterns.

Sources & repo audit

Audited
Sep 17, 2026
Commit
9bab3d8
License
MIT

Independent analysis of repository at github.com/temporalio/temporal. Spotted an inaccuracy? Use the claim form to request a correction.

Show this stack on your README or website
Tech stack of Temporal
[![Tech stack of Temporal on STACK IT FAST](https://stackitfast.com/badge/temporal.svg)](https://stackitfast.com/project/temporal)

Paste it into your README. It shows your current stack and links to this page.

Use this stack

Scaffold it with your agent

Paste this prompt into Claude Code, Cursor, Windsurf or AGY to start a project with Temporal's architecture.

  1. 1Copy the promptThe full markdown spec, with every layer and decision.
  2. 2Open your AI toolClaude Code, Cursor, Windsurf or Copilot, in a new repo.
  3. 3Paste and scaffoldUse it as the first instruction; review before you ship.
use-this-stack.md · 57 lines · 5.5 KB
# MISSION: Scaffold "Temporal" 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 **Temporal**.
---
## 1. PROJECT SPECIFICATIONS & BENCHMARK
- **Reference Architecture**: Temporal
- **What It Does**: Open-source durable execution platform and distributed workflow orchestrator built in Go.
- **Domain & Category**: Distributed Workflow Orchestrator
- **Production Scale**: 20+ People
- **Development Mode**: CLASSIC
- **Architectural Rationale**: Temporal keeps workflow code in external workers and persists every state transition as an event history that the Go gRPC cluster (Frontend, History and Matching services) replays after crashes or restarts, so long-running workflows survive failures on PostgreSQL, MySQL, SQLite or Cassandra storage.
- **Live Website Reference**: https://temporal.io
- **Source Repository**: https://github.com/temporalio/temporal
---
## 2. PRODUCTION TECH STACK
- **Full Stack Array**: Temporal, Go, PostgreSQL, Cassandra, Elasticsearch, Prometheus, OpenTelemetry
- **Primary Language(s)**: Go, Shell, PLpgSQL, Makefile, CQL, Go Template
- **License of the reference repo**: MIT
- **Backend & APIs**: Temporal — Core durable execution and distributed workflow orchestration platform; Go — Primary systems language powering internal microservices and state transitions
- **Data & persistence**: PostgreSQL — Relational persistence layer storing workflow execution history and task queues; Cassandra — Distributed NoSQL persistence driver for high-throughput clustered deployments; Elasticsearch — Advanced visibility query engine supporting custom search attributes
- **Infrastructure & deploy**: Prometheus — Native metrics instrumentation and scrape endpoint exporter; OpenTelemetry — End-to-end distributed tracing across gRPC RPC boundaries and activity dispatches
---
## 3. KEY ARCHITECTURAL DECISIONS (audited from https://github.com/temporalio/temporal @ 9bab3d8)
1. **Event Sourced Durable Execution Engine**: Preserves deterministic workflow execution state as an append-only sequence of event history records, enabling full recovery across hardware failures.
2. **Service Decomposition into Four Internal Roles**: Splits server processes into Frontend, History, Matching, and Worker services that can be scaled horizontally and deployed independently.
3. **Pluggable Multi-Database Persistence Layer**: Uses database abstraction adapters supporting PostgreSQL, MySQL, SQLite, and Apache Cassandra through unified transaction interfaces.
4. **Nexus RPC Integration for Cross-Cluster Workflows**: Adopts the Nexus RPC standard to coordinate long-running distributed operations across organizational boundaries and multi-region clusters.
---
## 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**:
   - Isolate interactive UI state to leaf components. Keep core pages lightweight and performant.
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, Cassandra, Elasticsearch): 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.
Scaffolded something with this prompt?
Would you pick this stack for a distributed workflow orchestrator project?

Frequently asked about Temporal

Does the Temporal server execute user workflow and activity code directly?

No, user code executes inside external Worker processes in languages like TypeScript, Go, Java, or Python, communicating with the server over gRPC.

How does Temporal ensure workflow state is never lost during crashes?

The History service persists every state transition event to durable database storage before acknowledging task completions.

What is Temporal built with?

The Temporal server is written in Go and split into Frontend, History, Matching and Worker services that talk over gRPC, with Protocol Buffers API contracts in api/ and proto/ and Ringpop for cluster membership.

Does Temporal support Cassandra?

Yes. Temporal's persistence layer uses database adapters for PostgreSQL, MySQL, SQLite and Apache Cassandra behind one transaction interface, and Elasticsearch can be added for advanced visibility queries.

What does the Temporal architecture look like?

Client SDKs and workers call the Frontend service over gRPC. The History service owns workflow state and event histories, the Matching service hosts task queues, and the internal Worker service runs system workflows. User code always runs in external workers.

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.

use-this-stack.md