// ARCHITECTURE

TechnicalREADME

An overview of the RedKey DAO tech stack, data flow, and how the Minimum Viable Product (MVP) operates under the hood.

Tech Stack

  • [>]
    Framework: Next.js 15 (App Router), React 19
  • [>]
    Styling: Tailwind CSS 4, Framer Motion for micro-interactions
  • [>]
    Authentication: Thirdweb Connect SDK (In-app Wallets + WalletConnect)
  • [>]
    Icons: Lucide React Vector Graphics
  • [>]
    UI Components: Custom-built from the ground up to achieve a futuristic, brutalist aesthetic. No generic libraries.

Data Persistence

For this MVP phase, to provide a zero-friction demonstration without requiring a backend database or actual smart contract deployments, all state is managed client-side:

// lib/local-dao-store.ts
const storageKeys = {
  members: 'rc_members',
  treasury: 'rc_treasury',
  proposals: 'rc_proposals',
  loans: 'rc_loans',
  activity: 'rc_activity'
};

Data is persisted entirely in the browser's localStorage. Seed data is generated programmatically on the first load so reviewers can interact with a "live" ecosystem immediately. Creating proposals, voting, funding loans, and updating profiles are entirely functional and persist across hard reloads.

Application Structure

The DAO interface is modularly split across multiple Next.js App Router endpoints, sharing state via the local store provider:

  • /dao - The main operational dashboard. Aggregates treasury statistics, recent community activity, and active governance alerts.
  • /dao/proposals - The governance hub. Displays lists of community investment proposals, allows creation of new ones, and handles fractional voting based on reputation.
  • /dao/loans - The P2P DeFi lending market. Users can browse active collateralized loan requests, or submit their own requests based on their tier.
  • /dao/members - A social explorer acting as a directory of DAO participants, showcasing their accumulated power and historical contribution.
  • /dao/discussion - A lightweight discussion space where members open topics, discuss risk assumptions, and coordinate around proposals before anything moves on-chain.

Lending Engine Logic

The Lending engine simulates a fragmented collateralized debt protocol.

  • Phased State Machine: Loops through requestedvotingcollateral_pendingfundingactiverepaid/defaulted.
  • Collateral requirement: Hardcoded to 100% logic to prevent bad debt cascades. The borrower MUST lock assets equal to the fiat/stablecoin equivalent of their request.
  • Crowd-funding: Funders can contribute fractionally (e.g., $50 to a $1000 loan request). The system tracks each funder's percentage share and timestamps to distribute repayments or liquidations proportionally.