How eclipse-tractusx/portal-frontend-registration works
Project Type and Purpose
• This is a React + TypeScript single-page application (SPA) responsible for the “registration” sub-flow of the larger Portal system. It provides the UI for capturing company data, handling multi-step forms, file uploads, and integrating with backend APIs (Portal-Backend) and the IAM service for authentication/authorization.
Main Components
a. Presentation Layer (Client Browser / SPA)
• src/components: all React UI components (forms, steppers, drag-and-drop, snackbars, error pages).
• Routing/ProtectedRoute for guarded routes (src/helpers/authorisation/ProtectedRoute.tsx).
b. State Management Layer
• Redux Toolkit slices under src/state/features (application, applicationCompanyRole, applicationDocuments, etc.) – each slice handles a domain.
• Global store in src/state/features/store.ts.
• Utility wrappers in src/state/utils (rtkUtil.ts).
c. Service Layer (API Wrappers & Utilities)
• RequestService.ts: central HTTP client for REST calls.
• UserService.js: IAM interactions (login, token refresh).
• EnvironmentService.ts: runtime configuration (injected via Docker/Nginx).
• I18nService.ts: locale loading (src/locales).
d. Data & Assets
• src/locales: JSON translations for EN/DE.
• src/styles: CSS assets and fonts.
e. External Systems
• Portal-Backend: REST API endpoints for registration flows.
• IAM Service (Portal-IAM): authentication, user info.
f. Build & Deployment
• Vite dev server (vite.config.ts) for local dev.
• Dockerfiles under .conf/ and Nginx config for production container.
• CI/CD workflows (.github/workflows).
Component Relationships & Data Flows
• End user (browser) loads SPA → Nginx (or Vite dev server) serves static assets.
• UI components dispatch Redux actions → RTK Query (applicationApiSlice, etc.) uses RequestService to call Portal-Backend REST endpoints.
• For protected routes, ProtectedRoute checks auth state via UserService against IAM.
• EnvironmentService supplies API base URLs & feature flags injected at build/runtime.
• I18nService fetches locale files; UI chooses text accordingly.
• File upload components post documents via applicationDocumentsApiSlice to backend storage endpoints.
• Global state updates reflect in UI; errors propagate to ErrorPage or Snackbar.
Architectural Patterns & Principles
• SPA with clear separation: Presentation vs State vs Data Access
• Component-based UI (React)
• Redux Toolkit (RTK Query) for declarative data fetching
• ProtectedRoute pattern for auth guards
• Environment injection via Docker/Nginx for 12-factor compliance
• Localization via JSON assets