How openwisp/openwisp-wifi-login-pages works
Project type and purpose
• This is a full-stack web application (“openwisp-wifi-login-pages”) that replaces captive-portal login pages with a unified React-based SPA front end and a Node.js/Express back end.
• It integrates with an external OpenWISP Radius API to authenticate and authorize WiFi users, and it supports organization-specific theming via template files under the “organizations” directory.
File structure
• Top-level directories:
• client/ – React SPA (actions, reducers, components, styles, tests)
• server/ – Express app (controllers, routes, utils, start script, tests)
• config/ – build & test configuration (webpack, Jest)
• internals/ – generators for scaffolding new organizations
• organizations/ – per-organization static JS/CSS and YAML config
• i18n/ – translation catalogs
• browser-test/ – Python and JS end-to-end test scripts
• docs/ – user and developer guides
• Architectural patterns:
• Front-end uses Flux/Redux (actions → dispatchers → reducers → store → React components)
• Back-end follows MVC-style organization (routes → controller → utils/external API)
• Build pipeline driven by Webpack, Babel, configuration scripts
README for additional insights
• Confirms the SPA + API split, integration with the OpenWISP Radius API, multi-language support, theming per organization, and CI/testing workflow.
Components
1. User Device (Browser)
2. Static Asset Delivery (e.g., CDN / Express static middleware serving public/ + organizations/*/client_assets)
3. Front-end SPA (React + Redux)
4. Back-end API (Node.js + Express controllers & routes)
5. External OpenWISP Radius API
6. Build & Config Subsystem (Webpack, Babel, config scripts, internals/generators)
7. Translation subsystem (i18n catalogs loaded at build/runtime)
8. Test Harness (Jest unit tests + Python-based browser-test suite)
• User Device → Static Asset Delivery → SPA
• SPA → Back-end API (REST calls for login, registration, password reset, mobile verification, payments)
• Back-end API → External Radius API (authenticate, obtain tokens, user-session management)
• Build & Config Subsystem → generates static assets (invoked pre-deploy)
• i18n subsystem → feeds translations into SPA at build/runtime
• Test Harness ↔ SPA and API (unit tests against client/, server/tests/, browser-test scripts)
c. Architectural patterns & principles:
• Separation of concerns: distinct front-end SPA layer vs. back-end API layer
• Flux/Redux data flow on the client
• MVC-style controllers & routes on the server
• Plugin-style theming: “organizations” folder supplies client_assets & server_assets per org
• Build-time code generation: “internals/generators” scaffolds new org templates
d. Key technologies & frameworks:
• React, Redux, React Router
• Node.js, Express
• Webpack, Babel
• Jest (unit tests), Python (browser-test E2E)
• i18next or custom i18n loader (PO files in i18n/)
• Docker/Nginx (optional in deployment, though not in this repo)
Detail
• Per-organization theming, translation loading, CI/test flow