# pedroco3lho/starkdevs architecture

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

- Interactive diagram: https://gitdiagram.com/pedroco3lho/starkdevs
- Repository: https://github.com/pedroco3lho/starkdevs

## Overview

##### Main Components Identification

a) Frontend Layer (Next.js Application):
- User Interface Components
- Smart Contract Testing Environment
- WASM Integration
- Wallet Connection

b) Smart Contract Layer:
- Challenge Contracts
- Testing Framework
- Deployment Infrastructure

c) External Services:
- Starknet Testnet
- Wallet Providers
- WASM Runtime

**[User Interface Layer]**

**[WASM Integration Layer]**

**[Smart Contract Layer]**

**[Blockchain Layer]**

##### User Interface Layer (Blue Components)
- Next.js Frontend
- Navigation Components
- IDE Interface
- Task Management
- Wallet Connection UI

##### WASM Integration Layer (Purple Components)
- Wasm-Cairo Runtime
- Contract Compilation
- Test Execution

##### Smart Contract Layer (Green Components)
- Challenge Contracts
- Test Contracts
- Contract Deployment Scripts

##### Blockchain Layer (Orange Components)
- Starknet Testnet
- Wallet Providers
- Contract Interactions

##### Specific Implementation Details

Key technical elements:
- Relationship between src/components and their respective functionalities
- How the WASM runtime interfaces with Cairo contracts
- Demonstrate the deployment flow from local development to testnet
- Wallet integration points

##### Additional Elements

- Configuration files (Scarb.toml, etc.)
- Test environments
- Deployment scripts
- Helper utilities

##### Notes Section

A notes section describing:
- Development environment setup
- Testing procedures
- Deployment workflows
- Security considerations

Remember to include version information and any relevant dependencies or external services that play crucial roles in the system's operation.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Frontend Layer"
        UI["Next.js Frontend"]:::frontend
        Nav["Navigation Component"]:::frontend
        IDE["IDE Interface"]:::frontend
        TaskMgmt["Task Management"]:::frontend
        TaskModal["Task Modal"]:::frontend
        WalletUI["Wallet Connection UI"]:::frontend
        TestUI["Contract Testing UI"]:::frontend
    end

    subgraph "WASM Integration Layer"
        WasmRuntime["WASM Runtime"]:::wasm
        WasmInterface["WASM Interface"]:::wasm
        WasmTypes["WASM Types"]:::wasm
        CodeRunner["Cairo Code Runner"]:::wasm
    end

    subgraph "Smart Contract Layer"
        DinnerContract["Dinner Event Contract"]:::contract
        GroceryContract["Grocery Store Contract"]:::contract
        BankContract["STRK Bank Contract"]:::contract
        TestFramework["Testing Framework"]:::contract
        DeployScript["Contract Deployment"]:::contract
    end

    subgraph "Blockchain Layer"
        StarknetTest["Starknet Testnet"]:::blockchain
        WalletProvider["Wallet Provider"]:::blockchain
        StarknetProvider["Starknet Provider"]:::blockchain
        NetworkConfig["Network Configuration"]:::blockchain
        DeployHelper["Deployment Helpers"]:::blockchain
    end

    subgraph "Configuration"
        ContractConfig["Contract Config"]:::config
        FrontendConfig["Frontend Config"]:::config
        ProjectTypes["Project Types"]:::config
    end

    UI --> Nav
    UI --> IDE
    UI --> TaskMgmt
    TaskMgmt --> TaskModal
    UI --> WalletUI
    UI --> TestUI

    IDE --> WasmRuntime
    WasmRuntime --> WasmInterface
    WasmInterface --> WasmTypes
    WasmRuntime --> CodeRunner

    CodeRunner --> DinnerContract
    CodeRunner --> GroceryContract
    CodeRunner --> BankContract
    TestFramework --> DinnerContract
    TestFramework --> GroceryContract
    TestFramework --> BankContract

    DeployScript --> StarknetTest
    WalletUI --> WalletProvider
    WalletProvider --> StarknetProvider
    StarknetProvider --> NetworkConfig
    NetworkConfig --> DeployHelper
    DeployHelper --> StarknetTest

    classDef frontend fill:#3498db
    classDef wasm fill:#9b59b6
    classDef contract fill:#2ecc71
    classDef blockchain fill:#e67e22
    classDef config fill:#95a5a6

    %% Click events for component mapping
    click UI "https://github.com/PedroCo3lho/StarkDevs/tree/main/frontend/src/app"
    click Nav "https://github.com/PedroCo3lho/StarkDevs/blob/main/frontend/src/components/NavBar/NavBar.tsx"
    click IDE "https://github.com/PedroCo3lho/StarkDevs/blob/main/frontend/src/components/Ide/Ide.tsx"
    click TaskMgmt "https://github.com/PedroCo3lho/StarkDevs/blob/main/frontend/src/components/Task/Task.tsx"
    click TaskModal "https://github.com/PedroCo3lho/StarkDevs/blob/main/frontend/src/components/TaskModal/TaskModal.tsx"
    click DinnerContract "https://github.com/PedroCo3lho/StarkDevs/blob/main/contracts/dinner_event/src/lib.cairo"
    click GroceryContract "https://github.com/PedroCo3lho/StarkDevs/blob/main/contracts/grocery_store/src/lib.cairo"
    click BankContract "https://github.com/PedroCo3lho/StarkDevs/blob/main/contracts/strk_bank/src/lib.cairo"
    click TestFramework "https://github.com/PedroCo3lho/StarkDevs/blob/main/contracts/*/tests/test_contract.cairo"
    click DeployScript "https://github.com/PedroCo3lho/StarkDevs/blob/main/snfoundry/scripts-ts/deploy-contract.ts"
    click WasmRuntime "https://github.com/PedroCo3lho/StarkDevs/blob/main/frontend/src/pkg/module/wasm-cairo_bg.wasm"
    click WasmInterface "https://github.com/PedroCo3lho/StarkDevs/blob/main/frontend/src/pkg/module/wasm-cairo.js"
    click WasmTypes "https://github.com/PedroCo3lho/StarkDevs/blob/main/frontend/src/pkg/module/wasm-cairo.d.ts"
    click CodeRunner "https://github.com/PedroCo3lho/StarkDevs/blob/main/frontend/src/utils/runCairoCode.ts"
    click WalletProvider "https://github.com/PedroCo3lho/StarkDevs/blob/main/frontend/src/providers/WalletProvider.tsx"
    click StarknetProvider "https://github.com/PedroCo3lho/StarkDevs/blob/main/frontend/src/providers/StarknetProvider.tsx"
    click NetworkConfig "https://github.com/PedroCo3lho/StarkDevs/blob/main/snfoundry/scripts-ts/helpers/networks.ts"
    click DeployHelper "https://github.com/PedroCo3lho/StarkDevs/blob/main/snfoundry/scripts-ts/helpers/deploy-wrapper.ts"
    click TestUI "https://github.com/PedroCo3lho/StarkDevs/blob/main/frontend/src/components/TestContractUi/TestContractUi.tsx"
    click ContractConfig "https://github.com/PedroCo3lho/StarkDevs/blob/main/contracts/*/Scarb.toml"
    click FrontendConfig "https://github.com/PedroCo3lho/StarkDevs/blob/main/frontend/next.config.ts"
    click ProjectTypes "https://github.com/PedroCo3lho/StarkDevs/blob/main/frontend/src/interfaces/interfaces.ts"
```
