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

# Stack Overview

MIRARI is a single full-stack app, no microservices, no sidecars.

## Runtime

| Layer        | Tech                                                                 |
| ------------ | -------------------------------------------------------------------- |
| Framework    | **TanStack Start v1** (React 19, file-based routing, SSR)            |
| Build        | **Vite 7**                                                           |
| Styling      | **Tailwind CSS v4** with semantic tokens in `src/styles.css` (oklch) |
| UI kit       | **shadcn/ui** primitives on Radix                                    |
| Charts       | **Recharts**                                                         |
| State/data   | **TanStack Query** + TanStack Router loaders                         |
| Backend      | Postgres + auth + storage (the **Hermes Agent backend**)             |
| Server logic | **TanStack server functions** (`createServerFn`)                     |
| Auth         | Email/password + Google OAuth                                        |

## Why this stack

* **One repo, one deploy.** Pages, RPCs, and database calls live next to each other. No separate API project.
* **Server functions over edge functions.** Business logic (chat, mirror analysis, skill suggestion) is written as `createServerFn` handlers that the frontend calls via `useServerFn`. They run on the same Worker that serves the SSR.
* **RLS everywhere.** Every user-scoped table has Row-Level Security: a user can only read or write rows where `user_id = auth.uid()`. The server-function handlers are middleware-protected with `requireSupabaseAuth`.
* **Local-first keys.** Your Hermes API keys never round-trip to our database — they sit in the browser key vault and are passed *through* server functions to your endpoint.

## High-level diagram

```
 ┌──────────────────────────────────────────────────────────┐
 │  Browser                                                 │
 │   ├─ MIRARI UI (React 19 + Tailwind)                     │
 │   ├─ Local key vault (per-connection API keys)           │
 │   └─ useServerFn(...) ─────────────┐                     │
 └────────────────────────────────────┼─────────────────────┘
                                      │  RPC
 ┌────────────────────────────────────▼─────────────────────┐
 │  TanStack Start server                                   │
 │   ├─ requireSupabaseAuth middleware                      │
 │   ├─ chatCompletion / analyzeMirror / suggestSkill ...   │
 │   └─ Postgres (RLS-scoped) + Auth                        │
 └────────────────────────┬─────────────────────────────────┘
                          │  HTTPS, user's key
                          ▼
                ┌──────────────────────┐
                │  Hermes Agent        │
                │  (OpenAI-compatible) │
                └──────────────────────┘
```


---

# 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:

```
GET https://entermirari.gitbook.io/entermirari-docs/architecture/stack.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
