Skip to content

Raisulll/PagePlay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 

Repository files navigation

PagePlay

A comprehensive digital library platform that connects readers, publishers, and administrators in a seamless book discovery and management ecosystem. PagePlay provides an immersive reading experience with advanced features including AI-powered book recommendations, integrated PDF reader, blog system, and multi-role user management.

Table of Contents

Overview

PagePlay is a modern web application designed to revolutionize the digital reading experience. The platform serves three distinct user types—readers, publishers, and administrators—each with tailored functionalities. Built with scalability and performance in mind, PagePlay leverages cutting-edge technologies to deliver a responsive, secure, and feature-rich application.

Key Highlights

  • Multi-tenant architecture supporting three distinct user roles
  • Advanced PDF rendering with interactive reading features
  • AI-powered chatbot for personalized book recommendations
  • Comprehensive blog and review system
  • Real-time transaction processing
  • Secure authentication with Supabase
  • Responsive design optimized for all devices

Features

For Readers

  • Book Discovery: Browse and search through an extensive catalog with advanced filtering by genre, author, rating, and popularity
  • Interactive Reading: Feature-rich PDF reader with zoom, page navigation, bookmarking, and text search capabilities
  • Personal Library: Manage purchased books, reading progress, and favorites in one place
  • Wishlist & Cart: Save books for later and seamless checkout experience
  • Reviews & Ratings: Share opinions and read community feedback
  • Blog System: Create posts, comment, reply, and engage with the reading community
  • AI Chatbot: Get personalized book recommendations powered by Google Gemini AI
  • Reading Challenge: Track reading goals and progress
  • User Profile: Customizable profile with reading statistics and preferences

For Publishers

  • Book Management: Upload, edit, and manage book catalog with metadata and cover images
  • Sales Analytics: Track book performance and revenue
  • Transaction History: Monitor all sales and royalty payments
  • Pending Requests: View books awaiting admin approval
  • Profile Management: Maintain publisher information and branding
  • PDF Preview: Review uploaded content before publication

For Administrators

  • User Management: Monitor and manage all registered users
  • Publisher Oversight: Approve publisher registrations and manage publisher accounts
  • Content Moderation: Review and approve book submissions
  • Transaction Monitoring: Oversee all financial transactions across the platform
  • Report System: Handle user reports and content violations
  • Analytics Dashboard: Comprehensive view of platform metrics and activities
  • Admin Management: Add new administrators with appropriate permissions

Architecture

PagePlay follows a client-server architecture with clear separation of concerns:

┌─────────────────┐
│   React Client  │
│   (Vite Build)  │
└────────┬────────┘
         │
         │ HTTP/REST API
         │
┌────────▼────────┐
│  Express Server │
│   (Node.js)     │
└────────┬────────┘
         │
         ├──────────┬──────────┐
         │          │          │
    ┌────▼───┐  ┌──▼──────┐  ┌▼────────┐
    │PostgreSQL│ │Supabase │  │External │
    │ Database │ │ Storage │  │  APIs   │
    └──────────┘  └─────────┘  └─────────┘

Design Patterns

  • Component-Based Architecture: Reusable React components with shadcn/ui
  • RESTful API Design: Clean, predictable endpoint structure
  • Repository Pattern: Database abstraction layer for data operations
  • Middleware Chain: Authentication, validation, and error handling
  • Responsive Design: Mobile-first approach with Tailwind CSS

Technology Stack

Frontend

  • Framework: React 18.3.1 with TypeScript
  • Build Tool: Vite 6.1.1
  • Routing: React Router DOM 7.1.1
  • UI Components: shadcn/ui (Radix UI primitives)
  • Styling: Tailwind CSS 3.4.17
  • PDF Viewer: react-pdf-viewer 3.12.0
  • Form Management: React Hook Form 7.54.2 with Zod validation
  • State Management: React Context API
  • Icons: Lucide React, React Icons
  • HTTP Client: Fetch API
  • Date Handling: date-fns 3.6.0

Backend

  • Runtime: Node.js
  • Framework: Express.js 4.21.2
  • Database: PostgreSQL with postgres.js driver
  • Authentication: Supabase Auth
  • File Storage: Supabase Storage
  • File Upload: Multer 1.4.5
  • CORS: cors 2.8.5
  • Environment: dotenv 16.4.7
  • Development: nodemon 3.1.9

External Services

  • Authentication & Storage: Supabase
  • AI Integration: Google Gemini API
  • Database Hosting: PostgreSQL (Cloud-based)
  • PDF Processing: pdfjs-dist 3.11.174

Getting Started

Prerequisites

  • Node.js 18.x or higher
  • PostgreSQL 14.x or higher
  • npm or yarn package manager
  • Supabase account
  • Google Gemini API key

Installation

  1. Clone the repository:
git clone https://github.com/Raisulll/PagePlay.git
cd PagePlay
  1. Install frontend dependencies:
cd pagePlay
npm install
  1. Install backend dependencies:
cd ../server
npm install
  1. Configure environment variables:

Create .env file in the pagePlay directory:

VITE_SUPABASE_URL=your_supabase_url
VITE_SUPABASE_SERVICE_ROLE=your_supabase_service_role
VITE_GEMINI_API=your_gemini_api_key

Create .env file in the server directory:

PORT=5000
DATABASE_URL=postgresql://user:password@localhost:5432/pageplay
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_key
  1. Initialize the database:
# Run database migrations (if available)
# Or import the schema manually
  1. Start the development servers:

Terminal 1 (Frontend):

