Skip to content

The codebase

How the repository is organised, how to build and test it, and where to start reading.

Applies to Engine
View as Markdown
On this page
  1. Build and test
  2. Where to start reading
Text
sypnia-data/
├─ crates/                 the engine (a Rust workspace)
│  ├─ core/                configuration, registry, pools, auth context, keys, rate limits, audit, errors
│  ├─ auth/                /auth/v1 and /auth/v1/oauth
│  ├─ mail/                e-mail providers and templates
│  ├─ rest/                the Data API and the schema cache
│  ├─ sql/                 /sql/v1: query, transactions, migrations, schema
│  ├─ mcp/                 the MCP server: tools, resources, the prompt
│  ├─ install/             the SQL migrations of the engine's own schemas and roles
│  ├─ server/              the binary: router, Lambda adapter, the sypnia-data commands
│  └─ testkit/             throwaway Postgres and helpers for the tests
├─ packages/
│  └─ data/                @sypnia/data: src/client, src/server, src/cli, and skills/ (sypnia-data)
├─ spec/
│  ├─ openapi.yaml         every endpoint: the contract the code and these docs follow
│  ├─ auth-schema.sql      the engine's tables, as installed
│  └─ introspect.sql       the query behind the schema cache and GET /sql/v1/schema
├─ Dockerfile, docker-compose.yml
├─ deploy/                 aws.yaml (the AWS template), aws/sypnia-data-cloud.yaml
├─ examples/espiga/        the bakery example used across these docs
├─ tests/mcp-sdk/          the MCP server tested with the official MCP SDK
└─ docs/ARCHITECTURE.md

Build and test

Terminal
cargo build --release                         # the binary
cargo lambda build --release --arm64          # for AWS Lambda
cargo test                                    # starts a throwaway Postgres with initdb and pg_ctl
pnpm install && pnpm -r build && pnpm -r test # @sypnia/data (client, server), against a local engine

Where to start reading

  • crates/core/src/context.rs: how a request becomes who is calling and which role.
  • crates/rest/src/parse.rs and build.rs: how a URL becomes one SQL statement.
  • crates/auth/src/sessions.rs: sessions, rotation and reuse detection.
  • crates/mcp/src/tools.rs: every MCP tool, and the rights each one needs.

The contract is spec/openapi.yaml: a change to an endpoint changes the spec first, and a test checks the code against it.

  1. Build and test
  2. Where to start reading

    Search pages, sections and terms