Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

NoteBazar

Bangladesh's first digital student notes marketplace — buy, sell, and download high-quality academic materials with a secure wallet-based payment system.


Overview

NoteBazar connects students across Bangladesh's universities. Sellers upload PDFs of their notes, past papers, and lecture summaries. Buyers browse, purchase with wallet credits, and instantly download watermarked copies. A 10% platform fee is deducted on every sale; sellers receive the remaining 90% directly to their in-app wallet and can withdraw to bKash.


Features

For Buyers

  • Full-text search by title, description, or course code
  • Filter by university, department, and course
  • Preview listing details, seller rating, and reviews before purchasing
  • One-click purchase using wallet balance
  • Watermarked PDF download after purchase
  • Leave a star rating and written review on purchased items
  • Report low-quality or inappropriate content

For Sellers

  • Upload PDF notes with a cover image and metadata

  • Set your own price (minimum ৳20)

  • Subscription-based listing limits (rolling 30-day window):

    Plan Listings / 30 days
    Free 3
    Starter 10
    Pro 20
  • Monitor downloads, ratings, and earnings per listing

  • Withdraw earnings to bKash (minimum ৳100)

For Admins

  • Dashboard with revenue, user, and transaction metrics
  • Approve or reject bKash recharge and withdrawal requests
  • Review and action user-submitted content reports
  • Manage users: ban, verify, and update roles

Tech Stack

Layer Technology
Frontend React 19 + React Router v7
Build Vite 8
Styling Tailwind CSS v4 + CSS custom properties
Backend Supabase (PostgreSQL, Auth, Storage)
PDF Handling pdfjs-dist v5
Analytics Vercel Analytics & Speed Insights
Deployment Vercel
Testing Vitest + @testing-library/react

Project Structure

notebazar/
├── src/
│   ├── components/        # Shared UI (Navbar, ListingCard, SkeletonCard, …)
│   ├── hooks/             # Custom hooks (useAuth, useListings, useWallet, useReviews)
│   ├── lib/               # Supabase client, contexts (Auth, Theme, Toast), utilities
│   ├── pages/             # Route-level pages
│   │   ├── admin/         # Admin dashboard (Dashboard, Reports, Withdrawals, Users)
│   │   └── …              # Home, Browse, Upload, Wallet, Profile, Auth pages
│   └── __tests__/         # Unit & integration tests
├── supabase/
│   └── schema.sql         # Full PostgreSQL schema — run once in Supabase SQL Editor
├── public/
├── vercel.json
└── vite.config.js

Getting Started

Prerequisites

1. Clone & Install

git clone https://github.com/your-username/notebazar.git
cd notebazar
npm install

2. Configure Environment Variables

Copy the example file and fill in your values:

cp .env.example .env
VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your-anonymous-api-key

Get these from your Supabase project under Settings → API. All variables must use the VITE_ prefix to be exposed to the browser via import.meta.env.

3. Set Up the Database

Run supabase/schema.sql in the Supabase SQL Editor. This creates all tables, RLS policies, storage buckets, and stored procedures.

To grant yourself admin access:

UPDATE public.profiles SET is_admin = true WHERE email = 'your@email.com';

4. Start the Dev Server

npm run dev

The app runs at http://localhost:5173.


Available Scripts

Script Description
npm run dev Start development server
npm run build Build for production
npm run preview Preview production build locally
npm run test Run tests once
npm run test:watch Run tests in watch mode
npm run test:coverage Generate coverage report
npm run lint Run ESLint

Database Schema

Key tables:

Table Purpose
profiles User accounts, wallet balance, subscription tier
listings Notes for sale — price, file URL, ratings summary
transactions Full payment ledger (recharge, purchase, earning, withdrawal)
orders Purchase records with watermark metadata and download URL
reviews Star ratings and comments (one per user per listing)
reports Content moderation queue
withdrawals Seller cashout requests

Notable database features:

  • Full-text search on listings via tsvector with English stemming
  • Row-level security (RLS) on every table — users access only their own data; admins see all
  • Atomic purchase procedure (purchase_listing) — splits the platform fee, creates the order, and writes the watermark text in a single transaction
  • Auto-rating trigger — recalculates a listing's average rating on every review insert, update, or delete
  • Listing limit enforcement (check_listing_limit) — blocks uploads when a seller's plan limit is reached

Storage Buckets

Bucket Access Max Size Contents
notes Private 10 MB Uploaded PDFs (accessible only to seller and buyers after purchase)
images Public 5 MB Cover images and PDF thumbnails

Deployment

The project is configured for one-click Vercel deployment.

  1. Push the repository to GitHub (.env is gitignored and never committed).
  2. Import the project in the Vercel dashboardAdd New Project.
  3. Add VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY under Environment Variables.
  4. Click Deploy — Vercel auto-detects Vite and applies the correct build settings.

vercel.json rewrites all unmatched paths to /index.html so direct navigation to routes like /listing/123 or /admin works correctly.


Theme System

Light and dark modes are supported out of the box. Themes are controlled via CSS custom properties (--nb-*) applied to the <html> element. The active theme is stored in localStorage with a system-preference fallback, and toggled through ThemeContext in src/lib/ThemeContext.jsx.


Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Commit your changes following the existing commit style
  4. Open a pull request against master

Please run npm run lint and npm run test before submitting.

About

Bangladesh's first digital student notes marketplace — buy, sell, and download high-quality academic materials with a secure wallet-based payment system.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages