# Architecture Overview

The CollabraChain architecture is composed of five distinct layers that work in concert to provide a seamless, secure, and self-sustaining platform for decentralized collaboration.

<figure><img src="/files/iK3OPGV81mxmS5fhylzS" alt=""><figcaption><p>Architecture Collabrachain</p></figcaption></figure>

#### Layer Breakdown

1. **User Layer:** The end-users of the platform, including Project Creators and Freelancers, who interact with the system through their wallets.
2. **Frontend Layer:** The user-facing interface of the application. This includes dedicated pages for project creation and discovery, dashboards for managing active projects, and the core AI chat interface where most interactions take place.
3. **Communication & Payment Layer:** This layer handles all real-time interactions and monetized requests.
   * **XMTP:** Provides secure, wallet-to-wallet messaging for all communication between users and the AI agent.
   * **x402pay:** A crucial protocol that gates access to premium or sensitive actions by requiring small, on-chain payments, making the system economically sustainable.
4. **Intelligence Layer:** The brain of the platform.
   * **Coinbase AgentKit AI:** An autonomous agent that understands natural language commands from the chat, interacts with the `x402pay` protocol to process fees, and executes transactions on the blockchain. It's powered by large language models on Amazon Bedrock.
5. **Blockchain Layer (Base):** The ultimate source of truth and settlement.
   * **Smart Contracts:** A suite of contracts on the Base network that govern all core logic, including project creation (Factory), escrow and milestone management (Project), on-chain identity (Reputation), and conflict resolution (Dispute).

#### **Code Repositories**

The project is fully open-source. You can explore the code for each architectural component in its dedicated repository:

* **Frontend:** <https://github.com/CollabraChain/frontend>
* **XMTP (AI Agent):** <https://github.com/CollabraChain/xmtp>
* **Smart Contracts:** <https://github.com/CollabraChain/smart-contract>
* **Subgraph:** <https://github.com/CollabraChain/subgraph>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://collabrachain.gitbook.io/docs/tech-stack/architecture-overview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
