# lucascampelo/moveit architecture

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

- Interactive diagram: https://gitdiagram.com/lucascampelo/moveit
- Repository: https://github.com/lucascampelo/moveit

## Overview

##### Project type and purpose
- Move.it is a Next.js/React single-page productivity app that implements the Pomodoro technique.
- It ships as a statically rendered (SSG/SSR) front-end with no custom backend beyond the Next.js runtime.

##### File structure
- Top-level directories:
- src/pages – Next.js page files (_app, _document, index)
- src/components – React UI components (ChallengeBox, Countdown, Sidebar, etc.)
- src/contexts – React Context providers for state (ChallengesContext, CountdownContext, ThemeContext)
- src/styles – CSS Modules scoped per component/page
- Configuration: tsconfig.json, package.json, README, challenges.json (static data source)

##### README for additional insights
- Confirms use of Next.js (routing, SSR/SSG), React, TypeScript, CSS Modules
- No mention of external APIs or databases—state is managed client-side via Context and static JSON

##### Main components and their interactions
a. Browser/Client
b. Next.js Server/Runtime
- Serves pre-rendered HTML + JS bundles
- Reads challenges.json at build time or on SSR
c. React Application
- Pages layer (index.tsx)
- Component tree (ExperienceBar, Profile, Countdown, ChallengeBox, CompletedChallenges, LevelUpModal, Sidebar)
d. Context Layer
- ChallengesContext (manages current challenge, points, levels)
- CountdownContext (manages timer state)
- ThemeContext (manages UI theme)
e. Static Assets

##### Architectural patterns and design principles
- Component-based UI (React)
- Centralized state via React Context API
- Next.js SSG/SSR for performance and SEO
- CSS Modules for scoped styling
- Clear separation: Routing (pages) → State (contexts) → Presentation (components) → Assets

