# charitydex/access360 architecture

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

- Interactive diagram: https://gitdiagram.com/charitydex/access360
- Repository: https://github.com/charitydex/access360

## Overview

##### Project Overview and Main Components
- Project Type: A full-stack web application focused on analyzing Google Maps 360° imagery to deliver real-time accessibility insights. The project combines a modern React/Next.js frontend with a Python backend (using FastAPI/Uvicorn).
- Key Components:
- Frontend: Built with React and Next.js, it includes UI pages, dynamic routing (via Next.js app directory structure), and a rich set of reusable UI components (e.g., carousels, image displays, loading screens).
- Backend: A Python server (initially Flask then updated to FastAPI) handling API endpoints, image processing, and integration with external services.
- AI & Image Processing Module: Uses a YOLO model coupled with Ultralytics/OpenCV for detecting accessibility features and incorporates OpenAI (via Langchain) for generating detailed recommendations.
- Data & External API Integration: Interfaces with Google Maps Street View API to retrieve images, as well as voice input integration and potentially a Prisma-managed database for persisting data.
- Deployment & Infrastructure: Frontend hosted on Vercel; backend deployed on Amazon EC2; integration with CI/CD and Git/GitHub for version control.

##### Analyzing the File Structure
- Frontend:
- Look inside the ‘frontend’ directory: you see a standard Next.js setup with an “app” folder containing diverse API endpoints (e.g., extract-info, image-proxy, images, places-autocomplete, transcribe). This suggests that even some server-side logic is handled on the frontend.
- Extensive UI components under both the “app/components” and separate “components” directories indicate well-structured, reusable UI elements.
- Configuration files like next.config.mjs, tailwind.config.ts, and package.json imply styling and build system aspects.
- Backend:
- The single Python file at “backend/app.py” indicates the entry point for the backend server, which probably evolves from Flask to FastAPI as mentioned in the README.
- External & Deployment:
- The README points to external technologies like Google Maps API, OpenAI API, and cloud services (Amazon EC2, Vercel) that must be included.

a. Main Components and Their Representation:
- An “External APIs” block featuring Google Maps Street View API and any voice input services.
- A “Database” block (with Prisma mentioned in the README) if data persistence is part of the system.

b. Relationships and Interactions:
- Backend to the External APIs block (e.g., Google Maps API for image retrieval, and OpenAI API for report generation).

c. Architectural Patterns and Design Principles:
- Separation of concerns: the clear split between frontend (user interface and client-side logic) and backend (server-side processing and integration).
- Usage of API layer principles – how server-side endpoints (even within Next.js) handle specific tasks.
- Microservice-inspired boundaries: although not fully microservices, the separation of AI/image processing logic as its own unit is worth highlighting.

d. Technologies, Frameworks, and Key Libraries:
- For the Frontend: React, Next.js, Tailwind CSS, and associated UI component libraries.
- For the Backend: Python, FastAPI/Uvicorn, and supporting dependencies.
- For AI/Image Processing: YOLO (Ultralytics), OpenCV, OpenAI API, and Langchain.
- For External Services: Google Maps Street View API, voice input integration, and others mentioned.
- Deployment: Amazon EC2 and Vercel, along with configuration management (e.g., .env files, Git/GitHub).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Nodes
    User["User"]:::user

    subgraph "Frontend Layer"
        FE_UI["Next.js Frontend UI"]:::frontend
        FE_API["API Endpoints"]:::frontend
        FE_COMP_APP["Reusable UI Components (app)"]:::frontend
        FE_COMP_DIR["Reusable UI Components (shared)"]:::frontend
    end

    subgraph "Backend Layer"
        BE["Python FastAPI Server"]:::backend
    end

    subgraph "AI/Image Processing"
        AIP["YOLO/Image Processing Module"]:::aiproc
    end

    subgraph "External Services"
        GMAP["Google Maps API"]:::external
        OPENAI["OpenAI API"]:::external
        VOICE["Voice Input API"]:::external
    end

    subgraph "Database"
        DB["Prisma Database"]:::database
    end

    subgraph "Deployment"
        VERCEL["Vercel (Frontend)"]:::deployment
        EC2["Amazon EC2 (Backend)"]:::deployment
    end

    subgraph "Source Code"
        GIT["Git/GitHub"]:::external
    end

    %% Connections
    User --> FE_UI
    FE_UI -->|"fetchesData"| FE_API
    FE_UI -->|"rendersUI"| FE_COMP_APP
    FE_UI -->|"rendersUI"| FE_COMP_DIR
    FE_API -->|"apiCall"| BE
    BE -->|"processImage"| AIP
    BE -->|"requestImage"| GMAP
    BE -->|"generateRecs"| OPENAI
    BE -->|"voiceTranscribe"| VOICE
    BE <-->|"crudOperations"| DB
    GIT -->|"deploysTo"| VERCEL
    GIT -->|"deploysTo"| EC2
    FE_UI -->|"hostedOn"| VERCEL
    BE -->|"hostedOn"| EC2

    %% Click Events
    click FE_UI "https://github.com/charitydex/access360/tree/main/frontend/app"
    click FE_API "https://github.com/charitydex/access360/tree/main/frontend/app/api"
    click FE_COMP_APP "https://github.com/charitydex/access360/tree/main/frontend/app/components"
    click FE_COMP_DIR "https://github.com/charitydex/access360/tree/main/frontend/components"
    click BE "https://github.com/charitydex/access360/blob/main/backend/app.py"

    %% Styles
    classDef frontend fill:#bbdefb,stroke:#0d47a1,stroke-width:2px;
    classDef backend fill:#ffe082,stroke:#ff6f00,stroke-width:2px;
    classDef aiproc fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px;
    classDef external fill:#fff9c4,stroke:#f9a825,stroke-width:2px;
    classDef deployment fill:#ffcdd2,stroke:#c62828,stroke-width:2px;
    classDef database fill:#dcedc8,stroke:#558b2f,stroke-width:2px;
    classDef user fill:#fff59d,stroke:#f57f17,stroke-width:2px;
```
