Hasura
Audited from github.com/hasura/graphql-engine
Hasura is an open-source engine that turns a database schema into a secured, realtime GraphQL and REST API, shipping two parallel engines from one repository: a mature Haskell server for GraphQL Engine V2 and a newer Rust engine powering Hasura DDN (V3).
- Language
- TypeScript
- Database
- PostgreSQL
- Hosting
- Docker
- License
- Apache-2.0
- Running for
- 6 years
- Team
- 20+ people
Why this architecture
Hasura runs two independently evolving query engines from one repository — a Haskell V2 server and a Rust V3 engine — and extends database support through an out-of-process Data Connector protocol, so a new database backend plugs in as a separate agent instead of new code inside either engine.
Tech stack by layer
9 technologies · audited Sep 17, 2026- ReactThe Hasura Console (frontend/) is an Nx-managed React workspace, pinned to React 17 via a yarn resolution.
- HaskellGraphQL Engine V2 server lives in server/ as a Cabal project (graphql-engine.cabal), the mature production engine.
- RustGraphQL Engine V3, powering Hasura DDN, lives in v3/ as a Cargo workspace of engine/execute/plan/metadata-resolve crates.
- GoThe hasura CLI (cli/, module github.com/hasura/graphql-engine/cli/v2) is a separate Go binary from both engines.
- GraphQLThe query language both the V2 Haskell engine and V3 Rust engine expose over the database schema.
- PostgreSQLPrimary supported database; CircleCI test images build Postgres with PostGIS for geospatial query coverage.
- SQLiteReference Data Connector agent (dc-agents/sqlite) shows how a new database backend plugs in without engine changes.
- CabalBuild system and dependency resolver for the Haskell V2 server (cabal.project, multiple dev/CI project variants).
- HLintHaskell linter run in CI for the V2 server, configured via .hlint.yaml and the hlint.yml workflow.
- VitestUnit test runner for cli-ext, the standalone action-scaffolding service (test:unit script).
Hasura architecture diagram
Open SVGDiagram as text
- GraphQL clients (queries · subscriptions) → Engine V2 (Haskell): GraphQL
- GraphQL clients (queries · subscriptions) → Engine V3 (DDN) (Rust crates): GraphQL
- Console (React) → Engine V2 (Haskell): admin API
- hasura CLI (Go) → Engine V2 (Haskell): metadata
- Engine V2 (Haskell) → PostgreSQL (primary database): SQL
- Engine V2 (Haskell) → Data Connector agents (dc-agents/*): Data Connector API
- Engine V3 (DDN) (Rust crates) → Data Connector agents (dc-agents/*): connectors
- Data Connector agents (dc-agents/*) → Other databases (SQLite reference agent): queries
Key architectural decisions
6 decisions- 01
Two GraphQL engines, Haskell V2 and Rust V3, ship from one repository
server/graphql-engine.cabal builds the mature, Haskell-based GraphQL Engine V2, while v3/Cargo.toml defines a separate Rust workspace (package.version = "3.0.0") powering Hasura DDN; the README documents both under distinct "Hasura V2" and "Hasura V3" sections rather than treating V3 as a simple upgrade of V2.
- 02
New databases plug in as out-of-process Data Connector agents
dc-agents/reference (a Node/TypeScript template, exposing port 8100) and dc-agents/sqlite (@hasura/dc-agent-sqlite) both implement the same dc-api-types contract from dc-agents/dc-api-types/package.json, so adding database support does not require changing the Haskell or Rust engine code, only writing a new agent against the documented protocol.
- 03
The CLI is a standalone Go module, not part of either engine
cli/go.mod declares module github.com/hasura/graphql-engine/cli/v2 as its own Go module with its own dependency set (including gin-gonic/gin and gin-contrib/static to serve the local console UI), built and released independently of the server/ (Haskell) and v3/ (Rust) engines.
- 04
V3 engine crates are split by query pipeline stage, not by connector
v3/Cargo.toml workspace members include engine, execute, plan, plan-types, metadata-resolve, jsonapi, compatibility, open-dds, plus glob groups graphql/* and auth/*, mirroring the path a query takes from metadata resolution through planning to execution rather than grouping code by which external database or connector it targets.
- 05
Postgres with PostGIS is the pinned reference test database for V2
.circleci/postgres-12.0-alpine-postgis3/Dockerfile and .circleci/postgres-13.0-alpine-postgis3/Dockerfile both build from circleci/postgres:<version>-postgis rather than the plain Postgres image, so CI exercises geospatial (PostGIS) query support as a standard part of the V2 test matrix.
- 06
The Console frontend and the Action-scaffolding service are separate JS/TS projects
frontend/package.json (Nx workspace, React 17 pinned via a yarn resolution) builds the Console UI, while cli-ext/package.json (name scaffolder, Babel-transpiled) is an independent Node service the CLI calls out to for generating Hasura Action scaffolds, each with its own dependency tree, build and test setup.
How Hasura is built
How Hasura is structured
The repository holds two GraphQL engines side by side rather than one codebase with database adapters. server/ (built via server/graphql-engine.cabal) is GraphQL Engine V2, written in Haskell and described in the README as "the current stable version." v3/ is a separate Rust workspace (v3/Cargo.toml, package.version = "3.0.0") that implements Hasura DDN, the newer engine. Around both engines sit independent tooling projects: cli/ (Go) for the hasura command-line tool, frontend/ (React, Nx-managed) for the web Console, cli-ext/ (Node, name scaffolder) for generating Action scaffolds, dc-agents/ (a Yarn workspace of TypeScript Data Connector agents), and docs/ (Docusaurus) for documentation. Each of these has its own manifest and lifecycle rather than being folded into server/ or v3/.
Frontend
The Hasura Console lives in frontend/, an Nx-managed workspace (frontend/nx.json) whose package.json pins @types/react to 17.0.39 through a yarn resolutions entry, indicating the Console still targets React 17. Build scripts distinguish Community Edition and Enterprise Edition targets explicitly: start:ce/build:ce run nx run console-ce:serve/build, while start:ee/build:ee run the equivalent console-ee targets, plus server-build:ce/:ee variants that build server-side assets. GraphQL types for the frontend's control-plane and schema-registry integrations are generated with @graphql-codegen/core via dedicated generate-control-plane-gql-types and generate-schema-registry-gql-types scripts.
Backend & APIs
GraphQL Engine V2 (server/) is a Cabal-built Haskell application; the repository ships multiple Cabal project variants (cabal/dev.project, cabal/ci.project, cabal/dev-sh-prof-time.project, and others) for development, CI and profiling builds respectively. GraphQL Engine V3 (v3/) is organized by query-pipeline stage rather than by database: its Cargo workspace members include engine (the top-level binary), execute, plan and plan-types, metadata-resolve, jsonapi, compatibility, open-dds (the Open Data Domain Specification types), plus glob groups graphql/*, auth/*, plugins/* and utils/*. The hasura CLI (cli/go.mod, module github.com/hasura/graphql-engine/cli/v2) is a wholly separate Go binary that uses gin-gonic/gin and gin-contrib/static to also serve the local Console UI when running hasura console.
Data & persistence
PostgreSQL is the primary and most heavily tested backend: .circleci/postgres-12.0-alpine-postgis3/Dockerfile and .circleci/postgres-13.0-alpine-postgis3/Dockerfile both build from circleci/postgres:<version>-postgis rather than the plain Postgres image, making PostGIS geospatial support part of the standard CI matrix. Support for other databases goes through the Data Connector (DC) protocol: dc-agents/dc-api-types defines the shared TypeScript contract, dc-agents/reference is a runnable Node/TypeScript template agent (listening on port 8100), and dc-agents/sqlite (@hasura/dc-agent-sqlite) is a working SQLite implementation of that same contract — each agent is a standalone service the engine talks to over HTTP, not code compiled into the Haskell or Rust engine itself.
Build, test & deploy
CI for the V2 server and Console runs primarily on CircleCI (.circleci/config.yml, plus helper scripts like .circleci/build-docker-image.sh and .circleci/test-server.sh), with per-database Postgres/PostGIS Docker images built specifically for the test matrix. Haskell code is linted with HLint (.hlint.yaml, the hlint.yml GitHub Actions workflow) and a separate lint.yml workflow covers other lint checks. packaging/graphql-engine/Dockerfile builds the release server image from a prebuilt binary (COPY rootfs/bin/) rather than compiling in the final stage, keeping the release image build fast and small. The root docker-compose.yaml is explicitly documented as being for manual testing, spinning up services (Postgres and others, port-numbered from 65001 to avoid clashing with existing local databases) with all credentials set to hasura to reduce setup friction.
Self-hosting notes
Self-hosting V2 is well documented: install-manifests/ contains ready-to-use configurations for Docker Compose (docker-compose, docker-compose-https, docker-compose-postgis, docker-compose-mysql-preview, docker-compose-yugabyte, docker-compose-ms-sql-server, docker-compose-cockroach), Docker run commands (docker-run), Azure container deployment (azure-container, azure-container-with-pg), and an enterprise variant. V3 self-hosting is newer and documented separately through the /v3/README.md referenced from the root README, reflecting that V3's DDN-oriented deployment model differs from V2's single-container approach.
What to copy (and what not to)
The Data Connector pattern — a documented HTTP contract (dc-agents/dc-api-types) with a runnable reference implementation (dc-agents/reference) and at least one real backend (dc-agents/sqlite) — is a strong pattern to copy for any engine that needs to support many backends without hard-coding each one into the core: new integrations become new out-of-process services instead of new branches in the main codebase. Running two full, independently built engines (Haskell V2 and Rust V3) in the same repository long-term is a heavier decision to copy: it lets V2 stay stable for existing users while V3 is developed without disrupting it, but it also means two build toolchains (Cabal and Cargo), two sets of CI jobs, and two mental models to maintain simultaneously — worth doing only when the existing engine genuinely cannot be evolved in place.
Sources & repo audit
- Audited
- Sep 17, 2026
- Commit
- 17493b6
- License
- Apache-2.0
- v3/Cargo.toml (Rust V3 engine workspace, package version 3.0.0)
- cli/go.mod (Go CLI module)
- dc-agents/sqlite/package.json (SQLite Data Connector agent)
- packaging/graphql-engine/Dockerfile (release server image)
- .circleci/postgres-13.0-alpine-postgis3/Dockerfile (Postgres+PostGIS CI image)
Independent analysis of repository at github.com/hasura/graphql-engine. Spotted an inaccuracy? Use the claim form to request a correction.
Show this stack on your README or website
[](https://stackitfast.com/project/hasura)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 Hasura'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 "Hasura" 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 **Hasura**.
---
## 1. PROJECT SPECIFICATIONS & BENCHMARK
- **Reference Architecture**: Hasura
- **What It Does**: Hasura is an open-source engine that turns a database schema into a secured, realtime GraphQL and REST API, shipping two parallel engines from one repository: a mature Haskell server for GraphQL Engine V2 and a newer Rust engine powering Hasura DDN (V3).
- **Domain & Category**: Instant GraphQL Engine & Unified Data Access
- **Production Scale**: 20+ people
- **Development Mode**: CLASSIC
- **Architectural Rationale**: Hasura runs two independently evolving query engines from one repository — a Haskell V2 server and a Rust V3 engine — and extends database support through an out-of-process Data Connector protocol, so a new database backend plugs in as a separate agent instead of new code inside either engine.
- **Live Website Reference**: https://hasura.io
- **Source Repository**: https://github.com/hasura/graphql-engine
---
## 2. PRODUCTION TECH STACK
- **Full Stack Array**: TypeScript, Haskell, Rust, Go, GraphQL, PostgreSQL, React, SQLite, Docker
- **Primary Language(s)**: TypeScript, Haskell
- **License of the reference repo**: Apache-2.0
- **Frontend**: React — The Hasura Console (frontend/) is an Nx-managed React workspace, pinned to React 17 via a yarn resolution.
- **Backend & APIs**: Haskell — GraphQL Engine V2 server lives in server/ as a Cabal project (graphql-engine.cabal), the mature production engine.; Rust — GraphQL Engine V3, powering Hasura DDN, lives in v3/ as a Cargo workspace of engine/execute/plan/metadata-resolve crates.; Go — The hasura CLI (cli/, module github.com/hasura/graphql-engine/cli/v2) is a separate Go binary from both engines.; GraphQL — The query language both the V2 Haskell engine and V3 Rust engine expose over the database schema.
- **Data & persistence**: PostgreSQL — Primary supported database; CircleCI test images build Postgres with PostGIS for geospatial query coverage.; SQLite — Reference Data Connector agent (dc-agents/sqlite) shows how a new database backend plugs in without engine changes.
- **Infrastructure & deploy**: Docker — packaging/graphql-engine/Dockerfile builds the release server image; docker-compose.yaml and dc-agents/*/Dockerfile cover local/dev stacks.; CircleCI — Primary CI for the V2 Haskell server and console (.circleci/config.yml, per-database test Docker images).
- **Tooling, testing & ops**: Cabal — Build system and dependency resolver for the Haskell V2 server (cabal.project, multiple dev/CI project variants).; HLint — Haskell linter run in CI for the V2 server, configured via .hlint.yaml and the hlint.yml workflow.; Vitest — Unit test runner for cli-ext, the standalone action-scaffolding service (test:unit script).
---
## 3. KEY ARCHITECTURAL DECISIONS (audited from https://github.com/hasura/graphql-engine @ 17493b6)
1. **Two GraphQL engines, Haskell V2 and Rust V3, ship from one repository**: server/graphql-engine.cabal builds the mature, Haskell-based GraphQL Engine V2, while v3/Cargo.toml defines a separate Rust workspace (package.version = "3.0.0") powering Hasura DDN; the README documents both under distinct "Hasura V2" and "Hasura V3" sections rather than treating V3 as a simple upgrade of V2.
2. **New databases plug in as out-of-process Data Connector agents**: dc-agents/reference (a Node/TypeScript template, exposing port 8100) and dc-agents/sqlite (@hasura/dc-agent-sqlite) both implement the same dc-api-types contract from dc-agents/dc-api-types/package.json, so adding database support does not require changing the Haskell or Rust engine code, only writing a new agent against the documented protocol.
3. **The CLI is a standalone Go module, not part of either engine**: cli/go.mod declares module github.com/hasura/graphql-engine/cli/v2 as its own Go module with its own dependency set (including gin-gonic/gin and gin-contrib/static to serve the local console UI), built and released independently of the server/ (Haskell) and v3/ (Rust) engines.
4. **V3 engine crates are split by query pipeline stage, not by connector**: v3/Cargo.toml workspace members include engine, execute, plan, plan-types, metadata-resolve, jsonapi, compatibility, open-dds, plus glob groups graphql/* and auth/*, mirroring the path a query takes from metadata resolution through planning to execution rather than grouping code by which external database or connector it targets.
5. **Postgres with PostGIS is the pinned reference test database for V2**: .circleci/postgres-12.0-alpine-postgis3/Dockerfile and .circleci/postgres-13.0-alpine-postgis3/Dockerfile both build from circleci/postgres:<version>-postgis rather than the plain Postgres image, so CI exercises geospatial (PostGIS) query support as a standard part of the V2 test matrix.
6. **The Console frontend and the Action-scaffolding service are separate JS/TS projects**: frontend/package.json (Nx workspace, React 17 pinned via a yarn resolution) builds the Console UI, while cli-ext/package.json (name scaffolder, Babel-transpiled) is an independent Node service the CLI calls out to for generating Hasura Action scaffolds, each with its own dependency tree, build and test setup.
---
## 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, SQLite): 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 Hasura
What is Hasura built with?
Hasura ships two engines from one repository: a Haskell server (server/, Cabal-built) for GraphQL Engine V2, and a Rust workspace (v3/, Cargo-built) for the newer V3 engine that powers Hasura DDN. The Console frontend is React (Nx-managed), and the CLI is a separate Go module.
Does Hasura only work with PostgreSQL?
Postgres is the primary and most tested backend (CI builds Postgres images with PostGIS for geospatial coverage), but Hasura supports other databases through its Data Connector protocol — dc-agents/sqlite in this repo is a working example agent for SQLite, implemented independently of the core engine.
What is the Hasura Data Connector (DC) protocol?
It is an out-of-process agent protocol: dc-agents/reference is a Node/TypeScript template and dc-agents/sqlite a real SQLite implementation, both built against the shared dc-agents/dc-api-types contract, so a new database backend can be added as a standalone HTTP service without modifying the Haskell or Rust engine.
Can I self-host Hasura?
Yes. packaging/graphql-engine/Dockerfile builds the release server image, and docker-compose.yaml plus the install-manifests/ directory (Docker Compose, Kubernetes-adjacent manifests for various databases) document self-hosted deployment paths for the V2 engine.
What is the difference between Hasura V2 and V3?
V2 (server/, Haskell) is the current stable GraphQL Engine per the README. V3 (v3/, Rust, package version 3.0.0) powers Hasura DDN and adds support for MongoDB, ClickHouse and MS SQL Server alongside Postgres, plus custom business logic via TypeScript, Python and Go Connector SDKs, per the README's "Hasura V3" section.
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
- PostGraphileClassicAutomated GraphQL API Engine · 2-5 PeopleShares TypeScript · GraphQL · PostgreSQL
- InfisicalHybridSecret Management · 6-20 peopleShares React · TypeScript · Go
- QuestDBClassicTime-Series SQL Database · 20+ PeopleShares Rust · Docker · PostgreSQL
- ElectricSQLClassicLocal-First Sync Engine · 6-20 PeopleShares TypeScript · PostgreSQL · Rust
- StrapiClassicHeadless CMS · 20+ peopleShares TypeScript · React · PostgreSQL
- HoppscotchClassicAPI Testing Client · 6-20 peopleShares TypeScript · GraphQL · PostgreSQL