How r-cz/iam-tools works
Main Components
a. Frontend Application:
• Built with React (using Vite as the build tool) that composes pages and components from the “src” folder.
• Feature modules (such as “tokenInspector” and “oidcExplorer” within src/features) for specific IAM tools.
• Shared UI components (in src/components/ui), layouts (src/components/layout), navigation (src/components/navigation), and theming (src/components/theme).
• Custom hooks and utilities (src/hooks, src/lib, src/types) which encapsulate reusable logic.
b. Backend/Server Components:
• The functions directory contains API endpoints, including the CORS proxy and JWKS resolution endpoints. These endpoints provide services—such as allowing the frontend to work with external APIs that do not support CORS.
• Middleware and routing definitions (in functions/_middleware.ts and functions/_routes.json) to map API paths.
c. External Services:
• External identity providers providing .well-known endpoints and JWKS URIs.
d. Development/Testing Infrastructure:
• GitHub workflows (in .github) for CI processes (Bun tests, CodeQL).
• Test files (in src/tests) wrapping the component, feature, hooks, and utility tests.
• Deployment processes via Cloudflare Pages as outlined in the README.
Relationships and Data Flow
• The frontend (React application) interacts with the backend endpoints (under functions API) especially for the CORS proxy and token validation processes.
• Within the frontend, different feature modules communicate with shared libraries (src/lib, src/hooks) and UI components.
• The build, test, and deployment layers should be represented as supporting elements rather than core runtime components.
Architectural Patterns and Design Principles
• Feature-based organization: The project clearly separates functionality into features (e.g., tokenInspector, oidcExplorer) and shared components (e.g., common UI elements).
• Separation of concerns: The clear division between API functions (backend logic) and UI components (frontend) reinforces a modular approach.
• CORS Proxy Pattern: Illustrate how requests are proxied from the frontend to external APIs to mitigate CORS issues.
• Use of modern development practices: Fast iterative testing using Bun’s test runner, dependency management via Bun, and CI with GitHub Actions.
Relevant Technologies, Frameworks, and Libraries
• Frontend: React, Vite, TypeScript, Tailwind CSS, shadcn/ui, React Router.
• Backend: Node/TypeScript functions for the CORS proxy and token-related endpoints.
• Testing: Bun Test, React Testing Library.
• Deployment: Cloudflare Pages.
• DevOps: GitHub Actions for CI/CD and CodeQL for security auditing.
• Frontend (React/Vite):
• Components: Organized into modules such as “Layout”, “Navigation”, “UI”, “Theme”, “Page Components”.
• Features: Modules like “Token Inspector” and “OIDC Explorer” illustrate specific IAM tools.
• Shared utilities and custom hooks for app logic.
• Backend/API (Functions):
• API Endpoints: Represent the CORS proxy endpoint and JWKS resolution endpoint.
• Middleware: Explicitly indicate the use of _middleware for request handling.
• External Services:
• Deployment/DevOps Elements:
• GitHub Actions: Workflows for testing and code analysis.
• Cloudflare Pages: Deployment destination and workflow triggers on push to the main branch.