The Wikipedia of Web3
Open-source documentation platform with git-style version control, Solana-based token consensus, and AI-powered authoring.
docs.fun is a decentralized documentation platform where anyone can create, version, and collaboratively edit documentation using git-style workflows -- all backed by Solana-based token consensus. Think Wikipedia meets Git meets Web3.
Core principles:
- Open participation -- anyone can read, propose edits, and vote on changes
- Git-style versioning -- branching, diffing, merging, and commit history for docs
- Token consensus -- edit proposals are approved through token-weighted community voting
- Token-gated features -- premium capabilities unlock at higher token balance tiers
- AI-native -- Python SDK enables AI agents to write and maintain documentation autonomously
graph TB
subgraph Client Layer
CLI["CLI Tool<br/>(TypeScript)"]
SDK["Page Builder SDK<br/>(TypeScript)"]
PY["Python SDK<br/>(AI Agent)"]
end
subgraph Platform
API["REST API<br/>(TypeScript/Express)"]
SEARCH["Search Engine<br/>(TF-IDF Index)"]
STORAGE["Content Storage<br/>(IPFS/Arweave)"]
end
subgraph Solana
PROGRAM["Consensus Program<br/>(Rust)"]
TOKEN["$DOCS Token"]
end
CLI --> API
SDK --> API
PY --> API
API --> SEARCH
API --> STORAGE
API --> PROGRAM
PROGRAM --> TOKEN
style CLI fill:#7C3AED,color:#fff,stroke:none
style SDK fill:#7C3AED,color:#fff,stroke:none
style PY fill:#7C3AED,color:#fff,stroke:none
style API fill:#06B6D4,color:#fff,stroke:none
style SEARCH fill:#06B6D4,color:#fff,stroke:none
style STORAGE fill:#06B6D4,color:#fff,stroke:none
style PROGRAM fill:#14532d,color:#fff,stroke:none
style TOKEN fill:#14532d,color:#fff,stroke:none
docs/
├── programs/docs_consensus/ Solana on-chain program (Rust)
│ └── src/
│ ├── lib.rs Program entrypoint + instruction dispatch
│ ├── state.rs Account structs (Registry, Document, Proposal, Vote)
│ ├── instructions/ Handlers (initialize, propose, vote, finalize, gate)
│ ├── error.rs Custom program errors
│ └── constants.rs PDAs, thresholds, tier definitions
│
├── sdk/ Page Builder SDK (TypeScript)
│ └── src/
│ ├── builder.ts Page creation, update, render, export
│ ├── versioning.ts Git-style branching, diffing, merging
│ ├── renderer.ts Markdown/MDX to HTML rendering
│ ├── plugin.ts Extensible plugin lifecycle system
│ ├── schema.ts JSON Schema validation
│ ├── types.ts Core type definitions
│ └── utils.ts Hashing, parsing, formatting helpers
│
├── api/ REST API Server (TypeScript/Express)
│ └── src/
│ ├── routes/ Auth, docs CRUD, proposals, search endpoints
│ ├── middleware/ JWT auth, rate limiting, request validation
│ ├── services/ Docs, consensus, search, storage services
│ └── config.ts Environment configuration
│
├── cli/ CLI Tool (TypeScript)
│ └── src/
│ ├── commands/ init, build, publish, diff, propose, status
│ ├── config.ts Project configuration management
│ └── utils.ts Styled output, spinners, API client
│
└── python-sdk/ Python AI Agent SDK
├── docs_fun/
│ ├── agent.py AI doc writer with template-driven generation
│ ├── client.py Async httpx API client
│ ├── templates.py Pre-built doc templates (API ref, guides, tutorials)
│ ├── types.py Pydantic v2 data models
│ └── utils.py Parsing, hashing, markdown extraction
└── tests/ Unit tests
git clone https://github.com/docsdotfun/docs.fun.git
cd docs.funimport { PageBuilder } from "@docsfun/sdk";
const builder = new PageBuilder({
apiUrl: "https://api.docs.fun/api/v1",
rpcUrl: "https://api.mainnet-beta.solana.com",
defaultFormat: "markdown",
rootDir: "./docs",
plugins: [],
storage: { provider: "ipfs", gateway: "https://gateway.pinata.cloud/ipfs" },
});
await builder.initialize();
// Create a new documentation page
const page = builder.createPage({
title: "Getting Started with Solana",
content: "# Getting Started\n\nLearn how to build on Solana...",
tags: ["solana", "tutorial"],
authors: ["your-wallet-address"],
});
// Render to HTML
const output = await builder.render(page);
console.log(output.html);
console.log(`Reading time: ${output.meta.readingTime} min`);
// Version control -- create a branch, commit changes
builder.createBranch(page.id, "feature/add-examples", "your-wallet");
builder.commitToBranch(
page.id,
"feature/add-examples",
"# Updated content with examples...",
"feat: add code examples",
"your-wallet"
);
// Merge back
const result = builder.mergeBranch(page.id, "feature/add-examples", "your-wallet");
console.log(`Merge successful: ${result.success}`);# Initialize a new docs project
docsfun init --name "my-project"
# Build documentation pages to HTML
docsfun build --clean
# Publish to docs.fun
docsfun publish
# Check differences with published version
docsfun diff docs/index.md --remote
# Submit an edit proposal for community voting
docsfun propose docs/getting-started.md --description "Improve installation steps"
# Check project status
docsfun statusimport asyncio
from docs_fun import DocAgent, AgentConfig
class MyLLM:
async def generate(self, prompt: str, **kwargs) -> str:
# Connect your preferred LLM here
# (OpenAI, Anthropic, local models, etc.)
return await call_your_llm(prompt)
async def main():
agent = DocAgent(
llm=MyLLM(),
config=AgentConfig(
auth_token="your-jwt-token",
auto_publish=True,
),
)
# Generate a complete documentation page
result = await agent.write_doc(
topic="Solana Token Integration",
template="getting-started",
context={"project": "docs.fun", "language": "TypeScript"},
)
print(f"Generated: {result.title}")
print(f"Words: {result.metadata['word_count']}")
print(f"Reading time: {result.metadata['reading_time']} min")
# Batch generate multiple pages
results = await agent.write_batch([
{"topic": "Authentication", "template": "api-reference"},
{"topic": "SDK Setup", "template": "getting-started"},
{"topic": "Architecture", "template": "architecture"},
], concurrency=3)
await agent.close()
asyncio.run(main())sequenceDiagram
participant Author
participant API
participant Solana
participant Community
Author->>API: Submit edit proposal
API->>Solana: Create on-chain proposal
Solana-->>API: Proposal PDA created
loop Voting Period (7 days)
Community->>API: Cast token-weighted vote
API->>Solana: Record vote on-chain
end
Note over Solana: Voting period ends + 1 day grace
Author->>API: Finalize proposal
API->>Solana: Check quorum + approval threshold
alt Approved
Solana-->>API: Document updated on-chain
API->>API: Update content hash
else Rejected
Solana-->>API: Proposal marked rejected
end
| Tier | Balance Required | Capabilities |
|---|---|---|
| Basic | 0 | Read docs, search |
| Contributor | 500+ | Create proposals, vote |
| Editor | 2,500+ | Direct edits, delete docs |
| Admin | 10,000+ | Manage gates, update registry |
Premium features are gated behind token balance thresholds managed by the on-chain program:
graph LR
USER["User Wallet"] --> CHECK{"Token Balance<br/>Check"}
CHECK -->|">= Required"| GRANT["Access Granted"]
CHECK -->|"< Required"| DENY["Access Denied"]
GRANT --> FEATURE["Premium Feature<br/>(Templates, Analytics, etc.)"]
style USER fill:#7C3AED,color:#fff,stroke:none
style CHECK fill:#f59e0b,color:#fff,stroke:none
style GRANT fill:#06B6D4,color:#fff,stroke:none
style DENY fill:#ef4444,color:#fff,stroke:none
style FEATURE fill:#06B6D4,color:#fff,stroke:none
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /auth/challenge |
Get authentication nonce | No |
| POST | /auth/verify |
Verify wallet signature | No |
| GET | /docs |
List documents | Optional |
| GET | /docs/:slug |
Get document by slug | Optional |
| POST | /docs |
Create document | Required |
| PUT | /docs/:slug |
Update document | Required |
| POST | /docs/:slug/publish |
Publish a draft | Required |
| DELETE | /docs/:slug |
Delete document | Editor+ |
| GET | /proposals/:slug |
List proposals | No |
| POST | /proposals |
Create proposal | Contributor+ |
| POST | /proposals/:id/vote |
Cast vote | Required |
| POST | /proposals/:id/finalize |
Finalize proposal | Required |
| GET | /search |
Search documents | No |
docs.fun is open source and welcomes contributions from the community. The same token consensus mechanism that powers the docs platform also governs the project itself -- proposals for significant changes go through community voting.
- Fork the repository
- Create your feature branch
- Submit a pull request with a clear description
- Community reviews and votes
MIT License. See LICENSE for details.
