How esakkiappan-nambi/k6-performance-portal works
Purpose and Shape
This is a full-stack load/API testing system. A Python backend accepts test definitions, captures API/authentication activity, generates and runs k6 JavaScript scripts, and persists run artifacts. A React/Vite frontend provides test creation, execution, capture, history, and report views.
Paths: Backend/main.py, Backend/k6_runner.py, Frontend/k6-UI/src/App.jsx
Entry Points and UI Boundary
Backend HTTP API startup and route composition are centered on Backend/main.py; automatic-capture routes are separated under Backend/router/auto_capture.py. The browser application enters through Vite’s React bootstrap and mounts route/page components from the application shell.
Paths: Backend/main.py, Frontend/k6-UI/src/main.jsx, Frontend/k6-UI/src/App.jsx
Identity and Access Control
Authentication is a backend concern, with credential/auth logic separated from API capture’s authentication handling. The frontend has Login/Register pages and a route guard, establishing a client/server auth boundary before protected testing and report operations.
Paths: Backend/auth.py, Backend/api_capture/auth_capture.py, Frontend/k6-UI/src/pages/ProtectedRoute.jsx
Test Definition and Script Generation
User-authored or captured requests are converted into executable k6 JavaScript and materialized as generated-script files. This is the primary boundary between application-level test configuration and the external k6 runtime. The Create Test and Run Test UI pages likely submit definitions and initiate executions through the frontend API service.
Paths: Backend/generated_scripts/Login Test.js, Backend/k6_runner.py, Frontend/k6-UI/src/pages/CreateTest.jsx, Frontend/k6-UI/src/services/api.jsx
Capture and Correlation Pipeline
API capture is decomposed into request capture, authentication capture, and correlation logic, suggesting a pipeline that records browser/API interactions, detects auth material, and associates requests into a reusable test flow. Auto-capture is exposed independently at the router level and represented by a dedicated UI page.
Paths: Backend/api_capture/capture.py, Backend/api_capture/correlate.py, Backend/router/auto_capture.py, Frontend/k6-UI/src/pages/AutoCapture.jsx
Execution, Results, and Reporting
k6_runner.py is the execution adapter for the k6 CLI/runtime. Run outputs are retained as numbered JSON summaries and PDF/HTML reports in local backend storage; report/history/dashboard pages consume this lifecycle for display and navigation. Report files indicate filesystem-backed artifacts rather than an external object store.
Paths: Backend/k6_runner.py, Backend/reports/620_summary.json, Backend/reports/620_report.pdf, Frontend/k6-UI/src/pages/Report.jsx, Frontend/k6-UI/src/pages/History.jsx
Persistence and Input Data
Database access, models, and request/response schemas form the backend persistence and API-contract layer. CSV/XLSX upload handling supports data-driven tests; uploaded source files are stored locally and may feed generated k6 scenarios. Environment values are supplied through a backend .env file.
Paths: Backend/database.py, Backend/models.py, Backend/schemas.py, Backend/csv_handler.py, Backend/uploaded_csv/
Main entry points: main.py HTTP API · k6_runner.py k6 runner · ProtectedRoute.jsx Route guard · api.jsx API client
Components 21
Backend API
- HTTP API · Composes backend routes and protected testing APIs.
Backend/main.py - Authentication
Backend/auth.py - Models & schemas
Backend/models.py - Database access
Backend/database.py - Data uploads · Supports data-driven test inputs.
Backend/csv_handler.py - Uploaded datasets
Capture pipeline
- Auto-capture routes
Backend/router/auto_capture.py - Request capture
Backend/api_capture/capture.py - Auth capture · Extracts authentication material from captured activity.
Backend/api_capture/auth_capture.py - Flow correlation · Associates captured requests into reusable flows.
Backend/api_capture/correlate.py
Test execution
- k6 runner · Generates scripts and invokes the k6 runtime.
Backend/k6_runner.py - Generated k6 scripts
Backend/generated_scripts/Login Test.js - k6 runtime
- Run artifacts · Stores JSON summaries and PDF/HTML reports.
Backend/reports/620_summary.json
React frontend
- Vite bootstrap
Frontend/k6-UI/src/main.jsx - Application shell
Frontend/k6-UI/src/App.jsx - Route guard · Protects testing and report views.
Frontend/k6-UI/src/pages/ProtectedRoute.jsx - Test creation & run
Frontend/k6-UI/src/pages/CreateTest.jsx - Auto-capture page
Frontend/k6-UI/src/pages/AutoCapture.jsx - History & reports
Frontend/k6-UI/src/pages/Report.jsx - API client
Frontend/k6-UI/src/services/api.jsx
Connections 27
- Vite bootstrap → Application shell: mounts
- Application shell → Route guard: routes through
- Route guard → Test creation & run: allows
- Route guard → Auto-capture page: allows
- Route guard → History & reports: allows
- Test creation & run → API client: submits tests
- Auto-capture page → API client: controls capture
- History & reports → API client: loads artifacts
- API client → HTTP API: HTTP requests
- HTTP API → Authentication: authenticates
- HTTP API → Models & schemas: uses
- Models & schemas → Database access: persists via
- HTTP API → Data uploads: accepts datasets
- Data uploads → Uploaded datasets: stores
- HTTP API → Auto-capture routes: composes
- Auto-capture routes → Request capture: captures requests
- Auto-capture routes → Auth capture: captures auth
- Request capture → Flow correlation: supplies events
- Auth capture → Flow correlation: supplies auth context
- Flow correlation → k6 runner: creates test flow
- HTTP API → k6 runner: starts runs
- Data uploads → k6 runner: provides test data
- k6 runner → Generated k6 scripts: materializes
- k6 runner → k6 runtime: invokes
- k6 runtime → Run artifacts: produces results
- k6 runner → Run artifacts: retains artifacts
- HTTP API → Run artifacts: serves results