A modern, full-stack university library management platform built with Next.js 15, featuring ML-powered book recommendations, QR code authentication, and comprehensive admin tools.
- Book Catalog: Comprehensive book management with metadata, covers, and availability tracking
- Advanced Search & Filtering: Multi-criteria search by title, author, genre, and availability
- Borrowing System: Shopping cart-style book borrowing with due date management
- Book Requests: Users can request new books for library acquisition
- Favorites System: Personal book collections and wishlist functionality
- Machine Learning Engine: TF-IDF vectorization with cosine similarity for semantic book matching
- Hybrid Recommendation System: ML-based recommendations with TypeScript fallback
- Genre Relationship Mapping: Intelligent genre correlation for better suggestions
- Python API Integration: Dedicated Flask API for ML computations
- Multi-Method Login: Traditional email/password and innovative QR code authentication
- QR Code Login: Cross-device authentication - scan QR code on mobile browser to automatically sign in on desktop
- Role-Based Access Control: USER and ADMIN roles with granular permissions
- Account Approval System: Admin approval workflow for new registrations
- Session Management: JWT-based sessions with NextAuth.js
- User Management: Approve/reject user accounts and monitor activity
- Book Management: Add, edit, and remove books with bulk operations
- Analytics Dashboard: Real-time statistics and activity monitoring
- Request Management: Handle book addition requests from users
- Activity Logging: Comprehensive audit trail of system activities
- Email Workflows: Automated welcome emails and return reminders
- Background Jobs: QStash-powered workflow automation
- Notification System: Toast notifications and email alerts
- Reminder System: Automated book return reminders
- Responsive Web Design: Mobile-responsive layouts that work seamlessly across devices and browsers
- 3D Card Effects: Interactive book cards with depth and hover animations
- Dark Mode Support: Theme switching with system preference detection
- Progressive Loading: Optimized loading states and skeleton screens
- Accessibility: ARIA labels and keyboard navigation support
- Framework: Next.js 15.1.5 with App Router
- UI Library: React 19.0.0 with TypeScript 5.0
- Styling: TailwindCSS 3.4.1 with custom components
- Component Library: Radix UI primitives
- Animations: Framer Motion 12.6.3
- Forms: React Hook Form with Zod validation
- Icons: Lucide React
- Runtime: Node.js with Next.js API routes
- Database: PostgreSQL (Neon) with Drizzle ORM 0.41.0
- Authentication: NextAuth.js v5.0.0-beta.25
- File Storage: ImageKit for media management
- Email Service: Resend for transactional emails
- Background Jobs: Upstash QStash workflows
- ML API: Python Flask with scikit-learn
- Vectorization: TF-IDF for text analysis
- Similarity: Cosine similarity for recommendations
- Deployment: Railway for Python API hosting
- Model Storage: Pickle serialization
- Deployment: Vercel (Frontend) + Railway (ML API)
- Database: Neon PostgreSQL with connection pooling
- CDN: ImageKit for optimized media delivery
- Caching: Upstash Redis for rate limiting and sessions
- Monitoring: Built-in analytics and logging
- Node.js 18+
- Python 3.8+ (for ML features)
- PostgreSQL database
- Git
git clone https://github.com/yourusername/univeristy-library-webapp.git
cd univeristy-library-webapp
# Install Node.js dependencies
npm install
# Install Python dependencies (for ML API)
cd python-api
pip install -r requirements.txt
cd ..
# Generate database schema
npm run db:generate
# Run migrations
npm run db:migrate
# Seed sample data
npm run seed
# Start Next.js app
npm run dev
# Start Python ML API (optional, in separate terminal)
cd python-api
python app.py
The application uses Drizzle ORM with the following main tables:
users
- User accounts and authenticationbooks
- Book catalog and metadataborrow_records
- Borrowing history and statusfavorite_books
- User favoritesbook_requests
- User book requestsqr_login_sessions
- QR authentication sessions
- Train your model using the provided Google Colab notebook
- Export model files:
tfidf_vectorizer.pkl
,genre_relationships.pkl
- Place files in
python-api/models/
directory - Start the Python API for ML-powered recommendations
- Connect your GitHub repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy automatically on push to main branch
- Connect
python-api/
directory to Railway - Set Python environment variables
- Deploy using Railway's automatic deployment
- Create a Neon PostgreSQL database
- Run migrations in production
- Update
DATABASE_URL
in environment variables
- Registration: Sign up with university credentials
- Browse Books: Search and filter available books
- Borrow Books: Add books to cart and borrow
- Get Recommendations: Discover books based on preferences
- Request Books: Request new books for the library
- User Management: Approve/reject user registrations
- Book Management: Add, edit, and remove books
- Monitor Activity: View system analytics and logs
- Handle Requests: Process book addition requests
- Click "QR Code Login" on desktop browser sign-in page
- Enter your email address to generate QR code
- Scan QR code with mobile browser (must be already signed in)
- Confirm authentication on mobile browser
- Desktop browser automatically signs in via real-time polling
POST /api/auth/signin
- User loginPOST /api/auth/signup
- User registrationPOST /api/auth/qr-code
- Generate QR login code
GET /api/books
- Get all booksPOST /api/books
- Create new book (admin)GET /api/books/[id]
- Get specific bookPUT /api/books/[id]
- Update book (admin)
GET /api/ml-recommendations/[bookId]
- Get ML recommendationsGET /api/recommendations/[bookId]
- Get fallback recommendations
GET /api/user/profile
- Get user profilePUT /api/user/profile
- Update user profileGET /api/admin/users
- Get all users (admin)
- ML API may timeout on first request (cold start)
- QR code login requires stable internet connection
- File uploads limited to 10MB per file
- Next.js team for the amazing framework
- Vercel for hosting and deployment
- Neon for managed PostgreSQL
- ImageKit for media management
- Upstash for Redis and background jobs
- All contributors and beta testers