A full-stack digital library platform for discovering books, tracking reading progress, writing reviews, and using AI-assisted study tools.
This repository contains two apps:
client/- Next.js frontendserver/- Express + MongoDB backend
Main features include:
- Book browsing, search, and detail pages
- Authentication and protected routes
- Reading progress tracking and streaks
- Reviews, ratings, bookmarks, and recommendations
- Admin tools for book management and imports
- AI study assistance and smart import workflows
client/- Next.js app router UI, components, hooks, and client stateserver/- API, database models, routes, services, jobs, and scriptsrender.yaml- Render deployment config for the backend
- Node.js 18 or newer
- npm 9 or newer
- MongoDB connection string
- Cloudinary credentials for media uploads
- Gemini API key for AI features
- Redis is optional; when unavailable, AI jobs run inline instead of through a background worker
cd client
npm install
cd ../server
npm installCreate local env files from the examples provided:
client/.env.localserver/.env
Client example:
NEXT_PUBLIC_API_URL=http://localhost:5000Server example:
PORT=5000
NODE_ENV=development
MONGO_URI=your_mongodb_connection_string
JWT_ACCESS_SECRET=your_access_secret
JWT_REFRESH_SECRET=your_refresh_secret
FRONTEND_URL=http://localhost:3000
CORS_ORIGINS=http://localhost:3000
GEMINI_API_KEY=your_gemini_api_key
GEMINI_MODEL=gemini-2.0-flash
GEMINI_EMBEDDING_MODEL=gemini-embedding-001
CLOUDINARY_CLOUD_NAME=your_cloudinary_name
CLOUDINARY_API_KEY=your_cloudinary_key
CLOUDINARY_API_SECRET=your_cloudinary_secret
REDIS_URL=redis://127.0.0.1:6379
PDF_OCR_DPI=220
PDF_OCR_LANG=eng
PDF_TEXT_MIN_WORDS=120
PDF_TEXT_MIN_PAGE_WORDS=18If you do not want to run Redis locally, you can omit REDIS_URL. The server will still start and AI study jobs will execute inline.
Start the backend first:
cd server
npm run devStart the frontend in a separate terminal:
cd client
npm run devBy default, the client runs on http://localhost:3000 and the server runs on http://localhost:5000.
npm run dev- start the Next.js dev servernpm run build- build the frontendnpm run start- start the production frontendnpm run lint- run Next.js linting
npm run dev- start the API in development modenpm run build- compile TypeScriptnpm run start- run the compiled servernpm run lint- type-check without emitting files
The backend is configured for Render using render.yaml. Update the production environment variables in your hosting platform before deployment.
The repository now keeps the core project README only. Refer to the source code, environment examples, and deployment config in the client/ and server/ folders for setup details.
Server endpoint: GET /api/ai-study/:bookId/flashcards?count=8
- Auth: Protected (must include
Authorization: Bearer <token>) - Returns JSON:
{ flashcards: [{ question, answer }], total, cached } - Cached: responses cached for 24 hours in
AIStudyCache.
Client: the AIStudyPanel exposes a new "Flashcards" tab which calls the API when opened. The client hook is useAIStudy(bookId) and returns flashcards under the flashcards key.
Example curl (replace host, token, and book id):
curl -H "Authorization: Bearer <TOKEN>" "http://localhost:5000/api/ai-study/<BOOK_ID>/flashcards?count=8"