How eclipse-tractusx/portal-frontend works
Project Type and Purpose
• This is a full-stack portal application’s frontend, implemented as a single-page React/TypeScript app (Vite-powered).
• It serves as the “Portal Frontend” UI that users access via browser and interacts with the portal-backend (REST API) and IAM service for authentication/authorization.
High-Level Architecture Components
a. Client Browser
• Runs the React SPA (bundled by Vite)
• Hosts UI components, page routes, localization, state (Redux Toolkit slices), and UI services (AccessService, RequestService, etc.)
b. Static File Server / CDN (Nginx)
• Serves built assets (index.html, JS/CSS bundles, public/ manifest.json, testdata)
• Configuration in .conf/nginx.conf and Dockerfiles
c. Portal Backend (external service)
• Exposes REST endpoints consumed via features/* apiSlice.ts files
• Provides business data (apps, users, companies, notifications, etc.)
d. IAM Service (external OAuth2/OpenID Connect)
• Handles login, token issuance, user identity management
e. Shared Components Library
• portal-shared-components (imported, overrides MUI, provides theme, global frame)
f. DevOps & CI/CD
• Build pipeline in GitHub Actions (.github/workflows/*.yml)
• Docker image build (.conf/Dockerfile.full, Dockerfile.prebuilt)
• Helm chart in portal repo for Kubernetes deployment
Interactions and Data Flows
• User → Browser: enters URL → index.html
• Browser → Nginx (or static host): fetches JS/CSS bundles
• On user action (page load, overlay, form submit), React “features” modules dispatch RTK queries to portal-backend endpoints
• Backend returns JSON → RequestService normalizes → Redux store updates → UI components subscribe via hooks (useApiGet, useTranslation)
• Auth flows: on first load or protected route, the SPA redirects to IAM, obtains JWT token, stores it in LocalStorage or cookie, then includes bearer token in API requests
• Shared-components library provides layout (Header, Footer, MobileMenu), global theming, and basic building blocks (Buttons, Inputs)
Architectural Patterns and Design Principles
• Single-Page Application (SPA) with client-side routing (react-router)
• Feature-driven file structure: each domain area (apps, admin, serviceMarketplace, etc.) lives in src/features, with RTK apiSlice + slice + types
• Component hierarchy: top-level layout (Main.tsx → AuthorizingRouter) → pages → overlays → shared/basic/shared/frame templates
• State management: Redux Toolkit (RTK Query for API calls, createSlice for local state)
• Testing: Jest config, Cypress end-to-end tests
Diagramming Recommendations
• Browser (SPA)
• API Layer
• Backend Services
• Authentication Service
• Static File Server
• CI/CD Pipeline
• Browser → Nginx (GET assets)
• SPA → IAM (OAuth redirect + token)
• SPA → Portal-Backend (REST calls)
• CI/CD → Docker Registry → Kubernetes
• Blue for client/UI
• Green for data/state
• Orange for external services
• Grey for infrastructure/CI
Essential Elements
• Labels: HTTPs endpoints, JWT token flow, Redux store, SCSS theming