How charclub/marketplace works
Project Type and Purpose
• CharclubMarketplace is a full-stack DApp (decentralized application) targeting the Internet Computer.
• The “backend” consists of one or more Motoko canisters (smart contracts) that implement marketplace logic, token management, and threshold cryptography.
• The “frontend” is a React/Vite application (TypeScript + TailwindCSS) that interacts with those canisters via the IC actor model.
File Structure Analysis
• Top-level config:
• dfx.json & canister_ids.json – define local vs. IC canister IDs and build settings
• package.json / pnpm-workspace.yaml – monorepo package management
• .github/workflows/deployment.yml & scripts/submit-deploy.sh – CI/CD pipeline
• src/backend – Motoko source for the core marketplace canister (main.mo, types.mo, plus hash/utility modules)
• src/threshold – Motoko source for a threshold-crypto canister (main.mo)
• src/frontend – React app structured into:
• public/ – static assets & DFX asset canister bundle
• src/components, hooks, contexts, pages, routes – React + TS + IC actor integration
• idl.ts, actor creation under utils/icp-ledger.ts
• README.md – describes local DFX workflow, actor generation, frontend proxying to replica.
Key Architectural Patterns
• Microservices via independent canisters (each Motoko module is its own deployable unit)
• Actor model: frontend uses autogenerated Candid interfaces and createActor() wrappers
• React component hierarchy with Contexts (Auth, Actor) and Hooks for data fetching
• Monorepo using PNPM workspaces for both backend and frontend code
• CI/CD: GitHub Actions triggers dfx canister deploy via script
1. Developer Workstation
• dfx CLI, pnpm, VSCode (local dev tools)
2. DFX Local Replica
• HTTP endpoints for canisters (port 4943)
3. Asset Canister
• Serves static frontend bundle
4. Marketplace Canister
• Implements NFT listing, buying, metadata storage
5. Threshold Canister
• Handles multi-party crypto operations, key shares
6. React Frontend (Browser)
• Runs on Vite dev server (port 8080) or served from asset canister
7. GitHub Actions / CI Pipeline
• deployment.yml, submit-deploy.sh
• Developer → (dfx start/deploy) → DFX Local Replica
• DFX Local Replica ↔ Asset Canister (static file hosting)
• Browser → HTTP GET → Asset Canister or Vite Dev Server
• Browser → Actor (Candid over HTTP) → Marketplace Canister
• Browser → Actor → Threshold Canister
• GitHub Actions → dfx canister deploy → IC Mainnet / Testnet
• Architectural Highlights:
• Separation of concerns: static asset hosting vs. business logic canisters
• Each canister is independent, enabling parallel development, separate upgrade cycles
• React Contexts centralize actor instances and authentication state
• Hooks abstract Candid queries/mutations (ICRC-7 token queries, pricing, balances)
• Technology Stack Labels:
• Motoko (canisters)
• Internet Computer replica / IC network
• React + Vite + TypeScript + Tailwind
• PNPM Monorepo
• GitHub Actions