# silto/moveproject architecture

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

- Interactive diagram: https://gitdiagram.com/silto/moveproject
- Repository: https://github.com/silto/moveproject

## Overview

##### Project type and purpose
- This is a full-stack, data-driven analytics/trading application (“MOVE Project”) with:
- A Node.js backend exposing a GraphQL API
- A React-based frontend with server-side rendering
- Scheduled data-ingestion jobs and real-time data loaders for cryptocurrency (BTC, MOVE)
- External data providers (CryptoCompare, CryptoWatch, FTX) and persistence layers (database, queues, CSV/JSON dumps)

##### File structure
- Top-level “backend” and “frontend” directories
- backend:
- config, init-scripts, server.js, package.json
- src/schema: GraphQL type definitions, queries, mutations, routes
- src/dataloaders + src/jobs + src/routines: ETL and scheduled jobs via queues
- src/lib + src/middlewares: utilities for mail, SMS, Redis sessions, auth, rate limiting
- bin/cluster and bin/server: clustering and launch scripts
- frontend:
- server.js (SSR entry), bin/devserver, bin/server
- src/client.js, src/index.js: React app bootstrap
- src/components, actions, reducers, store: Redux + React structure
- src/gqlRequests: GraphQL queries/mutations
- public/static/app.ejs: HTML template
- webpack configs, SASS, fonts, i18n locales

