This document provides a detailed overview of the QuantumVault frontend application, covering its architecture, state management, component library, and utility functions.
- Framework: React 18
- Build Tool: Vite
- Styling: Vanilla CSS (CSS Modules approach without the .module suffix)
- Icons:
lucide-react - Authentication:
@react-oauth/google - Utilities:
otpauth: TOTP generation/verificationqrcode: QR code generation for 2FA setupjwt-decode: Parsing user identity from tokens
Follow these steps to set up the project locally.
- Node.js: Version 18 or higher
- npm: Version 9 or higher
-
Clone the repository:
git clone https://github.com/securedapp-github/quantavault_front.git cd quantavault_front -
Install dependencies:
npm install
-
Create a
.envfile in the root directory:cp .env.example .env
-
Open
.envand fill in your configuration:VITE_GOOGLE_CLIENT_ID: Your Google OAuth Client ID.VITE_API_URL: The URL of your backend API (e.g.,http://localhost:5000/api).
Start the development server with Hot Module Replacement (HMR):
npm run devThe application will be available at http://localhost:5173.
Generate a production-ready build in the dist/ directory:
npm run buildPreview the production build locally:
npm run previewThe application is structured as a single-page application (SPA) with centered global state management.
The QuantumContext acts as the "Single Source of Truth" for the application. It handles:
- Authentication State: Persisting the logged-in user and handling session timeouts.
- Data Fetching: Loading keys, policies, and audit logs from the backend API.
- CRUD Operations: Centralizing the logic for adding, updating, and deleting keys/policies.
Dashboard.jsx: High-level overview of system health and quick action buttons.PQCKeys.jsx: Detailed management of post-quantum keys.AuthenticationKeys.jsx: Management of client authentication keys.Policies.jsx: Interface for creating and managing access control policies.AuditLogs.jsx: Advanced filtering and visualization of system logs.Settings.jsx: User profile management and 2FA configuration.
The application uses a modular component system:
- Layout:
Sidebar,PageHeader,Card,Table. - Forms:
Input,Button,RadioGroup. - Modals: Centralized
Modalbase with specific implementations likeCreatePQCKeyModal,KeyDetailsModal, etc. - Feedback:
Badge,EmptyState,TwoFactorVerify.
- User logs in via Google OAuth.
- Frontend receives a JWT and parses user details.
- If 2FA is enabled, the
TwoFactorVerifymodal is triggered. - Upon successful verification, the user gains access to the protected state.
- User selects "Rotate" on a PQC key.
- System generates a new key pair on the backend.
- The old key version is marked as
rotated. - Policies automatically point to the latest active version.
| Utility | Description |
|---|---|
api.js |
Axio-like wrapper for fetch with automatic JWT header injection. |
dateFormatter.js |
Standardizes date presentation across the app. |
idGenerator.js |
Client-side ID generation (fallback). |
constants.js |
Centralized list of status codes, algorithm names, and UI labels. |
- State Issues: Use React DevTools to inspect the
QuantumProviderstate. - API Errors: Check the Browser Console and Network tab. All API responses follow a
{ data: {}, error: { message: "" } }format. - 2FA Problems: Ensure the system time on the server and client are synchronized, as TOTP is time-sensitive.