# treehacks/root architecture

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

- Interactive diagram: https://gitdiagram.com/treehacks/root
- Repository: https://github.com/treehacks/root

## Overview

##### Main System Components

a) Frontend Layer (React Application)
- Main modules:
- Dashboard
- Admin
- Forms
- Judge
- Sponsors
- Transportation
- Review
- Authentication

b) Backend Layer (Node.js/Express)
- API Routes
- Services
- Models
- Authentication

c) Database Layer (MongoDB)
- Collections based on models
- Data persistence

d) External Services
- AWS Services (indicated by aws-sdk mock)
- Cognito (Authentication)
- Email Service

##### Component Relationships

**[Frontend Components] ←→ [Backend API Routes]**
- ↓
- [Backend Services]
- ↓
- [Database Layer]
- ↑
- [External Services Integration]

##### Detailed Component Breakdown

Frontend (React):
- Redux store connection
- Theme system
- Form handling
- Authentication flow

Backend (Express):
- Route groups:
- User management
- Applications
- Judging
- Sponsors
- Transportation
- Rooms
- Service layer:
- Authentication
- File handling
- Email
- Notifications

##### Implementation Details

- Configuration files (.env, webpack configs)
- Build process
- Test setup
- Database setup/teardown
- Scripts for data management

##### Deployment Flow

Deployment process:
- Travis CI integration
- Heroku deployment
- Environment configurations

Key Technical Aspects to Highlight:
- TypeScript usage throughout
- React/Redux frontend architecture
- Express backend with typed routes
- MongoDB integration
- AWS service integration
- Authentication flow with Cognito
- Testing infrastructure

This system appears to be a full-stack application with emphasis on user management, form handling, and judging functionality for hackathon events, so ensure these core features are prominently displayed in the architectural representation.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        Dashboard["Dashboard"]:::frontend
        Admin["Admin Panel"]:::frontend
        Forms["Forms"]:::frontend
        Judge["Judge Interface"]:::frontend
        Sponsors["Sponsors"]:::frontend
        Transport["Transportation"]:::frontend
        Review["Review"]:::frontend
        Auth["Authentication"]:::frontend
        Redux["State Management"]:::frontend
        Theme["Theme System"]:::frontend
    end

    subgraph Backend
        API["API Routes"]:::backend
        Services["Services Layer"]:::backend
        Models["Data Models"]:::backend
        AuthMiddleware["Auth Middleware"]:::backend
    end

    subgraph Database
        MongoDB[(MongoDB)]:::database
        DBSetup["Database Setup"]:::database
    end

    subgraph "External Services"
        AWS["AWS Services"]:::external
        Cognito["Cognito Auth"]:::external
        Email["Email Service"]:::external
    end

    subgraph "Build & Test"
        WebpackConfig["Build Configuration"]:::config
        Tests["Testing Infrastructure"]:::config
    end

    %% Frontend Connections
    Dashboard --> API
    Admin --> API
    Forms --> API
    Judge --> API
    Sponsors --> API
    Transport --> API
    Review --> API
    Auth --> Cognito
    
    %% All frontend components connect to Redux
    Dashboard & Admin & Forms & Judge & Sponsors & Transport & Review --> Redux
    
    %% Backend Connections
    API --> Services
    Services --> Models
    Models --> MongoDB
    AuthMiddleware --> API
    
    %% External Service Connections
    Services --> AWS
    Services --> Email
    Services --> Cognito
    
    %% Database Setup
    DBSetup --> MongoDB

    %% Click Events
    click Dashboard "https://github.com/TreeHacks/root/blob/2025-root/src/Dashboard/Dashboard.tsx"
    click Admin "https://github.com/TreeHacks/root/blob/2025-root/src/Admin/Admin.tsx"
    click Forms "https://github.com/TreeHacks/root/blob/2025-root/src/FormPage/FormPage.tsx"
    click Judge "https://github.com/TreeHacks/root/blob/2025-root/src/Judge/Judge.tsx"
    click Sponsors "https://github.com/TreeHacks/root/blob/2025-root/src/Sponsors/Sponsors.tsx"
    click Transport "https://github.com/TreeHacks/root/blob/2025-root/src/Transportation/Transportation.tsx"
    click Review "https://github.com/TreeHacks/root/blob/2025-root/src/Review/Review.tsx"
    click Auth "https://github.com/TreeHacks/root/tree/2025-root/src/store/auth/"
    click API "https://github.com/TreeHacks/root/tree/2025-root/backend/routes/"
    click Services "https://github.com/TreeHacks/root/tree/2025-root/backend/services/"
    click Models "https://github.com/TreeHacks/root/tree/2025-root/backend/models/"
    click AuthMiddleware "https://github.com/TreeHacks/root/blob/2025-root/backend/router/authenticatedRoute.ts"
    click DBSetup "https://github.com/TreeHacks/root/blob/2025-root/backend/setupMongo.js"
    click AWS "https://github.com/TreeHacks/root/blob/2025-root/__mocks__/aws-sdk.ts"
    click Cognito "https://github.com/TreeHacks/root/blob/2025-root/__mocks__/cognito-express.ts"
    click Email "https://github.com/TreeHacks/root/blob/2025-root/backend/services/send_email.ts"
    click Redux "https://github.com/TreeHacks/root/tree/2025-root/src/store/"
    click Theme "https://github.com/TreeHacks/root/tree/2025-root/src/themes/"
    click WebpackConfig "https://github.com/TreeHacks/root/blob/2025-root/webpack.common.js"
    click Tests "https://github.com/TreeHacks/root/tree/2025-root/backend/__tests__"

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#9b59b6,stroke:#8e44ad,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef config fill:#e74c3c,stroke:#c0392b,color:white

    %% Legend
    subgraph Legend
        Frontend_L["Frontend Component"]:::frontend
        Backend_L["Backend Component"]:::backend
        Database_L["Database Component"]:::database
        External_L["External Service"]:::external
        Config_L["Build & Test"]:::config
    end
```