##### Detail level
- Call out getServerSideProps or getStaticProps if used on index.tsx
- Public folder’s role in serving media assets

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Static Data Source
    challenges["challenges.json"]:::data
    click challenges "https://github.com/lucascampelo/moveit/blob/master/challenges.json"

    %% Server/Runtime Layer
    subgraph "Next.js Server/Runtime" 
        direction TB
        routing["Routing (src/pages)"]:::server
        routing -->|"reads at build/SSR"| challenges
        routing_sub1["_app.tsx"]:::server
        routing_sub2["_document.tsx"]:::server
        routing_sub3["index.tsx"]:::server
        routing --> routing_sub1
        routing --> routing_sub2
        routing --> routing_sub3
        click routing_sub1 "https://github.com/lucascampelo/moveit/blob/master/src/pages/_app.tsx"
        click routing_sub2 "https://github.com/lucascampelo/moveit/blob/master/src/pages/_document.tsx"
        click routing_sub3 "https://github.com/lucascampelo/moveit/blob/master/src/pages/index.tsx"
    end

    %% Browser/Client Layer
    subgraph "Browser/Client (hydrated)" 
        direction TB

        %% Context Providers
        ChallengesCtx("ChallengesContext"):::context
        CountdownCtx("CountdownContext"):::context
        ThemeCtx("ThemeContext"):::context
        click ChallengesCtx "https://github.com/lucascampelo/moveit/blob/master/src/contexts/ChallengesContext.tsx"
        click CountdownCtx "https://github.com/lucascampelo/moveit/blob/master/src/contexts/CountdownContext.tsx"
        click ThemeCtx "https://github.com/lucascampelo/moveit/blob/master/src/contexts/ThemeContext.tsx"

        %% UI Components
        subgraph "UI Components" 
            direction TB
            ExperienceBar("ExperienceBar"):::ui
            Profile("Profile"):::ui
            CompletedChallenges("CompletedChallenges"):::ui
            ChallengeBox("ChallengeBox"):::ui
            Countdown("Countdown"):::ui
            LevelUpModal("LevelUpModal"):::ui
            Sidebar("Sidebar"):::ui
            click ExperienceBar "https://github.com/lucascampelo/moveit/blob/master/src/components/ExperienceBar.tsx"
            click Profile "https://github.com/lucascampelo/moveit/blob/master/src/components/Profile.tsx"
            click CompletedChallenges "https://github.com/lucascampelo/moveit/blob/master/src/components/CompletedChallenges.tsx"
            click ChallengeBox "https://github.com/lucascampelo/moveit/blob/master/src/components/ChallengeBox.tsx"
            click Countdown "https://github.com/lucascampelo/moveit/blob/master/src/components/Countdown.tsx"
            click LevelUpModal "https://github.com/lucascampelo/moveit/blob/master/src/components/LevelUpModal.tsx"
            click Sidebar "https://github.com/lucascampelo/moveit/blob/master/src/components/Sidebar.tsx"
        end

        %% Styles Modules
        subgraph "CSS Modules" 
            direction TB
            EB_css("ExperienceBar.module.css"):::styles
            PR_css("Profile.module.css"):::styles
            CC_css("CompletedChallenges.module.css"):::styles
            CB_css("ChallengeBox.module.css"):::styles
            CO_css("Countdown.module.css"):::styles
            LM_css("LevelUpModal.module.css"):::styles
            SB_css("Sidebar.module.css"):::styles
            click EB_css "https://github.com/lucascampelo/moveit/blob/master/src/styles/components/ExperienceBar.module.css"
            click PR_css "https://github.com/lucascampelo/moveit/blob/master/src/styles/components/Profile.module.css"
            click CC_css "https://github.com/lucascampelo/moveit/blob/master/src/styles/components/CompletedChallenges.module.css"
            click CB_css "https://github.com/lucascampelo/moveit/blob/master/src/styles/components/ChallengeBox.module.css"
            click CO_css "https://github.com/lucascampelo/moveit/blob/master/src/styles/components/Countdown.module.css"
            click LM_css "https://github.com/lucascampelo/moveit/blob/master/src/styles/components/LevelUpModal.module.css"
            click SB_css "https://github.com/lucascampelo/moveit/blob/master/src/styles/components/Sidebar.module.css"
        end

        %% Global Styles
        globalStyles["global.css"]:::styles
        homeStyles["Home.module.css"]:::styles
        click globalStyles "https://github.com/lucascampelo/moveit/blob/master/src/styles/global.css"
        click homeStyles "https://github.com/lucascampelo/moveit/blob/master/src/styles/pages/Home.module.css"

        %% Asset Folder
        assets["public assets"]:::assets
        click assets "https://github.com/lucascampelo/moveit/tree/master/public/icons/"
        click assets "https://github.com/lucascampelo/moveit/blob/master/public/notification.mp3"
        click assets "https://github.com/lucascampelo/moveit/blob/master/public/logo.svg"
    end

    %% Relationships
    challenges -->|"serves data to"| routing
    routing -->|"sends HTML/JS"| Browser["Browser/Client"] 
    Browser --> ChallengesCtx
    Browser --> CountdownCtx
    Browser --> ThemeCtx
    ChallengesCtx -->|"provides state"| ExperienceBar
    ChallengesCtx --> CompletedChallenges
    ChallengesCtx --> ChallengeBox
    ChallengesCtx --> LevelUpModal
    CountdownCtx --> Countdown
    ThemeCtx --> Sidebar

    ExperienceBar --> EB_css
    Profile --> PR_css
    CompletedChallenges --> CC_css
    ChallengeBox --> CB_css
    Countdown --> CO_css
    LevelUpModal --> LM_css
    Sidebar --> SB_css

    Browser --> assets

    %% Classes
    class Browser server
    class routing server
    class challenges data
    class ChallengesCtx,CountdownCtx,ThemeCtx context
    class ExperienceBar,Profile,CompletedChallenges,ChallengeBox,Countdown,LevelUpModal,Sidebar ui
    class EB_css,PR_css,CC_css,CB_css,CO_css,LM_css,SB_css,globalStyles,homeStyles styles
    class assets assets

    classDef server fill:#ADD8E6,stroke:#000
    classDef context fill:#90EE90,stroke:#000
    classDef ui fill:#FFFFE0,stroke:#000
    classDef data fill:#D3D3D3,stroke:#000,stroke-dasharray: 5 5
    classDef assets fill:#DCDCDC,stroke:#000,stroke-dasharray: 2 2
    classDef styles fill:#F0F0F0,stroke:#666,stroke-dasharray: 3 3
```
