How adilmunawar/adinox works
Project Type and Purpose
• AdiNox is a single-page, full-stack authenticator application built with React (TypeScript) on the front end and Supabase for user authentication and optional data storage.
• It generates TOTP/HOTP codes locally and optionally persists user session data or settings in Supabase.
File Structure
• Top-Level Directories
– public/: Static assets (images, favicon, robots.txt).
– src/: All application code.
• src/ Subdirectories
– components/: UI fragments (tokens list, UI primitives under ui/).
– context/: React Context Providers (AuthContext, TokenContext, ThemeContext).
– hooks/: Custom hooks (use-mobile, use-toast).
– integrations/supabase/: Supabase client setup & types.
– lib/utils.ts & utils/tokenUtils.ts: Business logic (TOTP/HOTP generation, QR parsing, encryption).
– pages/: Top-level pages (AuthPage, Index, NotFound).
– main.tsx & App.tsx: Application entry point and router.
• Configuration & Build
– vite.config.ts, tsconfig*.json, tailwind.config.ts, postcss.config.js
– supabase/config.toml: Supabase project schema & migration config.
README for Additional Insights
• Confirms TOTP/HOTP support, QR-scan/manual entry, secure local storage, and Supabase-backed user authentication.
• Emphasizes open source, privacy, and cross-platform compatibility.
Main System Components
a. Frontend (Browser / React SPA)
– UI Layer: pages → components/ui → components/tokens
– State Layer: React Contexts (AuthContext, TokenContext, ThemeContext)
– Business Logic: tokenUtils (TOTP/HOTP), utils.ts
– Environment & Build: Vite dev server, Tailwind CSS, TypeScript
b. External Service
– Supabase Auth & Database: user sign-up, sign-in, session management, optional metadata storage
c. Local Storage
– Secure storage of token secrets and user preferences (localStorage or IndexedDB, possibly encrypted by tokenUtils)
d. Optional Integrations
– QR-scanner library for secret provisioning
– Clipboard / Web Crypto APIs
Relationships & Interactions
• User interacts with Browser (UI) → React triggers Context actions.
• AuthContext calls supabase-js SDK → Supabase Auth HTTP API → returns session token.
• On successful auth, TokenContext reads/writes secrets to localStorage (via utils) → triggers UI update.
• tokenUtils reads current time or counter → generates OTP → UI displays codes.
• All build & deploy tasks handled via Vite and Supabase CLI (supabase/config.toml) if database migrations are used.
Architectural Patterns
• Component-based UI, Single-Page Application
• Context API for global state management (Auth, Tokens, Theme)
• Separation of concerns: UI vs. State vs. Business Logic (utils) vs. Integration
• External-as-a-Service: Supabase for auth, no custom backend server
• Build & deploy pipelines via Vite and supabase CLI
Final Checklist
• Containers/boundaries for client vs. external services.
• Notes on important frameworks/technologies: React, Vite, Tailwind, supabase-js, Web Crypto API.