# crafter-y/seas-frontend architecture

> Architecture diagram of the GitHub repository crafter-y/seas-frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/crafter-y/seas-frontend
- Repository: https://github.com/crafter-y/seas-frontend

## Overview

Based on our analysis of the file tree and README, this project is clearly the official source code for the SEAS (Kirchengemeinden) frontend, which powers the website as well as the Android and iOS mobile apps. It is a full-stack front-end client built in React/React Native (using Expo) with a heavy emphasis on modular UI components, hooks for API integration (with a separate, commercial backend/API), and additional tooling like Storybook for UI development.

##### And Define the Main Components
- Frontend Client:
- Both mobile and web aspects. Note the existence of an "app" directory that contains various pages (such as _layout, login, settings, board, etc.) which suggest a highly routed/SPA style architecture.
- The file "app.config.js" and Expo commands (npx expo export) indicate that the project is built upon Expo, so this is key technology.
- UI Layer / Components:
- The “components” directory shows a variety of reusable UI elements, including modular components for boards, forms, settings dialogs, and more.
- Storybook is configured (in the “.storybook” directory) to develop and test UI components independently.
- Business Logic and State Management:
- “hooks” offer custom hooks for API calls and state management. Life-cycle integration and interaction with the backend are handled here (e.g., useAuthentication, useCreateUser, useBoard, etc.).
- “helpers” (such as store.ts, format.ts, api.ts) provide utility functions and a shared application configuration.
- Assets and Localization:
- The “assets” (images, fonts) and “locales” directories ensure that visual and language/localization resources are incorporated.
- Configuration and Build Infrastructure:
- Configuration scripts like babel.config.js, tailwind.config.js, and various ESLint, Prettier files.
- Docker files (Dockerfile, Dockerfile.dev, Dockerfile.storybook) and related scripts support containerization and deployment for various scenarios (production, development, Storybook preview).
- The “public” directory includes web-specific configuration (manifest, robots.txt) which helps when deploying the web version.
- Deployment and Hosting Tools:
- The README guidance (serve.js, npm scripts) and hosting directions (including Docker commands) indicate how the built app is served.

##### Relationships and Interactions
- Frontend Application Core:
- UI Component Library:
- Hook and API Layer:
- Assets & Localization:
- Build & Deployment Infrastructure:

##### Architectural Patterns and Key Technologies
- Separation of Concerns:
- How the project cleanly separates the presentation layer (pages/components), business logic/hooks, and infrastructural configuration. This modular approach improves maintainability and scalability.
- Modular & Component-driven Design:
- The extensive “components” and “hooks” structures point to a highly modular system—each component (UI element, modal, layout) is isolated and can be independently tested (as evidenced by Storybook stories).
- Integration with External Services:
- That the hooks bridge to a backend API not included in the repository, indicating a client–server separation.
- Use of Expo/React Native for Cross-Platform Deployment:
- Clearly denote that Expo is used to export the mobile app, while the web version is statically built (with configuration in public/config.json and deployment using serve.js).

##### Specific Elements
- Clear labels for each module (e.g., “Routing & Pages (app/)”, “Re-usable UI Elements (components/)”, “API Client / Hooks (hooks/)”, “Configuration & Assets (assets/, locales, public/)”).
- Also from configuration files to runtime processes (like Expo bundler, Docker container build).
- Integration Points:
- External dependencies such as the backend API and third-party libraries (Expo, Tailwind, Storybook, etc.).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Frontend Client
    subgraph "Frontend Client"
        ClientApp["Client Application (app/ & app.config.js)"]:::frontend
    end

    %% UI Layer & Components
    subgraph "UI Layer & Components"
        UIComponents["Re-usable UI Elements (components/)"]:::ui
        Storybook["UI Development (Storybook - .storybook/)"]:::ui
    end

    %% Business Logic & State Management
    subgraph "Business Logic & State Management"
        Hooks["API & State Management (hooks/)"]:::hooks
        Helpers["Utilities (helpers/)"]:::hooks
    end

    %% Assets & Localization
    subgraph "Assets & Localization"
        Assets["Assets (assets/)"]:::assets
        Locales["Localization (locales/)"]:::assets
    end

    %% Build & Deployment Infrastructure
    subgraph "Build & Deployment Infrastructure"
        ConfigFiles["Configuration Files (babel.config.js, tailwind.config.js, .eslintrc.js, serve.js)"]:::config
        DockerPublic["Docker & Web Assets (Dockerfile*, public/)"]:::config
    end

    %% External Dependency
    SEASBackend["SEAS Backend/API"]:::external

    %% Connections
    ClientApp -->|"renders"| UIComponents
    ClientApp -->|"configured_by"| ConfigFiles
    ClientApp -->|"deployed_via"| DockerPublic

    UIComponents -->|"developed_with"| Storybook
    UIComponents -->|"utilizes"| Assets
    UIComponents -->|"utilizes"| Locales
    UIComponents -->|"calls"| Hooks

    Hooks -->|"uses"| Helpers
    Hooks -->|"fetches_from"| SEASBackend

    %% Click Events
    click ClientApp "https://github.com/crafter-y/seas-frontend/tree/master/app/"
    click ClientApp "https://github.com/crafter-y/seas-frontend/blob/master/app.config.js"
    click UIComponents "https://github.com/crafter-y/seas-frontend/tree/master/components/"
    click Storybook "https://github.com/crafter-y/seas-frontend/tree/master/.storybook/"
    click Hooks "https://github.com/crafter-y/seas-frontend/tree/master/hooks/"
    click Helpers "https://github.com/crafter-y/seas-frontend/tree/master/helpers/"
    click Assets "https://github.com/crafter-y/seas-frontend/tree/master/assets/"
    click Locales "https://github.com/crafter-y/seas-frontend/tree/master/locales/"
    click ConfigFiles "https://github.com/crafter-y/seas-frontend/blob/master/babel.config.js"
    click ConfigFiles "https://github.com/crafter-y/seas-frontend/blob/master/tailwind.config.js"
    click ConfigFiles "https://github.com/crafter-y/seas-frontend/blob/master/.eslintrc.js"
    click ConfigFiles "https://github.com/crafter-y/seas-frontend/blob/master/serve.js"
    click DockerPublic "https://github.com/crafter-y/seas-frontend/tree/master/Dockerfile"
    click DockerPublic "https://github.com/crafter-y/seas-frontend/tree/master/public/"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef ui fill:#87CEFA,stroke:#000,stroke-width:1px;
    classDef hooks fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef assets fill:#FFB6C1,stroke:#000,stroke-width:1px;
    classDef config fill:#FFA07A,stroke:#000,stroke-width:1px;
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:1px,stroke-dasharray:5,5;
```
