---
title: Repository layout
description: Map of the Polyflo GitHub repo — frontend entries, Rust modules, Tauri config, and CI.
url: https://pr-1-2b0a782aae90.thally.app/repository-layout
---

# Repository layout

Map of the Polyflo GitHub repo — frontend entries, Rust modules, Tauri config, and CI.

The product identifier is `com.polyflo.app`. The crate name is `polyflo`; the library target is `polyflo_lib` so `main.rs` can call `polyflo_lib::run()`.

#### [Crisiswastaken/PolyFlo](https://github.com/Crisiswastaken/PolyFlo)

## Tree

## Frontend (`src/`)

Vite builds **two HTML entries** (`vite.config.ts`):

| Entry | HTML | React mount | Window label |
| --- | --- | --- | --- |
| Settings | `index.html` → `src/main.tsx` → `App.tsx` | `<Settings />` | `settings` |
| Overlay | `overlay.html` → `src/overlay-main.tsx` | `<Overlay />` | `overlay` |

There is no router. Settings is a single panel. Overlay listens to `dictation-state` and `audio-level` only — it never calls STT.

Shared TypeScript contracts live in `src/types.ts` and must stay aligned with the `#[serde(rename_all = "camelCase")]` structs in Rust.

## Backend (`src-tauri/src/`)

| Module | Responsibility |
| --- | --- |
| `lib.rs` | App bootstrap, plugins, `AppState`, window close behavior, command list |
| `session.rs` | Idle → listening → processing → injecting state machine |
| `hotkey.rs` | Global shortcut press/release → `SessionController` |
| `audio/` | cpal capture thread, 16 kHz resample, WAV wrap |
| `stt/sarvam.rs` | Multipart POST to Sarvam speech-to-text |
| `translate/sarvam.rs` | Translate mode + LID + `sarvam-translate:v1` fallback |
| `inject/` | Clipboard write, enigo paste, Windows focus restore, macOS trust check |
| `commands.rs` | Tauri IPC used by Settings |
| `config.rs` | `settings.json` |
| `secrets.rs` | OS keyring + `SARVAM_API_KEY` |
| `history.rs` | `history.json`, max 50 entries |
| `events.rs` | `app.emit(...)` to both webviews |
| `tray.rs` | Tray menu: Open Settings, Quit |

## Config you will touch

| File | When |
| --- | --- |
| `src-tauri/tauri.conf.json` | Windows, CSP, bundle targets, identifier, version |
| `src-tauri/capabilities/default.json` | Which windows may call which plugins |
| `src-tauri/permissions/app-commands.toml` | Allow-list of `invoke` command names |
| `src-tauri/Cargo.toml` | Rust deps (`cpal`, `reqwest`, `enigo`, `keyring`, …) |
| `package.json` | Frontend deps and npm scripts |
| `.github/workflows/release.yml` | Tag-triggered installer matrix |

## Version numbers

Keep these in sync when you cut a release:

- `package.json` `"version"`
- `src-tauri/tauri.conf.json` `"version"`
- `src-tauri/Cargo.toml` `version`

CI does not bump them for you. See [Releases](/releases).

## What is not in this repo

- No server, database, or user accounts
- No Linux target in the release matrix
- No automated unit-test job on pull requests (run tests locally — [Testing](/testing))
- Product docs are in [polyflo-docs](https://github.com/Crisiswastaken/polyflo-docs), not this tree