Skip to content

Commit 857cd50

Browse files
committed
Finishing SQP frontend polish and adding a frontend summary doc in /additional-docs (everything is done barring About Page polish which is mildly outdated -- will be done shortly with some polishing of my main README file).
1 parent 42d82a4 commit 857cd50

11 files changed

Lines changed: 228 additions & 12 deletions

additional-docs/sql-authn-deep-dive.md renamed to additional-docs/architecture-deep-dives/sql-authn-deep-dive.md

File renamed without changes.

additional-docs/sql-authz-deep-dive.md renamed to additional-docs/architecture-deep-dives/sql-authz-deep-dive.md

File renamed without changes.

additional-docs/sql-observability-metrics-deep-dive.md renamed to additional-docs/architecture-deep-dives/sql-observability-metrics-deep-dive.md

File renamed without changes.

additional-docs/sql-process-retry-failure-deep-dive.md renamed to additional-docs/architecture-deep-dives/sql-process-retry-failure-deep-dive.md

File renamed without changes.

additional-docs/sql-redis-deep-dive.md renamed to additional-docs/architecture-deep-dives/sql-redis-deep-dive.md

File renamed without changes.

additional-docs/sql-rest-graphql-api-deep-dive.md renamed to additional-docs/architecture-deep-dives/sql-rest-graphql-api-deep-dive.md

File renamed without changes.

additional-docs/sql-task-orchestration-deep-dive.md renamed to additional-docs/architecture-deep-dives/sql-task-orchestration-deep-dive.md

File renamed without changes.

additional-docs/sql-task-persistence-deep-dive.md renamed to additional-docs/architecture-deep-dives/sql-task-persistence-deep-dive.md

File renamed without changes.
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
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.

springqpro-frontend/src/pages/ProcessingMonitorPage.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
/* ProcessingMonitorPage.tsx:
22
-----------------------------
3-
This is a live operational runtime monitor.
3+
This is the live operational runtime monitor. Checks to see if:
4+
- The workers in the executor are alive.
5+
- Is the queue backing up?
6+
- Are tasks completing or failing?
7+
BASICALLY, what's happening *right now* during the current system execution.
8+
***
9+
This and SystemHealthPage are read-only observability pages; this one for runtime specifics (custom metrics)
10+
whereas the latter is more for Actuator system health (e.g., JVM and things of that sort).
11+
***
12+
Frankly, neither of them are particularly complex but they do illustrate a degree of instrumentation within
13+
my system when it comes to Prometheus-compatible metrics.
414
*/
515
import { useEffect, useState } from "react";
616
import NavBar from "../components/NavBar";
@@ -9,19 +19,22 @@ import {
919
getMetric,
1020
getProcessingEvents,
1121
getWorkerStatus
12-
} from "../api/api";
22+
} from "../api/api"; // *My* system-specific metrics.
1323

1424
export default function ProcessingMonitorPage() {
1525
const { accessToken } = useAuth();
1626

27+
// Worker Status:
1728
const [workers, setWorkers] = useState<{ active: number; idle: number; inFlight: number } | null>(null);
29+
// Custom Metrics (Queue Stats):
1830
const [queueDepth, setQueueDepth] = useState<number | null>(null);
1931
const [completed, setCompleted] = useState<number | null>(null);
2032
const [failed, setFailed] = useState<number | null>(null);
21-
33+
// These are bascially records of my internal log statements (can see when Redis distributed lock is applied and lifted):
2234
const [events, setEvents] = useState<string[]>([]);
2335
const [loadingEvents, setLoadingEvents] = useState(true);
2436

37+
// In-line style constants (maybe not the best practice admittedly <-- NOTE:+TO-DO: Come back and do something about this?)
2538
const containerStyle: React.CSSProperties = {
2639
minHeight: "100vh",
2740
backgroundColor: "#f6f8fa",
@@ -45,7 +58,7 @@ export default function ProcessingMonitorPage() {
4558
color: "#2d2d2d"
4659
};
4760

48-
// ---- Fetch Worker + Metrics ----
61+
// Core function for fetching worker info and metrics + UseEffect hook that will load and poll it on accessToken load:
4962
const refreshAll = async () => {
5063
if (!accessToken) return;
5164

0 commit comments

Comments
 (0)