A comprehensive multi-platform application for community book sharing and management.
- Multi-step Registration: Personal info, family/community details, security setup
- Multi-persona Support: Users can be Publishers, Borrowers, or Administrators
- OTP Verification: Email and SMS verification with resend functionality
- Admin Approval: Manual review and approval process for new users
- Secure Authentication: JWT-based auth with refresh tokens
- Book Publishing: Scan barcodes to add books to the library
- Book Discovery: Search and browse available books
- Rental System: Request and manage book rentals
- Digital Wallet: Track balances and automated fine calculations
- Publisher (Lender): Individuals who lend books to the community
- Borrower: Users who borrow books from publishers
- Administrator: System managers who approve users and oversee operations
- Mobile App: React Native for iOS and Android
- Web Application: Responsive React.js web app
- Admin Dashboard: Comprehensive user and system management
Community Library enables users to lend and borrow books within their community through three main personas:
- Publishers (Lenders): Add books via barcode scanning, manage lending
- Borrowers: Discover and borrow books, manage digital wallet
- Administrators: Approve books, manage users, oversee transactions
Community Library Project/
βββ mobile/ # React Native mobile app
β βββ src/
β β βββ components/ # Shared mobile components
β β βββ screens/ # Mobile screens
β β β βββ RegisterScreen.js
β β β βββ OTPVerificationScreen.js
β β β βββ ApprovalPendingScreen.js
β β βββ navigation/ # Navigation setup
β β βββ utils/ # Mobile utilities
β βββ package.json
β βββ README.md
βββ web/ # React.js web application
β βββ src/
β β βββ components/ # Shared web components
β β βββ pages/ # Web pages
β β β βββ RegisterPage.js
β β β βββ OTPVerificationPage.js
β β β βββ ApprovalPendingPage.js
β β β βββ AdminDashboard.js
β β βββ hooks/ # Custom hooks
β β βββ utils/ # Web utilities
β βββ package.json
β βββ README.md
βββ backend/ # Node.js/Express API server
β βββ src/
β β βββ models/ # Database models
β β β βββ User.js # User schema with verification & approval
β β β βββ OTP.js # OTP management schema
β β βββ routes/ # API routes
β β β βββ auth.js # Authentication endpoints
β β β βββ admin.js # Admin management endpoints
β β βββ middleware/ # Custom middleware
β β β βββ auth.js # JWT & role-based authorization
β β βββ services/ # Business logic services
β β β βββ authService.js # Registration, OTP, login logic
β β β βββ emailService.js # Email notifications
β β β βββ smsService.js # SMS notifications
β β β βββ adminService.js # User management
β β βββ utils/ # Backend utilities
β βββ package.json
β βββ README.md
βββ shared/ # Shared code and utilities
β βββ components/ # Cross-platform components
β βββ types/ # TypeScript definitions
β βββ utils/ # Shared utilities
β βββ validations/ # Validation schemas
βββ docs/ # Documentation
βββ api/ # API documentation
βββ deployment/ # Deployment guides
βββ architecture/ # Architecture diagrams
- π± Cross-Platform: Native mobile apps + responsive web
- π Authentication: Email/phone registration with OTP verification and admin approval
- π Book Management: Barcode scanning for easy book publishing
- π Discovery: Search and filter books by location, genre, availability
- π³ Digital Wallet: Manage balance, payments, and automated fines
- π¨βπΌ Admin Dashboard: User management, book approvals, transaction oversight
- Multi-step Registration: Personal, family/community, and security information
- Dual Verification: Email and SMS OTP verification with resend capability
- Admin Approval Process: Manual review by administrators before account activation
- Status Tracking: Real-time progress indication for users
- Role-based Access: Publisher, Borrower, Administrator personas
- Account States: Pending, Approved, Rejected, Blocked status management
- Admin Dashboard: Comprehensive user approval and management interface
- Notification System: Email and SMS notifications for status changes
- π Real-time Updates: Socket.io for live notifications
- π Analytics: User engagement and book popularity tracking
- π Security: JWT authentication, data encryption, input validation
- π° Payments: Stripe integration for wallet transactions
- π§ Notifications: Email and SMS via Nodemailer/Twilio
- π± PWA Support: Offline capabilities for web app
sequenceDiagram
participant U as User
participant App as Mobile/Web App
participant API as Backend API
participant DB as Database
participant Email as Email Service
participant SMS as SMS Service
participant Admin as Administrator
U->>App: Fill registration form
App->>API: POST /api/auth/register
API->>DB: Create user (pending verification)
API->>Email: Send OTP via email
API->>SMS: Send OTP via SMS
API->>App: Registration successful
U->>App: Enter OTP
App->>API: POST /api/auth/verify-otp
API->>DB: Update user (verified, pending approval)
API->>App: Verification successful
Admin->>API: Review pending users
Admin->>API: Approve/Reject user
API->>DB: Update user status
API->>Email: Send approval/rejection notification
API->>SMS: Send approval/rejection notification
- Pending Users: List of users awaiting approval with detailed information
- User Management: Approve, reject, block, or unblock users
- Dashboard Statistics: Total users, pending approvals, registration trends
- Batch Operations: Manage multiple users simultaneously
- Step 1: Personal Information (name, email, phone)
- Step 2: Family & Community (parent name, community)
- Step 3: Security & Role (password, persona selection)
- Dual Method: Email and SMS verification options
- Auto-resend: Automatic OTP resend with countdown timer
- Method Switching: Toggle between email and SMS verification
- Input Validation: Real-time OTP format validation
- Progress Tracking: Visual indication of registration progress
- Timeline: Expected approval timeline with status updates
- Support Access: Direct contact to support team
- User Overview: Comprehensive user statistics and metrics
- Pending Approvals: Table view of users awaiting approval
- User Details: Detailed user information modal
- Action Management: Approve, reject, block operations with confirmation
- Search & Filter: Find users by status, role, registration date
- Responsive Design: Mobile-first design for all screen sizes
- Form Validation: Real-time validation with clear error messages
- Multi-step Process: Clean step-by-step registration flow
- Accessibility: WCAG compliant with keyboard navigation
- Node.js 18+ and npm
- MongoDB (local or cloud)
- Expo CLI for mobile development
- Git
-
Clone the repository
git clone <repository-url> cd community-library
-
Install dependencies
npm run install:all
-
Set up environment variables
# Backend cp backend/.env.example backend/.env # Edit backend/.env with your configuration # Web cp web/.env.example web/.env # Edit web/.env with your configuration
-
Start development servers
# Terminal 1 - Backend API npm run dev:backend # Terminal 2 - Web App npm run dev:web # Terminal 3 - Mobile App npm run dev:mobile
- Backend API: http://localhost:5000
- Web App: http://localhost:3000
- Mobile App: Expo DevTools will open automatically
The mobile app uses Expo for cross-platform development:
cd mobile
npx expo start
# Run on specific platforms
npx expo start --android
npx expo start --iosThe web app is a React.js application with Material-UI:
cd web
npm startThe backend is a Node.js/Express API with MongoDB:
cd backend
npm run devbackend/
βββ src/
β βββ controllers/ # Request handlers
β βββ models/ # Database models
β βββ routes/ # API routes
β βββ middleware/ # Custom middleware
β βββ services/ # Business logic
β βββ utils/ # Helper functions
β βββ server.js # App entry point
βββ tests/ # Test files
βββ uploads/ # File uploads
web/
βββ public/ # Static assets
βββ src/
β βββ components/ # Reusable components
β βββ pages/ # Page components
β βββ hooks/ # Custom React hooks
β βββ services/ # API services
β βββ contexts/ # React contexts
β βββ utils/ # Helper functions
β βββ App.js # App entry point
βββ build/ # Production build
mobile/
βββ src/
β βββ components/ # Reusable components
β βββ screens/ # Screen components
β βββ navigation/ # Navigation config
β βββ services/ # API services
β βββ hooks/ # Custom hooks
β βββ contexts/ # React contexts
β βββ utils/ # Helper functions
βββ assets/ # Images, fonts, etc.
βββ App.js # App entry point
shared/
βββ src/
β βββ validation/ # Validation schemas
β βββ utils/ # Common utilities
β βββ constants/ # App constants
β βββ types/ # TypeScript types
βββ index.js # Exports
MONGODB_URI=mongodb://localhost:27017/community-library
JWT_SECRET=your-jwt-secret
STRIPE_SECRET_KEY=sk_test_...
TWILIO_AUTH_TOKEN=your-twilio-token
EMAIL_PASS=your-email-password
REACT_APP_API_URL=http://localhost:5000/api
REACT_APP_STRIPE_PUBLISHABLE_KEY=pk_test_...
# Run all tests
npm test
# Run tests for specific workspace
npm run test --workspace=backend
npm run test --workspace=web
npm run test --workspace=mobile- Deploy to Heroku, Railway, or similar
- Set environment variables
- Configure MongoDB Atlas
- Build:
npm run build:web - Deploy to Vercel, Netlify, or similar
- Configure environment variables
- Build:
npx expo build:android/npx expo build:ios - Deploy to Google Play Store / Apple App Store
POST /api/auth/register- User registrationPOST /api/auth/login- User loginPOST /api/auth/verify-otp- OTP verificationPOST /api/auth/refresh- Refresh token
GET /api/books- List booksPOST /api/books- Create bookPUT /api/books/:id- Update bookDELETE /api/books/:id- Delete book
GET /api/users/profile- Get user profilePUT /api/users/profile- Update profileGET /api/users/wallet- Get wallet balance
POST /api/transactions/borrow- Borrow bookPOST /api/transactions/return- Return bookGET /api/transactions/history- Transaction history
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For questions or support, please open an issue on GitHub or contact the development team.
Community Library Team π