cd pagePlay
npm run dev

Terminal 2 (Backend):

cd server
npm start

The application will be available at:

Project Structure

PagePlay/
├── pagePlay/                    # Frontend application
│   ├── Auth/
│   │   └── SupabaseClient.ts   # Supabase client configuration
│   ├── public/                  # Static assets
│   └── src/
│       ├── admin/               # Admin dashboard components
│       ├── assets/              # Images, fonts, etc.
│       ├── components/          # Reusable UI components
│       │   ├── ui/              # shadcn/ui components
│       │   ├── blog/            # Blog-related components
│       │   ├── BookDetails/     # Book detail view components
│       │   └── pdf-reader/      # PDF viewer components
│       ├── data/                # Static data and constants
│       ├── hooks/               # Custom React hooks
│       ├── lib/                 # Utility functions
│       ├── pages/               # Page components
│       ├── publisher/           # Publisher dashboard components
│       ├── types/               # TypeScript type definitions
│       └── user/                # User-specific components
│
└── server/                      # Backend application
    ├── routes/
    │   ├── auth.js              # Authentication endpoints
    │   ├── userApis.js          # User-related endpoints
    │   ├── publisherApis.js     # Publisher-related endpoints
    │   └── adminApis.js         # Admin-related endpoints
    ├── db.js                    # Database configuration
    ├── storage.js               # Supabase storage utilities
    └── index.js                 # Express server entry point

API Documentation

Authentication Endpoints

POST /auth/signup         - Register new user
POST /auth/login          - User login

User Endpoints

GET  /user/profile        - Get user profile
POST /user/updateProfile  - Update user information
POST /user/addToCart      - Add book to cart
POST /user/payment        - Process book purchase
GET  /user/myBooks        - Get purchased books
POST /user/addReview      - Submit book review
POST /user/AddPosts       - Create blog post
POST /user/likePost       - Like a post
POST /user/addNewComment  - Add comment to post

Publisher Endpoints

POST /publisher/addBook          - Upload new book
GET  /publisher/books            - Get publisher's books
POST /publisher/updateProfile    - Update publisher profile
GET  /publisher/transactions     - Get sales transactions

Admin Endpoints

GET  /admin/users                - List all users
GET  /admin/publishers           - List all publishers
GET  /admin/pendingBooks         - Get books pending approval
POST /admin/approveBook          - Approve book submission
POST /admin/rejectBook           - Reject book submission
GET  /admin/transactions         - View all transactions
GET  /admin/reports              - Get platform reports

User Roles

Reader

Default role for registered users. Can browse books, make purchases, write reviews, create blog posts, and interact with the community.

Publisher

Special role granted by administrators. Can upload and manage books, view sales analytics, and track revenue.

Administrator

Highest privilege level. Full access to platform management, user oversight, content moderation, and system configuration.

Development

Code Style

The project uses ESLint for code quality enforcement:

npm run lint

Component Development

UI components follow the shadcn/ui pattern with Radix UI primitives and Tailwind styling:

import { Button } from "@/components/ui/button"

export function MyComponent() {
  return <Button variant="default">Click me</Button>
}

State Management

React Context API is used for global state:

  • User authentication state
  • Cart management
  • Theme preferences

Styling Guidelines

  • Utility-first approach with Tailwind CSS
  • Responsive breakpoints: sm, md, lg, xl, 2xl
  • Dark mode support (if implemented)
  • Component variants using class-variance-authority

Deployment

Frontend Deployment

The frontend is optimized for deployment on platforms like Vercel or Netlify:

cd pagePlay
npm run build

Build output is generated in the dist/ directory.

Backend Deployment

The backend can be deployed on services like Heroku, Railway, or DigitalOcean:

  1. Ensure environment variables are configured
  2. Set up PostgreSQL database
  3. Deploy using platform-specific commands

Database Setup

  1. Create PostgreSQL database
  2. Run schema migrations
  3. Seed initial data (if required)
  4. Configure connection string in environment variables

Environment Configuration

Ensure all environment variables are properly configured in the production environment:

  • Database connection strings
  • Supabase credentials
  • API keys for external services
  • CORS origins

System Requirements

Functional Requirements

  • Authentication: Secure user registration and login with session management
  • Book Management: Complete CRUD operations for book catalog
  • Reading Interface: PDF rendering with navigation, zoom, and search
  • Social Features: Reviews, ratings, blogs, comments, and likes
  • Transaction Processing: Secure payment handling and order management
  • Content Moderation: Admin approval workflow for books and users
  • AI Integration: Chatbot for personalized recommendations

Non-Functional Requirements

  • Performance: Page load times under 3 seconds
  • Scalability: Support for 10,000+ concurrent users
  • Security: Data encryption, secure authentication, input validation
  • Reliability: 99.9% uptime availability
  • Responsiveness: Mobile-first design for all screen sizes
  • Maintainability: Modular code structure with clear separation of concerns

Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin feature/your-feature
  5. Open a pull request

Please ensure your code follows the existing style and includes appropriate tests.

License

This project is licensed under the ISC License. See the LICENSE file for details.

Authors

  • Md Raisul Islam Rahad

Acknowledgments

  • React and Vite communities for excellent documentation
  • shadcn/ui for beautiful, accessible components
  • Supabase for authentication and storage solutions
  • Google Gemini AI for chatbot capabilities
  • All contributors and testers who helped shape this platform

Support

For issues, questions, or suggestions:

  • Open an issue on GitHub
  • Contact the development team
  • Check the documentation wiki

Built with passion for the reading community.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors