# higayasuo/icp-examples architecture

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

- Interactive diagram: https://gitdiagram.com/higayasuo/icp-examples
- Repository: https://github.com/higayasuo/icp-examples

## Overview

##### Main Components
- Overall “Internet Computer Examples” umbrella: This represents an examples repository for learning and experimentation.
- Individual example applications:
– expo-starter: A demo application that integrates an Expo (likely React Native) frontend and a Rust-based backend canister (using Cargo, .did interface files, etc.). Also includes additional integration layers (e.g., “ii-integration”) and supporting scripts/documentation.
– http_incoming: An example handling HTTP incoming requests. It includes a backend component (with Rust source files and a .did interface) and a frontend (likely a demonstration frontend served via Webpack).
– http_outcall: Another example focusing on making HTTP outcalls from canisters. Similarly, it has backend components demonstrating integration with external HTTP services.
- Supporting and configuration tools: Dockerfile, docker-compose.yml, and .devcontainer files indicate containerized development environments. The presence of various build scripts (e.g., build.sh, setup.sh) demonstrates automation for deployment and integration.

##### Relationships and Interactions
- Within each example (e.g., expo-starter), show a separation between the frontend and backend:
– The frontend (React/Expo components, TS/JS files, assets, and configuration files like app.json and tsconfig.json) interacts with the backend canisters.
– The backend (Rust-based modules with Cargo.toml, .did interface files) provides business logic and canister interfaces that the frontend consumes.
- Between example projects, consider showing that while they are individually runnable, they share common concepts such as using canisters, integration scripts, and standardized development environments.
- External integration points where relevant – for example, the integration of Dfinity agents, dependency packages (like dfx configuration and agent libraries), and Docker-based encapsulation for local development.

##### Architectural Patterns and Design Principles
- Layered architecture: The examples follow a clear separation between presentation (frontend) and business logic/data management (backend canisters written in Rust).
- Microservice-like boundaries: Each example is self-contained and demonstrates specific Internet Computer functionalities (e.g., HTTP handling, decentralization via canisters, etc.).
- Containerization and automation: Docker and devcontainer setups emphasize repeatable and isolated environments for development, testing, and deployment.
- Modularity and extensibility: The examples include scripts and configurations that encourage modification and extension (e.g., integration scripts, canister declarations).

##### Relevant Technologies, Frameworks, or Libraries
- Frontend frameworks: Expo, React/React Native, and TypeScript.
- Backend framework/technologies: Rust (with Cargo configuration), integration with Dfinity’s canister interfaces (.did files).
- Tooling and build systems: Docker, docker-compose, Dfinity’s dfx configuration, and various build scripts.
- Additional libraries: ESLint, Prettier, and integration of packages such as “dfinity-agent” and “noble-curves” hint at cryptographic operations and identity management.

##### Putting It All Together
- Create branches for each example application:
– For expo-starter, indicate both the mobile/web Expo frontend and the Rust backend canister (with its internal modules such as vet_keys and type definitions).

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Internet Computer Examples"]:::umbrella
    B["Development & Deployment Environment"]:::environment

    A --> B

    subgraph "expo-starter"
        C["expo-starter Frontend"]:::frontend
        D["expo-starter Backend"]:::backend
        E["expo-starter Integration Layer"]:::integration
        C -->|"calls"| D
        C -->|"integration"| E
        E -->|"calls"| D
    end

    subgraph "http_incoming"
        F["http_incoming Frontend"]:::frontend
        G["http_incoming Backend"]:::backend
        F -->|"calls"| G
    end

    subgraph "http_outcall"
        H["http_outcall Backend"]:::backend
    end

    A --> C
    A --> F
    A --> H

    B --> D
    B --> G
    B --> H

    click A "https://github.com/higayasuo/icp-examples/blob/main/README.md"
    click B "https://github.com/higayasuo/icp-examples/tree/main/.devcontainer/"
    click C "https://github.com/higayasuo/icp-examples/tree/main/expo-starter/src/frontend"
    click D "https://github.com/higayasuo/icp-examples/tree/main/expo-starter/src/backend"
    click E "https://github.com/higayasuo/icp-examples/tree/main/expo-starter/src/ii-integration"
    click F "https://github.com/higayasuo/icp-examples/tree/main/http_incoming/src/http_incoming_frontend"
    click G "https://github.com/higayasuo/icp-examples/tree/main/http_incoming/src/http_incoming_backend"
    click H "https://github.com/higayasuo/icp-examples/tree/main/http_outcall/src/http_outcall_backend"

    classDef umbrella fill:#fcc,stroke:#333,stroke-width:2px;
    classDef environment fill:#d1f3d1,stroke:#333,stroke-width:2px;
    classDef frontend fill:#bbf,stroke:#333,stroke-width:2px;
    classDef backend fill:#bfb,stroke:#333,stroke-width:2px;
    classDef integration fill:#ffcc00,stroke:#333,stroke-width:2px;
```
