# ntroi/crimechase_move architecture

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

- Interactive diagram: https://gitdiagram.com/ntroi/crimechase_move
- Repository: https://github.com/ntroi/crimechase_move

## Overview

##### Project type and purpose
- CrimeChase is a Move-based smart-contract suite targeting the Aptos blockchain.
- It is neither a full-stack web app nor a traditional microservice architecture, but a modular on-chain NFT and asset-management system.

##### File structure
- Top-level files:
- Move.toml – package manifest, named address mapping for Aptos deployment
- README.md – project overview, architecture notes
- LICENSE.txt and .gitignore
- sh-scripts/ – helper scripts for dev setup, compilation, testing, publishing
- sources/ – each .move file is a separate module:
- appsigner.move
- badge_draw_ticket.move
- certification_center_v2.move
- crimechase_inventory.move
- crimechase_token.move
- mint_helper.move
- utilities.move

##### README for additional insights
- Modular design: certification_center_v1 & v2, app_signer, inventory, crimechase_token
- Uses Aptos Object Model: assets are on-chain resources
- Multi-agent transactions vs. single-address authorization
- Inventory ownership model, transfer lock/unlock

##### Elements
- Clear labels: “Admin Account,” “User Wallet,” “Move VM,” “crimechase_token Module,” etc.
- Dev → CLI → compile/publish → Blockchain
- Wallet → transaction → Modules → Storage
- Rectangles for off-chain components (scripts, CLI)

##### Detail
- Move module as its own component.
- Inter-module calls (e.g., mint_helper → crimechase_token.transfer).
- Authorization checks (e.g., certification_center_v2 checks admin Resource).
- Don’t omit the inventory’s lock/unlock mechanism around transfers.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Actors
    Admin(["Admin Account"]):::actor
    UserWallet(["User Wallet"]):::actor

    %% DevOps Environment
    subgraph "DevOps Environment"
        direction TB
        DevSetup["dev_setup.sh"]:::script
        MoveTests["move_tests.sh"]:::script
        MovePublish["move_publish.sh"]:::script
        AptosCLI["Aptos CLI / SDK"]:::cli
        MoveToml["Move.toml"]:::manifest
        README["README.md"]:::doc
        LICENSE["LICENSE.txt"]:::doc
        GitIgnore[".gitignore"]:::doc
    end

    %% Blockchain
    subgraph "Aptos Blockchain"
        direction TB
        MoveVM["Move VM"]:::block
        Storage["On-Chain Storage"]:::storage
    end

    %% Move Modules
    subgraph "Move Modules (crimechase Address)"
        direction TB
        subgraph Certification
            CCv2["certification_center_v2"]:::module
        end
        subgraph Token
            TokenMod["crimechase_token"]:::module
        end
        subgraph Inventory
            InventoryMod["crimechase_inventory"]:::module
            BadgeTicket["badge_draw_ticket"]:::module
        end
        subgraph Helpers
            AppSigner["app_signer"]:::module
            MintHelper["mint_helper"]:::module
            Utilities["utilities"]:::module
        end
    end

    %% Relationships
    Admin -->|deploy & admin ops| DevSetup
    DevSetup --> AptosCLI
    MoveTests --> AptosCLI
    MovePublish --> AptosCLI
    AptosCLI -->|compile & publish| MoveVM
    MoveVM --> Storage

    UserWallet -->|transaction calls| TokenMod
    UserWallet -->|transaction calls| InventoryMod
    UserWallet -->|transaction calls| BadgeTicket

    CCv2 -->|authorization checks| Admin
    AppSigner -->|multi-agent signature| TokenMod
    AppSigner -->|multi-agent signature| InventoryMod
    MintHelper -->|orchestrates| TokenMod
    MintHelper -->|orchestrates| InventoryMod
    MintHelper -->|orchestrates| CCv2

    TokenMod --> Storage
    InventoryMod --> Storage
    BadgeTicket --> Storage
    CCv2 --> Storage
    Utilities -->|shared types| TokenMod
    Utilities -->|shared types| InventoryMod
    Utilities -->|shared types| CCv2
    Utilities -->|shared types| BadgeTicket
    Utilities -->|shared types| AppSigner
    Utilities -->|shared types| MintHelper

    %% Click events
    click DevSetup "https://github.com/ntroi/crimechase_move/blob/main/sh-scripts/dev_setup.sh"
    click MoveTests "https://github.com/ntroi/crimechase_move/blob/main/sh-scripts/move_tests.sh"
    click MovePublish "https://github.com/ntroi/crimechase_move/blob/main/sh-scripts/move_publish.sh"
    click MoveToml "https://github.com/ntroi/crimechase_move/blob/main/Move.toml"
    click README "https://github.com/ntroi/crimechase_move/blob/main/README.md"
    click LICENSE "https://github.com/ntroi/crimechase_move/blob/main/LICENSE.txt"
    click GitIgnore "https://github.com/ntroi/crimechase_move/blob/main/.gitignore"
    click AppSigner "https://github.com/ntroi/crimechase_move/blob/main/sources/appsigner.move"
    click BadgeTicket "https://github.com/ntroi/crimechase_move/blob/main/sources/badge_draw_ticket.move"
    click CCv2 "https://github.com/ntroi/crimechase_move/blob/main/sources/certification_center_v2.move"
    click TokenMod "https://github.com/ntroi/crimechase_move/blob/main/sources/crimechase_token.move"
    click InventoryMod "https://github.com/ntroi/crimechase_move/blob/main/sources/crimechase_inventory.move"
    click MintHelper "https://github.com/ntroi/crimechase_move/blob/main/sources/mint_helper.move"
    click Utilities "https://github.com/ntroi/crimechase_move/blob/main/sources/utilities.move"

    %% Styles
    classDef actor fill:#f9f,stroke:#333,stroke-width:1px
    classDef script fill:#ff9,stroke:#333,stroke-width:1px
    classDef cli fill:#9ff,stroke:#333,stroke-width:1px
    classDef manifest fill:#cfc,stroke:#333,stroke-width:1px
    classDef doc fill:#ccc,stroke:#333,stroke-width:1px
    classDef block fill:#fc9,stroke:#333,stroke-width:1px
    classDef storage fill:#ccf,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef module fill:#9f9,stroke:#333,stroke-width:1px,shape:roundrect
```
