# lowdefy/lowdefy-example-business-card architecture

> Architecture diagram of the GitHub repository lowdefy/lowdefy-example-business-card, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lowdefy/lowdefy-example-business-card
- Repository: https://github.com/lowdefy/lowdefy-example-business-card

## Overview

##### Project’s Main Components
- Lowdefy Application Core: The main Lowdefy configuration (via the lowdefy.yaml in the “app” folder) orchestrates the pages and overall routing.
- User Interface Pages: Organized under “app/pages”, these include pages for login, sign-up, home, profile (and subcomponents for profile display), dashboard (with components like graph chart and total users), connections, and error handling (e.g., the 404 page).
- Shared Components and Requests: Located in “app/shared”, shared functionalities like the profile form and common API requests are centralized here.
- Plugins: Specifically, the “plugins/plugin-business-cards” directory includes a custom plugin that provides a block for QR code generation, among other business card related logic.
- External Services:
- LinkedIn Authentication: Integrated via Auth.js (using the LinkedIn provider).
- MongoDB: For data storage and retrieval, as configured in the environment variables.

##### Relationships Between Components
- The Lowdefy configuration in “app/lowdefy.yaml” sets up the overall layout and routing for the pages.
- Each page (such as “home”, “profile”, “dashboard”, etc.) is its own Lowdefy page defined by YAML files. They include components (differences handled via subdirectories) and requests that interface with the backend or external services.
- Shared components and requests encapsulate common logic and UI elements, which are referenced across multiple pages.
- The custom plugin (located under “plugins/plugin-business-cards”) integrates into the app to provide QR code generation blocks. This plugin might be injected as a Lowdefy plugin, enhancing the digital business card functionality.
- The authentication flow is backed by Auth.js with LinkedIn; once authenticated, user details are stored and managed via MongoDB.

##### Important Architectural Patterns and Technologies
- Component-Based Design: The clear separation between pages, shared components, and plugins promotes reusability.
- Separation of Concerns: The design distinguishes between application UI (pages/components), data requests, and business logic (plugins).
- Use of Plugins and Extensibility: The custom business card plugin indicates an extensible architecture where additional plugins could be added to extend functionality.

##### Detailed Representation
- Component labels: “Login Page”, “Home Page”, “Profile Page”, “Dashboard Page”, “404 Page” etc.
- Request groups: “Profile Requests”, “Dashboard Requests”, “Connection Requests”, etc.
- Plugin components: “QR Code Block (Business Cards Plugin)”.
- External systems clearly depicted: “LinkedIn Auth (Auth.js)” and “MongoDB”.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Configuration
    core["Lowdefy Application Core"]:::core

    %% Presentation Layer
    subgraph "Presentation Layer"
        login["Login Page"]:::presentation
        signup["Sign-up Page"]:::presentation
        home["Home Page"]:::presentation
        profile["Profile Page"]:::presentation
        dashboard["Dashboard Page"]:::presentation
        connections["Connections Page"]:::presentation
        error404["404 Page"]:::presentation
        sharedUI["Shared UI Components"]:::presentation
        sharedReq["Shared Requests"]:::presentation
    end

    %% Plugin Layer
    subgraph "Plugin Layer"
        plugin["Plugin: Business Cards"]:::plugin
        qrcode["QR Code Block"]:::plugin
    end

    %% External Services
    subgraph "External Services"
        linkedin["LinkedIn Authentication"]:::external
        mongodb["MongoDB"]:::external
    end

    %% Connections from Lowdefy Core to Presentation Layer
    core -->|"routes"| login
    core -->|"routes"| signup
    core -->|"routes"| home
    core -->|"routes"| profile
    core -->|"routes"| dashboard
    core -->|"routes"| connections
    core -->|"routes"| error404
    core -->|"includes"| sharedUI
    core -->|"includes"| sharedReq

    %% Plugin internal connection
    plugin -->|"contains"| qrcode

    %% Plugin integration with UI pages
    plugin ---|"enhances"| profile
    plugin ---|"enhances"| dashboard

    %% External Service interactions
    login ---|"authenticates"| linkedin
    signup ---|"authenticates"| linkedin

    profile ---|"fetch/update-data"| mongodb
    dashboard ---|"fetch/update-data"| mongodb
    connections ---|"fetch-connections"| mongodb
    sharedReq ---|"data-requests"| mongodb

    home ---|"uses"| sharedUI

    %% Click Event Mapping
    click core "https://github.com/lowdefy/lowdefy-example-business-card/blob/main/app/lowdefy.yaml"
    click login "https://github.com/lowdefy/lowdefy-example-business-card/blob/main/app/pages/login/login.yaml"
    click signup "https://github.com/lowdefy/lowdefy-example-business-card/blob/main/app/pages/sign-up/sign-up.yaml"
    click home "https://github.com/lowdefy/lowdefy-example-business-card/blob/main/app/pages/home/home.yaml"
    click profile "https://github.com/lowdefy/lowdefy-example-business-card/blob/main/app/pages/profile/profile.yaml"
    click dashboard "https://github.com/lowdefy/lowdefy-example-business-card/blob/main/app/pages/dashboard/dashboard.yaml"
    click connections "https://github.com/lowdefy/lowdefy-example-business-card/blob/main/app/pages/connections/connections.yaml"
    click error404 "https://github.com/lowdefy/lowdefy-example-business-card/blob/main/app/pages/404/404.yaml"
    click sharedUI "https://github.com/lowdefy/lowdefy-example-business-card/tree/main/app/shared/components"
    click sharedReq "https://github.com/lowdefy/lowdefy-example-business-card/tree/main/app/shared/requests"
    click plugin "https://github.com/lowdefy/lowdefy-example-business-card/tree/main/plugins/plugin-business-cards"
    click qrcode "https://github.com/lowdefy/lowdefy-example-business-card/blob/main/plugins/plugin-business-cards/src/blocks/QRCode/QRCode.js"

    %% Styles
    classDef core fill:#E8DAEF,stroke:#5B2C6F,stroke-width:2px;
    classDef presentation fill:#D6EAF8,stroke:#2874A6,stroke-width:2px;
    classDef plugin fill:#D5F5E3,stroke:#196F3D,stroke-width:2px;
    classDef external fill:#FADBD8,stroke:#922B21,stroke-width:2px;
```
