- Introduction
- Features
- Tech Stack
- Setup
- Usage
- NFT Minting
- API Endpoints
- Database Schema
- Contributing
- License
This project is an online learning platform that allows users to enroll in courses, track their progress, and earn NFTs upon course completion. The platform is built with Next.js and integrates with the Aptos blockchain for NFT minting.
- User authentication and authorization
- Course listing and enrollment
- Progress tracking for enrolled courses
- Chapter-based course structure
- NFT minting upon course completion (Aptos blockchain)
- User dashboard for course and NFT management
- Frontend: Next.js, React
- Backend: API Routes
- Database: PostgreSQL with Prisma ORM
- Authentication: Clerk
- Blockchain: Aptos
- Smart Contract: Move language
- Styling: Tailwind CSS
-
Clone the repository:
git clone https://github.com/yourusername/your-repo-name.git cd your-repo-name
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root directory and add the following:DATABASE_URL="your_postgresql_connection_string" NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="your_clerk_publishable_key" CLERK_SECRET_KEY="your_clerk_secret_key"
-
Run database migrations:
npx prisma migrate dev
-
Deploy the Aptos smart contract: Follow the Aptos documentation to deploy the
CourseCompletionNFT
contract. -
Start the development server:
npm run dev
- Register/Login: Users can sign up or log in using Clerk authentication.
- Browse Courses: View available courses on the homepage.
- Enroll: Users can enroll in courses for free.
- Learn: Access course content and track progress through chapters.
- Complete: After finishing all chapters, mark the course as complete.
- Mint NFT: Users can mint an NFT as proof of course completion.
Upon course completion, users can mint an NFT on the Aptos blockchain. The process is as follows:
- User completes all chapters of a course.
- The "Mint NFT" button becomes available on the course completion page.
- User clicks the button to initiate the minting process.
- The backend verifies course completion and interacts with the Aptos blockchain.
- An NFT is minted and transferred to the user's Aptos wallet.
- The UI updates to show the minted NFT and provides a link to view it on Aptos Explorer.
POST /api/courses/:courseId/enroll
: Enroll in a courseGET /api/courses/:courseId
: Get course detailsPOST /api/courses/:courseId/progress
: Update course progressPOST /api/courses/:courseId/complete
: Mark a course as complete
model User {
id String @id @default(cuid())
name String?
email String @unique
enrollments Enrollment[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Course {
id String @id @default(cuid())
title String
description String?
imageUrl String?
chapters Chapter[]
enrollments Enrollment[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Chapter {
id String @id @default(cuid())
courseId String
title String
content String
order Int
course Course @relation(fields: [courseId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Enrollment {
id String @id @default(cuid())
userId String
courseId String
progress Int @default(0)
isCompleted Boolean @default(false)
user User @relation(fields: [userId], references: [id])
course Course @relation(fields: [courseId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([userId, courseId])
}
We welcome contributions to this project. Please follow these steps:
- Fork the repository
- Create a new branch:
git checkout -b feature-branch-name
- Make your changes and commit them:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature-branch-name
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE.md file for details.