> ## Documentation Index
> Fetch the complete documentation index at: https://docs.learnway.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> LearnWay is a gamified, blockchain-integrated Learning Management System (LMS) backend powering education with XP, gems, badges, live competitions, and real on-chain rewards.

# Welcome to LearnWay Backend

LearnWay is a comprehensive backend service that powers a next-generation learning platform. Built with NestJS on Node.js, it combines traditional course management with cutting-edge features: blockchain-backed rewards, AI tutoring, competitive quiz battles, and a rich gamification layer.

<CardGroup cols={2}>
  <Card title="Quick Start" icon="rocket" href="/quickstart">
    Get the server running locally in under 10 minutes
  </Card>

  <Card title="Architecture Overview" icon="sitemap" href="/architecture/overview">
    Understand how all systems fit together
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/overview">
    Browse every endpoint with examples
  </Card>

  <Card title="Environment Variables" icon="gear" href="/guides/environment-variables">
    Configure your environment correctly
  </Card>
</CardGroup>

***

## What LearnWay Does

LearnWay is more than an LMS. It is a **learn-and-earn** platform where users complete structured learning paths, compete in quiz battles, and earn verifiable on-chain recognition (XP points, in-app Gems, NFT badges, and Course Certificates) for their progress.

### Core Feature Areas

<AccordionGroup>
  <Accordion title="📚 Courses & Learning Paths">
    Hierarchical content structure: **Learning Paths → Courses → Lessons →
    Slides**. Admins publish content through the admin API; users consume it
    through the user API. Both premium and free tiers are supported via the
    subscription system.
  </Accordion>

  <Accordion title="🤖 AI Features">
    * **AI Tutor**: Powered by Google Gemini. Users can ask the AI tutor
      questions about any lesson, get explanations, summaries, quiz hints, and
      more. Responses are Redis-cached per lesson for 24 h. - **AI Assessment**: A
      personalised onboarding quiz that evaluates a new user's existing skill
      level and recommends an appropriate learning path. - **Career Roadmap
      Generator**: Given a career goal, the system generates a structured roadmap
      of learning paths and courses.
  </Accordion>

  <Accordion title="🏆 Gamification">
    * **XP & Gems**: Earned by completing lessons, quizzes, battles, and
      contests. Computational gamification values powering levels, leaderboards, streak freezes, and battle stakes. - **Badges**: ERC-721 NFT badges minted on-chain when milestone thresholds
      are hit. - **Leaderboard**: Weekly and monthly global and category
      leaderboards. - **Contests**: Time-boxed competitive events with prize
      pools. - **Quiz Battles**: Real-time 1-v-1 or bot-assisted quiz battles via
      WebSocket.
  </Accordion>

  <Accordion title="⛓️ Blockchain Integration">
    LearnWay runs on **Lisk L2** (OP Stack rollup). XP and Gems are managed by custom on-chain gamification and accounting state contracts (`XPContract` and `GemContract`); badges are ERC-721 NFTs and course certificates are ERC-1155 credentials. All contracts are coordinated by `LearnWayManager` and governed by `LearnWayAdmin`.
  </Accordion>

  <Accordion title="💳 Payments">
    Users can on-ramp fiat to USDT / fUSD via **Fonbnk**, a mobile-money gateway. Supported fiat currencies include NGN,
    KES, GHS, UGX, ZAR, and BRL.
  </Accordion>

  <Accordion title="🔔 Notifications">
    Push notifications via Firebase Cloud Messaging (FCM), in-app notifications
    via WebSocket, email via Resend, and admin-targeted notification campaigns.
  </Accordion>

  <Accordion title="🎓 Certificates">
    On-chain certificates are minted when a user completes a
    certificate-eligible course. Certificate metadata is stored on IPFS and the
    NFT is minted via the `LearnwayManager` contract.
  </Accordion>
</AccordionGroup>

***

## Tech Stack at a Glance

| Layer          | Technology                                           |
| -------------- | ---------------------------------------------------- |
| Framework      | NestJS (Node.js + TypeScript)                        |
| Database       | PostgreSQL via TypeORM                               |
| Cache          | Redis (cache-manager + Bull queues)                  |
| WebSockets     | Socket.IO with Redis adapter                         |
| Auth           | Passport.js + JWT (access + refresh tokens)          |
| Blockchain     | Ethers.js v6 — Lisk L2 (EVM)                         |
| AI             | Google Gemini API                                    |
| Email          | Resend                                               |
| Media          | ImageKit                                             |
| Payments       | Fonbnk                                               |
| Subscriptions  | RevenueCat                                           |
| Client         | Flutter (BLoC pattern + Clean Architecture)          |
| Client wallet  | Ethers.js, variance\_dart + web3Signers + MPC wallet |
| Error Tracking | Sentry                                               |
| Docs           | Swagger (auto-generated) + this site                 |

***

## API Versioning

All endpoints are prefixed with `/api/v2/`. There are two separate Swagger UIs:

* **User API** — [`https://learnway-backend-dev.up.railway.app/api/v2/docs#/`](https://learnway-backend-dev.up.railway.app/api/v2/docs#/) (Local: `/api/v2/docs`)
* **Admin API** — [`https://api.learnway.app/api/v2/admin-docs#`](https://api.learnway.app/api/v2/admin-docs#) (Local: `/api/v2/admin-docs`)

Authentication uses **Bearer JWT** tokens on all protected routes.