##### README for additional insights
- The README explains that the original DB is gone; data is available via CSV/JSON dumps on S3
- Focus is on historical BTC and MOVE contract data, their OHLCs, trades, and analytics

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend" 
        direction TB
        Browser["Browser"]:::frontend
        SSR["SSR Server (Node/Express + React)"]:::frontend
        Static["Static Assets"]:::frontend
        Browser -->|HTTP: initial HTML| SSR
        SSR -->|GraphQL over HTTP| GraphQL
        Browser -->|GraphQL over HTTP| GraphQL
    end

    %% Backend Layer
    subgraph "Backend"
        direction TB
        subgraph "Core API" 
            direction TB
            GraphQL["GraphQL Server"]:::backendCore
            Schema["GraphQL Schema"]:::backendCore
            Auth["graphQLAuth Middleware"]:::backendCore
            RedisUtil["redisSessionUtils"]:::backendCore
            GraphQL -->|SQL/NoSQL| DB
            GraphQL -->|Sessions/Cache| Redis
            GraphQL -->|Enqueue jobs| Queue
            GraphQL -->|Notify users| Notification
            GraphQL --> Schema
            GraphQL --> Auth
            GraphQL --> RedisUtil
        end
        DB["Primary Database"]:::db
        Redis["Redis Cache/Session"]:::db
        Queue["Message Queue"]:::workers
        subgraph "Workers & Routines"
            direction TB
            Jobs["Queue Workers"]:::workers
            Routines["Scheduled Routines"]:::workers
            Jobs -->|Consume jobs| Queue
            Jobs -->|Fetch data| ExternalAPIs
            Jobs -->|Write data| DB
            Routines -->|Cron fetch| ExternalAPIs
            Routines -->|Write data| DB
        end
    end

    %% External Services
    ExternalAPIs["External APIs (CryptoCompare, CryptoWatch, FTX)"]:::external
    Notification["Email/SMS Services"]:::external

    %% External Connections
    ExternalAPIs -->|API calls| Jobs
    ExternalAPIs -->|API calls| Routines
    Notification -->|SMTP/SMS| GraphQL

    %% Click Events - Backend Core
    click GraphQL "https://github.com/silto/moveproject/blob/main/backend/server.js"
    click Schema "https://github.com/silto/moveproject/tree/main/backend/src/schema/"
    click Auth "https://github.com/silto/moveproject/blob/main/backend/src/middlewares/graphQLAuth.js"
    click RedisUtil "https://github.com/silto/moveproject/blob/main/backend/src/lib/redisSessionUtils.js"
    click DB "https://github.com/silto/moveproject/blob/main/backend/config/init-conns.js"
    click Queue "https://github.com/silto/moveproject/blob/main/backend/config/init-queues.js"

    %% Click Events - Data Loaders
    DataLoaders["Data Loaders"]:::backendCore
    GraphQL --> DataLoaders
    click DataLoaders "https://github.com/silto/moveproject/blob/main/backend/src/dataloaders/index.js"
    click DataLoaders "https://github.com/silto/moveproject/tree/main/backend/src/dataloaders/"

    %% Click Events - Jobs & Routines
    click Jobs "https://github.com/silto/moveproject/tree/main/backend/src/jobs/queues/"
    click Jobs "https://github.com/silto/moveproject/tree/main/backend/src/jobs/"
    click Routines "https://github.com/silto/moveproject/blob/main/backend/src/routines/index.js"
    click Routines "https://github.com/silto/moveproject/tree/main/backend/src/routines/"

    %% Click Events - External Interfaces
    CryptoComp["CryptoCompare"]:::external
    CryptoWatch["CryptoWatch"]:::external
    FTX["FTX"]:::external
    ExternalAPIs --> CryptoComp
    ExternalAPIs --> CryptoWatch
    ExternalAPIs --> FTX
    click CryptoComp "https://github.com/silto/moveproject/blob/main/backend/src/interface/cryptocompare.js"
    click CryptoWatch "https://github.com/silto/moveproject/blob/main/backend/src/interface/cryptowatch.js"
    click FTX "https://github.com/silto/moveproject/blob/main/backend/src/interface/ftx.js"

    %% Click Events - Utility Libraries
    UtilMail["Mail Helpers"]:::backendCore
    UtilSMS["SMS Helpers"]:::backendCore
    UtilRate["Rate Limit"]:::backendCore
    GraphQL --> UtilMail
    GraphQL --> UtilSMS
    GraphQL --> UtilRate
    click UtilMail "https://github.com/silto/moveproject/blob/main/backend/src/lib/mail-helpers.js"
    click UtilSMS "https://github.com/silto/moveproject/blob/main/backend/src/lib/sms-helpers.js"
    click UtilRate "https://github.com/silto/moveproject/blob/main/backend/src/lib/rateLimit.js"
    click RedisUtil "https://github.com/silto/moveproject/blob/main/backend/src/lib/redisSessionUtils.js"

    %% Click Events - Cluster & Launch
    Cluster["Cluster Script"]:::backendCore
    ServerBin["Server Launch Script"]:::backendCore
    GraphQL --> Cluster
    GraphQL --> ServerBin
    click Cluster "https://github.com/silto/moveproject/tree/main/backend/bin/cluster"
    click ServerBin "https://github.com/silto/moveproject/tree/main/backend/bin/server"

    %% Click Events - Frontend
    click SSR "https://github.com/silto/moveproject/blob/main/frontend/server.js"
    click SSR "https://github.com/silto/moveproject/tree/main/frontend/bin/devserver"
    click SSR "https://github.com/silto/moveproject/tree/main/frontend/bin/server"
    click ClientBootstrap "https://github.com/silto/moveproject/blob/main/frontend/src/client.js"
    click ClientBootstrap "https://github.com/silto/moveproject/blob/main/frontend/src/index.js"
    click Store "https://github.com/silto/moveproject/blob/main/frontend/src/store.js"
    click Actions "https://github.com/silto/moveproject/tree/main/frontend/src/actions/"
    click Reducers "https://github.com/silto/moveproject/tree/main/frontend/src/reducers/"
    click GQLReq "https://github.com/silto/moveproject/tree/main/frontend/src/gqlRequests/"
    click Components "https://github.com/silto/moveproject/tree/main/frontend/src/components/"
    click Static "https://github.com/silto/moveproject/blob/main/frontend/public/static/app.ejs"
    click Static "https://github.com/silto/moveproject/tree/main/frontend/public/"
    click Webpack1 "https://github.com/silto/moveproject/blob/main/frontend/webpack.config.js"
    click Webpack2 "https://github.com/silto/moveproject/blob/main/frontend/webpack.server.js"
    click Locales "https://github.com/silto/moveproject/tree/main/frontend/locales/"
    click I18n "https://github.com/silto/moveproject/blob/main/frontend/src/lib/i18n.js"

    %% Class Definitions
    classDef frontend fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef backendCore fill:#d4edda,stroke:#333,stroke-width:1px
    classDef workers fill:#ffe5b4,stroke:#333,stroke-width:1px
    classDef db fill:#e2f3e8,stroke:#333,stroke-width:1px
    classDef external fill:#f2f2f2,stroke:#333,stroke-width:1px
```
