Warraq is a desktop system for the Mustapha Bacha Hospital library. It supports catalogue work, circulation, inventory, member records, reporting, and configurable metadata integrations, backed by a shared Supabase (Postgres) database β the same data the public catalog website reads.
Status: The most actively developed project in the portfolio. Core workflows (catalogue, circulation, inventory, members, reservations, reporting) are working, with recent commits polishing localization, notifications, and cover-image backfill. No Windows 7 support (WebView2 dependency). Catalog import currently covers books only β no FYP/journal import path yet.
- Dashboard, catalogue, circulation activity, inventory, members, reservations, and reports
- Shared Supabase (Postgres) backend β every desktop install reads/writes the same data, ready for a future public website
- Books / FYP (PFE) / journals item types, each with ISBN + Dewey + NLM ("Cote") classification fields
- Fixed shelf model per room: six lettered shelves (AβF) plus one larger floor shelf
- Member roles (visitor / student / staff / medic) with internal vs. external reservation rules β visitors and single-copy titles are internal-only, and reservations require admin accept/decline (with a member-ban option)
- Arabic, English, and French interface translations (RTL-aware)
- Barcode support and image upload controls
- JSON import for books/members
- Optional Open Library, Google Books, and Groq metadata providers
- Custom titlebar, persistent window state, single-instance behavior, shortcuts, and close-to-tray workflow
- Stronghold-backed local secrets and scoped Tauri capabilities; the Supabase service-role key never leaves the Rust process
Dashboard: A library overview with titles, copies, active loans, circulation rhythm, and recent borrowing activity.
Inventory: Room, shelf, and copy-condition controls for physical collection operations.
src/
|-- app/ # Application shell and providers
|-- components/ # Layout and shared UI components
|-- data/ # Supabase client, auth, repositories
|-- i18n/ # Arabic, English, and French translations
|-- sections/ # Dashboard, catalogue, inventory, members, reports, settings
|-- store/ # UI state + shared library settings
|-- utils/ # ISBN, dates, currency, and metadata helpers
`-- main.tsx # React entry point
src-tauri/
|-- capabilities/ # Tauri permission definitions
|-- src/ # Native tray, window, and Supabase-admin logic
|-- tauri.conf.json # Build and desktop configuration
`-- Cargo.toml # Rust dependencies
supabase/
`-- migrations/ # Postgres schema, RLS policies, and business-rule functions
scripts/
`-- import_catalog.py # One-off import of the recovered book inventory (see below)
- Node.js 18+
- pnpm
- Rust toolchain
- Tauri system dependencies for your operating system
- A Supabase project (see Environment variables below)
Copy .env.example to .env and fill in:
| Variable | Used by | Notes |
|---|---|---|
WARRAQ_ADMIN_USERNAME / WARRAQ_ADMIN_PASSWORD |
Rust (bootstrap) | Creates the one administrator account the first time the app runs against an empty profiles table. |
WARRAQ_ADMIN_EMAIL |
Rust (bootstrap) | Optional β if unset, the bootstrap admin gets a synthetic <username>@warraq.local identity. |
PROJECT_ID, PUBLISHABLE_KEY, SECRET_KEY |
Rust only (src-tauri/src/admin.rs) |
SECRET_KEY is the Supabase service-role key β it must never be exposed to the frontend. |
DIRECT_STRING |
Manual migrations only | Direct Postgres connection for running SQL in supabase/migrations/; resolves over IPv6 only from most networks β use the Supavisor pooler instead (see the comment in .env.example). |
VITE_SUPABASE_URL, VITE_SUPABASE_ANON_KEY |
Frontend (Vite) | The anon/publishable key is meant to be public β every table it can reach is protected by Postgres Row Level Security, not by keeping this key secret. |
pnpm install
cp .env.example .env # fill in the variables above
pnpm tauri devFor frontend-only work, run pnpm dev. Note that admin/staff account management (create/reset-password/delete) requires the Tauri runtime, since those go through the Rust admin_* commands.
pnpm dev # Start Vite
pnpm build # Type-check and build frontend assets
pnpm typecheck # Run TypeScript checking
pnpm test # Run Vitest tests
pnpm rust:check # Check the Rust/Tauri application
pnpm tauri dev # Run the desktop app
pnpm tauri build # Build the production desktop installer (Windows/macOS/Linux)Warraq requires signing in β there is no anonymous access. Sign-in uses Supabase Auth; the login form takes a username, which is resolved to the corresponding Supabase Auth email server-side (resolve_login_email β see supabase/migrations/0008_login_helper.sql) before authenticating.
On first launch, if no staff profiles exist yet, the app reads WARRAQ_ADMIN_USERNAME / WARRAQ_ADMIN_PASSWORD (and optionally WARRAQ_ADMIN_EMAIL) and creates the one administrator account via the Supabase Admin API β Rust only, using the service-role key, never sent to the frontend.
Once signed in, an administrator manages every other account from Settings β Users: creating staff/admin accounts, resetting passwords, and enabling/disabling access without deleting anyone's borrowing or audit history. The last active administrator can't be demoted, disabled, or deleted (enforced by a Postgres trigger on profiles, not just the UI), so the library can never be locked out.
All schema, Row Level Security policies, and business-rule functions (checkout/return, reservation accept/decline, member bans, shelf provisioning) live in supabase/migrations/, applied directly to the project via psql. There is no supabase CLI dependency β the migrations are plain numbered .sql files, applied in order.
Circulation rules and the library's institutional profile (name, address, loan/renewal limits, fines, reservation durations) live in the shared library_settings table (Settings β General/Library Profile/Rules/Fines), not in per-device preferences β every staff device sees the same rules. Purely local UI preferences (theme, accent color, font size, close-to-tray, integration API keys) stay in the Tauri Store per device.
scripts/import_catalog.py parses the book inventory recovered from documents/Ψ§ΩΨͺΨ΅ΩΩΩ/*.docx (NΒ°/Title/Author/Year/Cote/Observation tables) into a reviewable SQL file, deduplicating cross-file draft copies and grouping repeated rows into one book with multiple physical copies:
python scripts/import_catalog.py # writes scripts/import_catalog.sql + prints a summary
# review scripts/import_catalog.sql, then:
psql -h <pooler-host> -U <project-ref-user> -d postgres -v ON_ERROR_STOP=1 -f scripts/import_catalog.sqlThis only imports books β the source .docx files contain no FYP (PFE) or journal records, so those need separate data entry or a future import source.
- Windows 7 build: not currently supported. Tauri v2 desktop apps depend on Microsoft's WebView2 runtime, which Microsoft does not support on Windows 7, and current Rust toolchains have dropped Windows 7 as a baseline target. A Win7 build would need a pinned legacy Rust toolchain and an alternate target triple, with no guarantee WebView2 itself would run β deferred pending a decision on whether that investment is worthwhile.
- Cataloguing: Search or add records, enrich them with metadata providers, and maintain copy information.
- Circulation: Track active loans, member activity, reservations, and returns.
- Inventory: Review rooms and their fixed AβF + floor shelves, then record copy condition and availability.
- Reservations: Internal (in-library) or external (take-home) requests go to
pending; an admin accepts, declines, or bans the requesting member. - Reporting: Use the reporting and export views to share library activity without exporting secure credential data.
Ctrl/Cmd + Kopens the command palette./focuses the main search workflow.Ctrl/Cmd + ,opens settings.- The system tray can restore the app, open search or circulation, open settings, and quit explicitly.
- When configured, closing the window hides it to the tray instead of terminating the application.
This project is licensed under the PolyForm Noncommercial License 1.0.0. It may be used, modified, and shared strictly for non-commercial purposes. Any commercial use, sale, integration into paid software, or paid service usage is prohibited.

