# auracodeskm/code-day-prod architecture

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

- Interactive diagram: https://gitdiagram.com/auracodeskm/code-day-prod
- Repository: https://github.com/auracodeskm/code-day-prod

## Overview

##### Project type and purpose
- This is a Web3-enabled full-stack DApp built with Next.js (App Router), React, TypeScript, Tailwind CSS on the front end, and Ethereum smart contracts (Hardhat/Ethers.js) on the back end.
- Purpose: A space-themed NFT game (“Mission Launch: Burn or Glory”) where users mint/trade NFT spaceships, launch missions, and earn ERC-20 tokens.

##### File structure
- Top-level “app/” folder: Next.js pages (fleet, marketplace, mission, home).
- “components/”: Reusable UI & Web3 logic (Web3Provider, NFTService, AlchemyService, AudioManager, MissionGameplay, Navbar).
- “services/”: Business logic layer (SpaceLaunchGameService.ts).
- “config/”: Smart contract addresses.
- “public/” + “rockets/” + “images/”: Static assets (audio, images, 3D rockets).
- “smartcontracts/”: Solidity contracts, Hardhat config, deployment scripts.

##### Extract architecture insights from the README
- Front-end communicates with Ethereum via Ethers.js & MetaMask (through Web3Provider).
- Uses Alchemy API (NEXT_PUBLIC_ALCHEMY_API_KEY) and WalletConnect (NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID).
- Smart contracts: NFT (ERC-721), Game logic (mission success/failure, reward distribution), Token (ERC-20).
- Deployment targets: Sepolia, Goerli, mainnet.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Zone
    subgraph "Frontend" 
        direction TB
        subgraph "Pages"
            direction TB
            Home["Home Page"]:::frontend
            Fleet["Fleet Page"]:::frontend
            Marketplace["Marketplace Page"]:::frontend
            Mission["Mission Page"]:::frontend
        end
        subgraph "UI Components & Providers"
            direction TB
            Web3Provider["Web3Provider"]:::service
            NFTService["NFTService"]:::service
            AlchemyService["AlchemyService"]:::service
            AudioManager["AudioManager"]:::service
            MissionGameplay["MissionGameplay"]:::service
            Navbar["Navbar"]:::service
        end
        BusinessLogic["SpaceLaunchGameService"]:::service
    end

    %% External Services
    subgraph "External Services"
        direction TB
        AlchemyAPI["Alchemy API"]:::external
        WalletConnect["WalletConnect"]:::external
        MetaMask["MetaMask Extension"]:::external
    end

    %% Static Assets
    subgraph "Static Assets"
        direction TB
        AudioStore["public/audio & root audio files"]:::static
        Images["public/images"]:::static
        Rockets["public/rockets & rockets/"]:::static
    end

    %% Blockchain Backend
    subgraph "Blockchain Backend"
        direction TB
        Ethereum["Ethereum Network"]:::cloud
        subgraph "Smart Contracts"
            direction TB
            NFTContract["ERC-721 NFT Contract"]:::contract
            GameContract["Game Logic Contract"]:::contract
            TokenContract["ERC-20 Token Contract"]:::contract
        end
        ContractsConfig["Contract Addresses"]:::config
    end

    %% Development Tools
    subgraph "Development Tools"
        direction TB
        HardhatConfig["Hardhat Config"]:::dev
        ContractsDir["Solidity Contracts"]:::dev
        DeployScript["Deployment Script"]:::dev
        SmartPkg["smartcontracts/package.json & tsconfig.json"]:::dev
    end

    %% Connections - Frontend
    Home -->|"uses UI"| Web3Provider
    Fleet -->|"uses UI"| Web3Provider
    Marketplace -->|"uses UI"| Web3Provider
    Mission -->|"uses UI"| Web3Provider

    Web3Provider -->|"calls"| NFTService
    Web3Provider -->|"calls"| AlchemyService
    Web3Provider -->|"provides context"| MissionGameplay
    Web3Provider -->|"renders"| Navbar
    Web3Provider -->|"plays audio"| AudioManager

    NFTService -->|"business logic"| BusinessLogic
    AlchemyService -->|"business logic"| BusinessLogic

    BusinessLogic -->|"JSON-RPC"| Ethereum

    Ethereum -->|"deploys/contracts"| NFTContract
    Ethereum -->|"deploys/contracts"| GameContract
    Ethereum -->|"deploys/contracts"| TokenContract

    NFTContract -->|"emits events"| Web3Provider
    GameContract -->|"emits events"| Web3Provider
    TokenContract -->|"emits events"| Web3Provider

    Web3Provider -->|"HTTP/HTTPS"| AlchemyAPI
    Web3Provider -->|"JSON-RPC"| WalletConnect
    Web3Provider -->|"injected RPC"| MetaMask

    Home -->|"serves assets"| AudioStore
    Home -->|"serves assets"| Images
    Home -->|"serves assets"| Rockets

    ContractsConfig -->|"loaded by"| Web3Provider
    ContractsConfig -->|"loaded by"| BusinessLogic

    %% Dev Tools Flow
    HardhatConfig --> ContractsDir
    ContractsDir --> DeployScript
    DeployScript --> Ethereum
    SmartPkg --> ContractsDir

    %% Click Events
    click Home "https://github.com/auracodeskm/code-day-prod/blob/main/app/page.tsx"
    click Fleet "https://github.com/auracodeskm/code-day-prod/blob/main/app/fleet/page.tsx"
    click Marketplace "https://github.com/auracodeskm/code-day-prod/blob/main/app/marketplace/page.tsx"
    click Mission "https://github.com/auracodeskm/code-day-prod/blob/main/app/mission/page.tsx"
    click Web3Provider "https://github.com/auracodeskm/code-day-prod/blob/main/components/Web3Provider.tsx"
    click NFTService "https://github.com/auracodeskm/code-day-prod/blob/main/components/NFTService.ts"
    click AlchemyService "https://github.com/auracodeskm/code-day-prod/blob/main/components/AlchemyService.tsx"
    click AudioManager "https://github.com/auracodeskm/code-day-prod/blob/main/components/AudioManager.tsx"
    click MissionGameplay "https://github.com/auracodeskm/code-day-prod/blob/main/components/MissionGameplay.tsx"
    click Navbar "https://github.com/auracodeskm/code-day-prod/blob/main/components/Navbar.tsx"
    click BusinessLogic "https://github.com/auracodeskm/code-day-prod/blob/main/services/SpaceLaunchGameService.ts"
    click ContractsConfig "https://github.com/auracodeskm/code-day-prod/blob/main/config/contracts.ts"
    click HardhatConfig "https://github.com/auracodeskm/code-day-prod/blob/main/smartcontracts/hardhat.config.ts"
    click ContractsDir "https://github.com/auracodeskm/code-day-prod/tree/main/smartcontracts/contracts/"
    click DeployScript "https://github.com/auracodeskm/code-day-prod/blob/main/smartcontracts/scripts/deploy.js"
    click SmartPkg "https://github.com/auracodeskm/code-day-prod/blob/main/smartcontracts/package.json"

    %% Styles
    classDef frontend fill:#D0E7FF,stroke:#2B6CB0,stroke-width:2px;
    classDef service fill:#DFFFD0,stroke:#48BB78,stroke-width:2px;
    classDef external fill:#FFE7A2,stroke:#DD6B20,stroke-width:2px;
    classDef static fill:#F0F0F0,stroke:#A0AEC0,stroke-width:2px;
    classDef cloud fill:#E2E8F0,stroke:#4A5568,stroke-width:2px,stroke-dasharray: 5, 5;
    classDef contract fill:#FEF3C7,stroke:#B7791F,stroke-width:2px,stroke-dasharray: 2, 2;
    classDef config fill:#FFF5F5,stroke:#C53030,stroke-width:2px;
    classDef dev fill:#EDF2F7,stroke:#718096,stroke-width:2px;
```
