How openedx/frontend-app-authn works
Project Type and Purpose
• This is a React-based micro-frontend (MFE) whose sole responsibility is user authentication flows: login, registration, forgot/reset password, and progressive profiling.
• It is embedded into a host container (e.g., Tutor or Open edX LMS) via a micro-frontend loader.
File Structure
• Public & Bootstrapping
• public/index.html → React mount point
• src/index.jsx + MainApp.jsx → root component and router setup
• Container & Layout
• src/base-container → layout wrapper, image/text/video layouts
• Feature Modules
• src/login, src/register, src/forgot-password, src/reset-password, src/progressive-profiling → each has UI components, messages, and a data layer (actions/reducers/sagas/service)
• Shared Components
• src/common-components → reusable UI (FormGroup, PasswordField, SSO, Zendesk, routes, etc.)
• src/field-renderer → dynamic field rendering for configurable fields
• State Management
• src/data/configureStore.js → Redux store
• src/data/reducers.js + src/data/sagas.js → root reducer and saga composition
• Utilities & Integrations
• src/data/utils, algolia.js, optimizely.js, oneTrust.js → feature flags, analytics, cookie management
• Build & Config
• webpack.prod.config.js, .env*, package.json, catalog-info.yaml → build, environment variable injection, CI/CD
Relationships & Data Flows
• User → UI Components: user triggers an action (e.g., click “Login”)
• UI → Redux Action
• Redux Saga → Service Layer: invoke REST API
• Service Layer → External API: e.g., POST /login
• API Response → Saga → Reducer → UI Update
• Config Flow: on startup Saga fetches MFE_CONFIG_API_URL → populates feature flags & dynamic fields
Architectural Patterns & Technologies
• Micro-frontend (isolated deployable UI unit)
• Feature-based code organization (each route has its own slice)
• Container/Presentational layout in base-container
• Redux + Redux-Saga for state and side-effect management
• Webpack (potentially Module Federation for MFE)
• Jest for unit & snapshot tests
• SCSS for styling layouts