# aliemresenel/floridacorporationsearch-fullstack architecture

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

- Interactive diagram: https://gitdiagram.com/aliemresenel/floridacorporationsearch-fullstack
- Repository: https://github.com/aliemresenel/floridacorporationsearch-fullstack

## Overview

##### Project Overview
- Purpose: The application allows users to search for Florida corporations by name and view their details.
- Structure: It is a full-stack application with two main parts—a Python-based backend and a React-based frontend. The project also uses Docker Compose to orchestrate its containers, including a PostgreSQL database.

##### Analyzing the File Structure
- Top-Level: The project contains a README.md and a docker-compose.yml which indicates containerized deployment.
- python-backend: Contains key files (main.py, db.py, parser.py) indicating functionality to parse data and interact with the database. It also has a Dockerfile and a separate README if needed. This is your business logic/API layer.
- react-frontend: Contains a full React application (using Next.js as suggested by next.config.ts), a clear separation into components (e.g., search_form, results_display) and API endpoints (e.g., app/api/search.ts). It also comes with tailor-made configuration files for ESLint, PostCSS, Tailwind CSS, etc.
- Docker Compose: Orchestrates the services (backend, frontend, PostgreSQL db) through pre-defined ports (port 8000 for backend, 3000 for frontend, 5432 for Postgres).

##### Key Components
A. Frontend:
- React/Next.js Application – static assets, pages, components.
- Client-Side Components: Search form, results display.
- The API/Communication layer (e.g., app/api/search.ts) that interacts with the backend.
B. Backend:
- Python Backend: Main API server (main.py) which handles search requests.
- DB Interaction and Parsing: db.py and parser.py indicate data retrieval/manipulation and parsing responses.
- API endpoints that serve JSON responses.
C. Database:
- PostgreSQL: Managed either via Docker Compose or manually as per instructions. Acts as the data store for corporation information.
D. Containerization/Deployment:
- Dockerfiles for both backend and frontend indicate containerization.
- Docker Compose acts as an orchestrator controlling the environment and service links.

- Frontend → Backend: When a search is initiated from the React app, the request is sent to the Python backend.
- Backend → Database: The backend queries PostgreSQL (through db.py) and uses parser.py to format or parse data.
- Database → Backend: The processed results returned to the backend.
- Backend → Frontend: The backend then returns the search results to the frontend.
- That the Docker Compose setup handles all service interconnections including environment variables for database connectivity.

##### Architectural Patterns and Technologies
- Full-Stack Separation: Clear separation between frontend (React/Next.js) and backend (Python with Uvicorn/ASGI).
- RESTful API Design: The Python backend likely exposes endpoints for the React frontend.
- Microservice-like containerization: Each service (backend, frontend, database) is containerized and managed together.
- Specific technologies:
- React/Next.js, Typescript, Tailwind CSS for the UI.
- Python, Uvicorn for backend services.
- PostgreSQL as the database.
- Docker & Docker Compose for container orchestration.

## Diagram (Mermaid)

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

    subgraph "Containerized Environment"
        DCO["Docker Compose Orchestrator"]:::docker

        subgraph "Frontend Layer"
            FE["React Frontend (Next.js)"]:::frontend
            SF["Search Form Component"]:::frontend
            RD["Results Display Component"]:::frontend
            FAPI["Frontend API Communication Layer"]:::frontend
        end

        subgraph "Backend Layer"
            BE["Python Backend API Server"]:::backend
            DBI["Database Interaction Module"]:::backend
            DPF["Data Parsing/Formatting Module"]:::backend
        end

        DB["PostgreSQL Database"]:::db

        FB_DOCKER["Python Backend Docker Definition"]:::docker
        FE_DOCKER["React Frontend Docker Definition"]:::docker
    end

    %% Interactions
    User -->|"initiates_search"| SF
    SF -->|"sends_request"| FAPI
    FAPI -->|"calls_API"| BE
    BE -->|"queries_DB"| DBI
    DBI -->|"parses_response"| DPF
    DPF -->|"returns_data"| BE
    BE -->|"responds"| FAPI
    FAPI -->|"updates_UI"| RD

    %% Orchestration arrows
    DCO -->|"orchestrates"| FE
    DCO -->|"orchestrates"| BE
    DCO -->|"orchestrates"| DB

    %% Container definitions
    FE_DOCKER -->|"defines_container"| FE
    FB_DOCKER -->|"defines_container"| BE

    %% Click Events
    click FE "https://github.com/aliemresenel/floridacorporationsearch-fullstack/tree/master/react-frontend/app"
    click SF "https://github.com/aliemresenel/floridacorporationsearch-fullstack/blob/master/react-frontend/app/components/search_form.tsx"
    click RD "https://github.com/aliemresenel/floridacorporationsearch-fullstack/blob/master/react-frontend/app/components/results_display.tsx"
    click FAPI "https://github.com/aliemresenel/floridacorporationsearch-fullstack/blob/master/react-frontend/app/api/search.ts"
    click BE "https://github.com/aliemresenel/floridacorporationsearch-fullstack/blob/master/python-backend/main.py"
    click DBI "https://github.com/aliemresenel/floridacorporationsearch-fullstack/blob/master/python-backend/db.py"
    click DPF "https://github.com/aliemresenel/floridacorporationsearch-fullstack/blob/master/python-backend/parser.py"
    click DCO "https://github.com/aliemresenel/floridacorporationsearch-fullstack/blob/master/docker-compose.yml"
    click FB_DOCKER "https://github.com/aliemresenel/floridacorporationsearch-fullstack/tree/master/python-backend/Dockerfile"
    click FE_DOCKER "https://github.com/aliemresenel/floridacorporationsearch-fullstack/tree/master/react-frontend/Dockerfile"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#0000FF,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#008000,stroke-width:2px;
    classDef db fill:#FFA07A,stroke:#FF4500,stroke-width:2px;
    classDef docker fill:#D3D3D3,stroke:#A9A9A9,stroke-width:2px;
    classDef user fill:#F5DEB3,stroke:#DAA520,stroke-width:2px;
```
