How hassanzohaib121/authentication-app works
This is a local desktop authentication and user-management app. A first-run user creates the initial super-admin account; later, users sign in, receive a session, and use the dashboard for profile and password changes, while super-admins manage accounts and roles. The Next.js UI invokes Rust commands through Tauri; Rust owns authentication, authorization, sessions, and persistence in SQLite. The graph also preserves account lockout and audit logging. Some frontend and backend modules are unsampled, so their documented responsibilities are shown without speculative internal wiring.
Main entry points: lib.rs Tauri command host · service.rs Auth and account logic · page.tsx First-run page · dashboard-auth-guard.tsx Session guard
Components 16
Frontend experience
- First-run page
src/app/signup/page.tsx - Setup form
src/components/auth/signup-form.tsx - Login page
src/app/login/page.tsx - Login form
src/components/auth/login-form.tsx - Session guard
src/components/dashboard/dashboard-auth-guard.tsx - Dashboard shell
src/app/dashboard/layout.tsx - Account settings
src/app/dashboard/settings/page.tsx
Authentication backend
- Tauri command host
src-tauri/src/lib.rs - Auth commands
src-tauri/src/auth/commands.rs - Auth and account logic
src-tauri/src/auth/service.rs - Session lifecycle
src-tauri/src/auth/session.rs - Audit logging
src-tauri/src/auth/audit.rs - Auth data entities
src-tauri/src/auth/entity.rs
Local persistence
- Database initialization
src-tauri/src/connection.rs - SQLite database
Other components
- App user
Connections 23
- App user → First-run page: starts setup
- First-run page → Tauri command host: checks setup
- First-run page → Setup form: shows form
- Setup form → Tauri command host: submits setup
- App user → Login page: opens sign-in
- Login page → Login form: shows form
- Login form → Tauri command host: submits credentials
- Tauri command host → Auth commands: dispatches commands
- Auth commands → Auth and account logic: calls auth logic
- Auth and account logic → Session lifecycle: manages sessions
- Auth and account logic → Audit logging: records actions
- Auth and account logic → Auth data entities: uses auth records
- Auth commands → Session lifecycle: validates session
- Tauri command host → Database initialization: initializes database
- Database initialization → SQLite database: creates and seeds
- Auth and account logic → SQLite database: reads and writes
- Session lifecycle → SQLite database: stores sessions
- Audit logging → SQLite database: stores audit events
- App user → Session guard: opens dashboard
- Session guard → Tauri command host: checks session
- Session guard → Dashboard shell: allows access
- Dashboard shell → Account settings: opens settings
- Account settings → Tauri command host: manages account