|
| 1 | +# Frontend Overview |
| 2 | + |
| 3 | +The SpringQueuePro frontend is a **React + TypeScript dashboard** designed to surface the internal behavior of a production-grade task processing system in a clear, observable, and recruiter-friendly way. Rather than acting as a generic CRUD UI (like the interfaces for my SpringQueue (base) and GoQueue projects), each page highlights a specific system concern: authentication, task lifecycle, processing behavior, and operational health. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Authentication & Application Shell |
| 8 | + |
| 9 | +### **AuthContext.tsx** |
| 10 | + |
| 11 | +This file is the **core of the frontend authentication system**. |
| 12 | + |
| 13 | +`AuthContext` centralizes: |
| 14 | + |
| 15 | +* JWT access + refresh token storage |
| 16 | +* Session restoration on page reload |
| 17 | +* Automatic access token refresh |
| 18 | +* Logout and refresh token invalidation |
| 19 | +* A shared authentication contract (`useAuth`) for the entire app |
| 20 | + |
| 21 | +By wrapping the application in `AuthProvider`, authentication state and logic are **defined once** and consumed everywhere, avoiding prop drilling and duplicated token logic. This design also makes route protection and API authorization predictable and robust. |
| 22 | + |
| 23 | +--- |
| 24 | + |
| 25 | +### **ProtectedRoute.tsx** |
| 26 | + |
| 27 | +A lightweight route guard that: |
| 28 | + |
| 29 | +* Blocks access to protected pages if the user is not authenticated |
| 30 | +* Redirects unauthenticated users to the login flow |
| 31 | + |
| 32 | +This ensures the dashboard reflects real-world authorization boundaries. |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +### **App.tsx** |
| 37 | + |
| 38 | +Defines the application’s routing structure and access model: |
| 39 | + |
| 40 | +* Public routes (Login, Register, About) |
| 41 | +* Protected routes (Tasks, Dashboards, Metrics, Processing) |
| 42 | +* A default route that redirects users based on authentication state |
| 43 | + |
| 44 | +It acts as the **entry point and security boundary** for the frontend. |
| 45 | + |
| 46 | +--- |
| 47 | + |
| 48 | +### **NavBar.tsx** |
| 49 | + |
| 50 | +The primary navigation surface for authenticated users. |
| 51 | +It provides quick access to all operational dashboards and reflects the authenticated state of the application. |
| 52 | + |
| 53 | +--- |
| 54 | + |
| 55 | +## Authentication Entry & Visibility |
| 56 | + |
| 57 | +### **LoginPage.tsx** |
| 58 | + |
| 59 | +Handles user authentication and session initiation. |
| 60 | +On successful login, users are redirected into the authenticated dashboard flow. It also provides a public link to the About page for unauthenticated visitors. |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +### **RegisterPage.tsx** |
| 65 | + |
| 66 | +Handles account creation and initial onboarding. |
| 67 | +After registration, users are directed back into the login flow. Like the Login page, it allows access to the About page without authentication. |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +### **TokenDashboardPage.tsx** |
| 72 | + |
| 73 | +Provides a **high-level view of the authentication pipeline**, including token presence, expiry, refresh behavior, and overall session state. |
| 74 | + |
| 75 | +This page exists primarily as: |
| 76 | + |
| 77 | +* A transparency and debugging tool |
| 78 | +* A way to showcase JWT-based auth mechanics |
| 79 | +* A visual explanation of how authentication behaves “under the hood” |
| 80 | + |
| 81 | +> **Note on Token Rotation History** |
| 82 | +> |
| 83 | +> This page also includes a small, client-side visualization of refresh token rotation events to help |
| 84 | +> demonstrate how the authentication pipeline behaves in practice (JWT expiry, refresh, and Redis-backed |
| 85 | +> invalidation). This rotation history is **purely diagnostic and cosmetic**, scoped to the current user |
| 86 | +> session, and cleared on logout. |
| 87 | +> |
| 88 | +> It is not security-critical or authoritative, and is intentionally implemented client-side to avoid |
| 89 | +> adding backend complexity for a non-essential observability feature. In a production setting, this could |
| 90 | +> be backed by a user-scoped audit table if long-term persistence were required. |
| 91 | + |
| 92 | +--- |
| 93 | + |
| 94 | +## Task Interaction & Observability |
| 95 | + |
| 96 | +### **TasksPage.tsx** |
| 97 | + |
| 98 | +The **task submission interface**. |
| 99 | + |
| 100 | +This page focuses on: |
| 101 | + |
| 102 | +* Creating tasks via GraphQL |
| 103 | +* Selecting valid task types from dynamically loaded enums |
| 104 | +* Viewing the exact GraphQL mutation used |
| 105 | +* Inspecting the backend response |
| 106 | +* Seeing recently created tasks and retrying failures |
| 107 | + |
| 108 | +It intentionally keeps observability minimal, emphasizing **task creation mechanics** rather than system-wide inspection. |
| 109 | + |
| 110 | +--- |
| 111 | + |
| 112 | +### **TasksDashboardPage.tsx** |
| 113 | + |
| 114 | +The **deep introspection view** for task lifecycle management. |
| 115 | + |
| 116 | +This page provides: |
| 117 | + |
| 118 | +* A full task table with filtering and search |
| 119 | +* Live task status updates |
| 120 | +* Retry and deletion controls |
| 121 | +* A safe, read-only GraphQL explorer |
| 122 | +* Drill-down inspection via a detail drawer |
| 123 | + |
| 124 | +This dashboard is designed to feel closer to an internal operator or SRE tool than a traditional CRUD interface. |
| 125 | + |
| 126 | +--- |
| 127 | + |
| 128 | +### **TaskDetailDrawer.tsx** |
| 129 | + |
| 130 | +A stateless, presentational UI component used by the Tasks Dashboard. |
| 131 | + |
| 132 | +It slides in from the side and displays: |
| 133 | + |
| 134 | +* The GraphQL query used to fetch a task |
| 135 | +* The full task JSON payload |
| 136 | +* A simple close interaction |
| 137 | + |
| 138 | +It contains no business logic and exists purely to support task inspection. |
| 139 | + |
| 140 | +--- |
| 141 | + |
| 142 | +## Runtime & Operational Visibility |
| 143 | + |
| 144 | +### **ProcessingMonitorPage.tsx** |
| 145 | + |
| 146 | +Visualizes **live processing behavior** within the system. |
| 147 | + |
| 148 | +This page surfaces: |
| 149 | + |
| 150 | +* Worker pool activity (active, idle, in-flight) |
| 151 | +* Queue depth |
| 152 | +* Completed and failed task counts |
| 153 | +* A rolling stream of processing events |
| 154 | + |
| 155 | +It helps demonstrate concurrency, throughput, and real-time system behavior. |
| 156 | + |
| 157 | +--- |
| 158 | + |
| 159 | +### **SystemHealthPage.tsx** |
| 160 | + |
| 161 | +Displays operational health information from Spring Boot Actuator. |
| 162 | + |
| 163 | +This includes: |
| 164 | + |
| 165 | +* Overall system health |
| 166 | +* Component-level status (database, Redis, etc.) |
| 167 | +* Key runtime metrics |
| 168 | +* Periodic polling with manual refresh support |
| 169 | + |
| 170 | +The page exists to showcase **production readiness and observability**, not just application correctness. |
| 171 | + |
| 172 | +--- |
| 173 | + |
| 174 | +## Informational Pages |
| 175 | + |
| 176 | +### **AboutPage.tsx** |
| 177 | + |
| 178 | +A public-facing overview of the SpringQueuePro project. |
| 179 | + |
| 180 | +This page: |
| 181 | + |
| 182 | +* Is accessible with or without authentication |
| 183 | +* Adjusts navigation based on auth state |
| 184 | +* Explains system goals, architecture, and capabilities |
| 185 | +* Acts as a portfolio and project summary page |
| 186 | + |
| 187 | +It is intentionally non-operational and informational. |
| 188 | + |
| 189 | +--- |
| 190 | + |
| 191 | +## Summary |
| 192 | + |
| 193 | +The frontend is structured to reflect **real production concerns**: |
| 194 | + |
| 195 | +* Authentication and authorization |
| 196 | +* Task submission vs task inspection |
| 197 | +* Processing behavior and concurrency |
| 198 | +* Health, metrics, and observability |
| 199 | + |
| 200 | +Rather than hiding system internals, the UI surfaces them deliberately—making the application both a functional dashboard and a technical demonstration. |
0 commit comments