> For the complete documentation index, see [llms.txt](https://seekspeed.gitbook.io/seekspeed-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://seekspeed.gitbook.io/seekspeed-docs/architecture/overview.md).

# System Overview

```
┌────────────────────────┐    ┌──────────────────────────┐
│  Browser (React 19)    │    │  Postgres                │
│  TanStack Router        │◄──►│  workspaces / connectors │
│  Recharts / shadcn      │    │  agents / runs / specs   │
└──────────┬──────────────┘    │  recommendations / etc.  │
           │  server fn RPC    └──────────▲───────────────┘
           ▼                              │
┌──────────────────────────┐              │
│  TanStack Start server    │──────────────┘
│  createServerFn handlers  │     ┌──────────────────────┐
│  - benchmark              │────►│  OpenAI-compatible    │
│  - connector-test         │     │  endpoints (any)      │
│  - solana-auth            │     └──────────────────────┘
│  - spec-lab probes        │
│  - share-token report     │     ┌──────────────────────┐
└───────────┬───────────────┘────►│  vLLM / TGI / llama   │
            │                     │  + DeepSpec / DSpark  │
            ▼                     └──────────────────────┘
       /metrics, /info, /props
```

## Layers

1. **Routing**: file-based via TanStack Router. Marketing pages, `/app/*` shell, and `/api/public/*` for webhooks / shared report tokens.
2. **Server functions**: `createServerFn` modules for benchmarking, connector tests, Spec Lab probes, Solana wallet auth, and report sharing. These are the only places that touch secrets.
3. **Data layer**: Postgres with RLS. Every table has a `workspace_id` and a policy that joins to `workspaces.owner_id = auth.uid()`.
4. **Adapters**: Spec Lab adapters speak HTTP to vLLM `/metrics`, TGI `/info`, llama.cpp `/props`, or a DeepSpec orchestrator.

## Why TanStack Start

We needed a framework that lets the same TypeScript module define both a typed client RPC and a server handler, with SSR for the marketing surface and edge-deployable bundles for the app. `createServerFn` gives us that without a separate API project:

```ts
// src/lib/benchmark.functions.ts
export const runBenchmarkOnce = createServerFn({ method: "POST" })
  .inputValidator((d) => Schema.parse(d))
  .handler(async ({ data }) => {
    // Real HTTP call to data.baseUrl/chat/completions
    // SSE parsing for TTFT, usage aggregation, error capture
  });
```

The client just does `useServerFn(runBenchmarkOnce)` and gets a typed async function. No fetch wrappers, no API schemas duplicated.

Continue to [Data Model →](/seekspeed-docs/architecture/data-model.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://seekspeed.gitbook.io/seekspeed-docs/architecture/overview.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
