Skip to content

vin-devs/learnsite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LearnHub - Ecommerce Platform for Digital Courses & Books

A modern, full-featured ecommerce platform for buying and learning digital courses and books. Built with Next.js 15, TypeScript, Tailwind CSS, and React.

🌟 Features

  • Comprehensive Product Catalog: 20 diverse courses and 30 educational books across multiple categories
  • Advanced Search & Filtering: Real-time search with category, price range, difficulty level, and rating filters
  • Shopping Cart Management: Persistent cart state using Zustand with add/remove/quantity controls
  • User Authentication: Complete auth system with login, registration, password reset, and session management
  • Multiple Payment Methods: Integrated M-Pesa STK Push and PayPal checkout options
  • User Dashboard: Protected dashboard with purchase history, download management, and progress tracking
  • Responsive Design: Mobile-first design that works seamlessly across all devices
  • Course Management: Detailed course pages with syllabi, learning outcomes, and instructor information
  • Book Library: Rich book collection with descriptions, table of contents, and preview options

πŸ› οΈ Tech Stack

  • Framework: Next.js 15 with App Router
  • Language: TypeScript
  • Styling: Tailwind CSS v4
  • UI Components: shadcn/ui
  • State Management: Zustand (cart state)
  • Authentication: Custom auth context with localStorage persistence
  • Form Handling: React Hook Form + Zod validation
  • API: Next.js Route Handlers
  • Charts: Recharts (for analytics)

πŸ“ Project Structure

``` β”œβ”€β”€ app/ β”‚ β”œβ”€β”€ api/ # API routes for auth, checkout, search, orders β”‚ β”œβ”€β”€ auth/ # Authentication pages (login, register, forgot password) β”‚ β”œβ”€β”€ books/ # Books catalog page β”‚ β”œβ”€β”€ cart/ # Shopping cart page β”‚ β”œβ”€β”€ catalog/ # Full product catalog page β”‚ β”œβ”€β”€ checkout/ # Checkout flow with payment options β”‚ β”œβ”€β”€ courses/ # Courses catalog page β”‚ β”œβ”€β”€ dashboard/ # Protected user dashboard β”‚ β”œβ”€β”€ search/ # Search results page β”‚ β”œβ”€β”€ layout.tsx # Root layout with auth context β”‚ β”œβ”€β”€ page.tsx # Homepage β”‚ └── globals.css # Global styles and design tokens β”œβ”€β”€ components/ β”‚ β”œβ”€β”€ shared/ # Reusable components (navbar, cards, etc.) β”‚ β”œβ”€β”€ checkout/ # Checkout-specific components β”‚ └── auth/ # Auth-specific components β”œβ”€β”€ contexts/ β”‚ └── auth-context.tsx # User authentication context β”œβ”€β”€ store/ β”‚ └── cart.ts # Zustand cart store β”œβ”€β”€ data/ β”‚ └── seed.ts # Mock data for courses and books β”œβ”€β”€ lib/ β”‚ β”œβ”€β”€ types.ts # TypeScript interfaces β”‚ └── utils.ts # Utility functions └── public/ # Static assets and course/book images ```

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation

  1. Clone the repository: ```bash git clone https://github.com/vin-devs/learnsite.git cd learnsite ```

  2. Install dependencies: ```bash npm install ```

  3. Run the development server: ```bash npm run dev ```

  4. Open http://localhost:3000 in your browser

πŸ“– Usage

Browsing Products

  • Visit the Catalog page to see all courses and books
  • Use the Search feature with filters for category, price range, difficulty, and ratings
  • Click on any product to view detailed information

Shopping

  • Click "Add to Cart" to add products to your shopping cart
  • View and manage cart items from the cart icon in the navbar
  • Proceed to checkout when ready

Checkout & Payment

  • Complete the checkout form with shipping and billing information
  • Choose between M-Pesa or PayPal payment methods
  • Confirm payment and receive order confirmation

User Account

  • Register for a new account with email and password
  • Login to access your personal dashboard
  • View your purchased courses and books
  • Download course materials and books
  • Track your learning progress

Admin Testing

  • Use test credentials to explore the authentication flow
  • Mock payment options in checkout for testing different scenarios
  • Access the dashboard to view order history and user profile

πŸ“Š Key Pages

Page Path Description
Homepage / Hero section with featured products and categories
Catalog /catalog Full searchable product listing
Courses /courses Filtered course listing
Books /books Filtered book listing
Search /search Advanced search with filters
Cart /cart Shopping cart management
Checkout /checkout Payment processing
Login /auth/login User login
Register /auth/register New user registration
Dashboard /dashboard Protected user dashboard

πŸ” Authentication

The app uses a context-based authentication system with localStorage persistence:

  • Login/Register: Create accounts with email and password
  • Password Reset: Recover account access via email link
  • Protected Routes: Dashboard and order pages require authentication
  • Session Management: User sessions persist across page refreshes

πŸ’³ Payment Methods

M-Pesa

  • STK Push payment flow
  • Phone number verification
  • Transaction confirmation

PayPal

  • Secure PayPal checkout
  • Multiple payment options
  • Transaction tracking

πŸ›’ Shopping Cart

Built with Zustand for efficient state management:

  • Add/remove products
  • Quantity adjustment
  • Real-time total calculation
  • Persistent cart state

πŸ” Search & Filtering

Advanced search capabilities:

  • Full-text search across titles, descriptions, and authors
  • Category filters (programming, business, health, etc.)
  • Price range filtering
  • Difficulty levels (beginner, intermediate, advanced)
  • Rating filters (4+, 4.5+, 5 stars)
  • Real-time suggestions as you type

πŸ“± Responsive Design

Mobile-first approach with breakpoints for:

  • Mobile (320px+)
  • Tablet (768px+)
  • Desktop (1024px+)

🎨 Design System

Indigo-based color scheme with carefully selected typography:

  • Primary Color: Indigo (#6366f1)
  • Accent Colors: Green and red for actions
  • Neutrals: Slate grays for backgrounds and borders
  • Typography: Clean, readable fonts for optimal user experience

πŸ§ͺ Testing Features

The app includes development testing modes:

  • Mock payment success/failure scenarios
  • Test user credentials
  • Sample order data
  • Development checkout confirmations

πŸ“ Available Scripts

```bash

Development server

npm run dev

Production build

npm run build

Start production server

npm start

Code linting

npm run lint ```

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

πŸ“„ License

This project is open source and available under the MIT License.

πŸ”— Links

πŸ‘¨β€πŸ’» Author

Vincent Mutuku


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors