π¨ Frontend Development
This section covers the SvelteKit frontend architecture, components, and development patterns.
π Overview
LibreFolio's frontend is built with:
- SvelteKit 2.x - Full-stack web framework
- Svelte 5 - Reactive UI framework using Runes (
$state,$derived,$effect) - Tailwind CSS 4.x - Utility-first CSS (configured via
@themein CSS) - TypeScript - Type safety
- lucide-svelte - Icon library
π Directory Structure
frontend/src/
βββ routes/ # SvelteKit pages and routing
β βββ (app)/ # Authenticated app routes (Dashboard, Brokers, etc.)
β β βββ dashboard/
β β βββ brokers/
β β β βββ [id]/ # Broker detail page
β β βββ assets/
β β βββ transactions/
β β βββ fx/
β β βββ files/
β β βββ settings/
β βββ +page.svelte # Login page (Public)
βββ lib/
β βββ api/ # API client (Zodios, generated from OpenAPI)
β βββ components/ # Reusable components
β β βββ auth/ # LoginCard, RegisterCard, ForgotPasswordCard
β β βββ brokers/ # Broker cards, forms, icon, import
β β βββ files/ # FilesTable with DataTable
β β βββ layout/ # Sidebar, Header, LanguageSelector
β β βββ settings/ # Settings tabs (Profile, Preferences, Global, About)
β β βββ table/ # DataTable suite (ModalBase, ConfirmModal, etc.)
β β βββ ui/ # Generic UI atoms
β β βββ input/ # PasswordInput, PasswordStrength
β β βββ media/ # ImageCropper, ImageEditModal, AssetPickerModal, FileEditModal
β β βββ select/ # BaseDropdown, SimpleSelect, SearchSelect
β βββ i18n/ # Internationalization (EN, IT, FR, ES)
β βββ stores/ # Global state (Auth, Settings, Language)
β βββ types/ # TypeScript type definitions
β βββ utils/ # Utilities (imageCrop, upload, urlFilters)
βββ e2e/ # Playwright E2E tests (7 suites, 109+ tests)
βββ static/ # Static assets
β‘ Svelte 5 Runes
LibreFolio fully embraces Svelte 5's Runes for reactivity, replacing the legacy let and $ syntax.
π Key Runes Used
$state: Declares reactive state.$derived: Declares derived state (automatically updates when dependencies change).$effect: Side effects (runs when dependencies change).$props: Declares component props.
π Documentation Sections
- Components - Reusable UI components
- FX Chain Algorithm - DFS pathfinding for currency conversion chains
- Pages - Application pages and routing
- State Management - Stores and reactive state
- Internationalization - Multi-language support
- Styling - Tailwind CSS and theming
ποΈ Build & Development
Frontend tasks are managed via dev.py front:
# Start Vite dev server with Hot Module Replacement
./dev.py front dev
# Build for production (output in frontend/build/)
./dev.py front build
# Build with source maps for debugging
./dev.py front build --debug
# Type-check with svelte-check
./dev.py front check
# Preview production build locally
./dev.py front preview
| Command | Description |
|---|---|
front dev |
Starts Vite at localhost:5173, proxies API calls to backend |
front build |
Production build with minification and tree-shaking |
front build --debug |
Build with source maps (useful for debugging deployed code) |
front check |
Runs svelte-check for TypeScript and Svelte diagnostics |
front preview |
Serves the production build locally for testing |
Development workflow
Run ./dev.py server in one terminal and ./dev.py front dev in another. The Vite dev server proxies /api calls to the backend automatically.
π Quick Links
| Topic | Description |
|---|---|
| DataTable | Advanced table with sorting, filtering, pagination |
| FX Chain Algorithm | DFS + graphology for multi-step FX routes |
| Authentication | LoginCard, RegisterCard, ForgotPasswordCard |
| Settings | User preferences, profile, and global settings |
| File Upload | File uploader, image crop, asset picker |