How franciscobsalgueiro/en-croissant works
En-Croissant is a desktop application built as a Tauri shell around a React/TypeScript frontend and a Rust backend. The key architectural boundary is the Tauri bridge: the UI handles interaction and rendering, while Rust owns local system access, file/database operations, engine processes, and other privileged work.
The frontend is organized around route-level pages rather than a single screen. Main entry points include accounts, databases, engines, files, settings, and the home dashboard. The top-level app and route tree coordinate navigation, while most user-facing behavior is implemented in feature folders under src/components.
A large part of the UI is board-centric. The chessboard is rendered through a chessground wrapper, with surrounding panels for analysis, annotation, database lookup, practice, puzzle solving, and game info. This board workspace is the core interaction surface for reviewing positions, editing games, and driving engine analysis.
State is split between local UI state and durable app state. The src/state layer contains atoms, tree/session utilities, keybind definitions, and debounced storage, which suggests the app persists user preferences and workspace state locally. The src/utils layer contains most shared domain logic for chess, scoring, clocks, time controls, repertoire behavior, tabs, and session management.
The Rust backend under src-tauri/src is responsible for the non-UI subsystems. It includes modules for chess logic, PGN parsing, puzzle support, progress reporting, sound playback, file-system access, OAuth, and opening preparation. This backend likely exposes Tauri commands that the frontend calls for local processing and integrations.
Database handling is a major subsystem. The src-tauri/src/db module contains schema, models, operations, search, indexing, and encoding code, along with SQL files for creation and index maintenance. On the UI side, database pages and panels support viewing games, players, tournaments, and openings, plus database loading and source-specific options for local, Lichess, and Masters data.
Engine support is another primary boundary. The Rust engine module manages external UCI engines as processes, while the frontend provides engine selection, engine settings, analysis controls, and log views. The analysis workflow likely flows from the board state into engine commands, then back into evaluation, principal variation, and reporting UI.
External services are integrated through dedicated utilities and OAuth support. The repo includes Lichess and chess.com API helpers, a chess.com-specific TCN utility, and a chessdb API helper, indicating that online account/game import and position lookup are first-class features. These services feed the accounts and databases areas rather than being directly embedded in the board UI.
File and repertoire management is treated as a separate subsystem. The files pages and helpers manage local directories, file cards, and opening data, while the practice and repertoire panels use that data for training workflows. This makes the app useful both as a database browser and as a local study environment.
The app is heavily themeable and localized. Static assets include many chess piece sets and multiple sound packs, while translations are organized through i18next locale files. These assets affect diagramming because they are not just cosmetic: they are part of the configurable presentation layer and user experience.
Build and deployment are split between a web-tooling frontend and a native backend package. The frontend uses Vite, TypeScript, and pnpm, while the Rust side is built with Cargo under Tauri. GitHub Actions cover testing and release, and the repository also includes frontend tests for chess logic and store behavior.
For an architecture diagram, the clearest high-level flow is: user interaction in React pages and board panels → shared TypeScript domain/state utilities → Tauri command bridge → Rust services for filesystem, database, engines, and external access → results returned to the UI for rendering and persistence.
Main entry points: routes Route tree · settings Settings page · main.rs Rust backend · src Local services
Components 18
Frontend
React/Tauri UI, routing, and feature components
- App shell · Top-level React entry and route wiring
src/App.tsx - Route tree · Route-level pages for accounts, databases, engines, files, settings, and home
src/routes - Board workspace · Main chessboard surface and surrounding analysis/editing panels
src/components/boards - Home pages · Account and personal overview screens
src/components/home - Database pages · Database list, views, players, tournaments, and source options
src/components/databases - File pages · Local directories, file cards, and opening files
src/components/files - Engine pages · Engine management and configuration screens
src/components/engines - Settings page · User preferences for board, sound, theme, and keybinds
src/components/settings - Tab workspaces · Board tabs, new-tab home, import, and repertoire flows
src/components/tabs - Tauri bindings · Generated command bindings used by the frontend to call Rust
src/bindings
State & Logic
Shared TypeScript state and domain utilities
- App state · Persistent UI state, tree/session utilities, and debounced storage
src/state - Domain utils · Chess, scoring, clocks, repertoire, files, tabs, and session helpers
src/utils
Backend
Rust services behind the Tauri bridge
- Rust backend · Tauri application entry and command host
src-tauri/src/main.rs - Database core · Schema, models, search, indexing, and SQL maintenance
src-tauri/src/db - Engine runner · External chess engine process management and UCI protocol handling
src-tauri/src/engine - Local services · Chess logic, PGN, puzzles, opening prep, filesystem, OAuth, progress, and sound
src-tauri/src
Assets
Static presentation assets and localization
- Locales · Application translation bundles
src/translation - Pieces & sounds · Chess piece themes and move sound packs
public
Connections 24
- App shell → Route tree: navigates · App shell mounts the route tree
- Route tree → Home pages: renders · Routes open dashboard and account pages
- Route tree → Database pages: renders · Routes open database browsing pages
- Route tree → File pages: renders · Routes open file management pages
- Route tree → Engine pages: renders · Routes open engine configuration pages
- Route tree → Settings page: renders · Routes open settings pages
- Route tree → Tab workspaces: renders · Routes support board workspace and tab flows
- Route tree → Board workspace: hosts · Route-level pages embed the board workspace
- Board workspace → App state: reads/writes · Board interaction is coordinated through app state
- Board workspace → Domain utils: uses · Board logic relies on shared chess and session helpers
- Tab workspaces → App state: persists · Workspace/tab state is stored locally
- Database pages → Tauri bindings: calls · Database UI invokes Tauri commands through bindings
- File pages → Tauri bindings: calls · File UI accesses local filesystem through bindings
- Engine pages → Tauri bindings: calls · Engine UI configures and monitors backend processes
- Settings page → App state: persists · Preferences are stored through the state layer
- Settings page → Pieces & sounds: configures · Theme settings affect board pieces and sounds
- Settings page → Locales: uses · Localized strings drive the settings UI
- Tauri bindings → Rust backend: invokes · Generated bindings call into Rust commands
- Rust backend → Database core: owns · Backend manages database creation, search, and indexing
- Rust backend → Engine runner: owns · Backend launches and supervises external engines
- Rust backend → Local services: provides · Backend exposes filesystem, chess, PGN, OAuth, puzzle, and sound services
- Local services → Database core: supports · Local services feed database and opening workflows
- Local services → Engine runner: coordinates · Analysis and puzzle flows coordinate with engine processes
- Domain utils → Local services: shapes data · Frontend domain objects align with backend service behavior