This is a full-stack AI-powered book library system built using TypeScript. It allows users to upload and manage books, organize them into libraries, and control access levels. The project features a modern admin dashboard, file uploads to Cloudinary, and secure user authentication.
- Upload book files (PDFs) and cover images
- Uploads handled with Cloudinary
- File cleanup handled after upload
- Secure access: only owners can download private books
- Users can create private/public libraries
- Add books to multiple libraries
- Retrieve public libraries
- Access public library details
- Download specific files from library
- User authentication required to manage content
- Public/private control over books and libraries
- Admin-only access to manage specific resources
- Tab-based dashboard UI with Recoil
- Admin pages: Create Books, Manage Books, Libraries
- Realtime visibility control for both books and libraries
- Dashboard provides counts for:
- User's books and libraries
- Global public books and libraries
| Layer | Stack / Tool |
|---|---|
| Frontend | React, TailwindCSS, Recoil, React Router DOM (TypeScript) |
| Backend | Node.js, Express.js (TypeScript) |
| Database | MongoDB, Mongoose |
| Storage | Cloudinary (for images & PDFs) |
| Middleware | Multer, fs, path |
| Auth | JWT-based Authentication |
You can run frontend, backend, and MongoDB in one command using Docker Compose.
- Make sure Docker is installed and running on your machine.
- Rename
.env.simpleto.envinside the backend folder and fill in your credentials:
PORT=3000
MONGO_URL=your_mongodb_uri
JWTSECRET=your_jwt_secret
CLOUDINARY_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret- From the root of the project (where
docker-compose.ymlis), run:
docker-compose up --buildThis command will:
- Build frontend and backend Docker images
- Start MongoDB, backend, and frontend containers
- Expose ports:
3000→ backend5173→ frontend (Vite default)- Automatically handle container dependencies
- Open your browser at:
Frontend: http://localhost:5173
Backend API: http://localhost:3000
- To stop the containers:
docker-compose downYour MongoDB data is persisted in a Docker volume (
mongo_data), so you won’t lose it when stopping containers.
If you prefer running frontend and backend separately, follow the previous instructions:
- Backend:
cd backend
npm install
npm run dev- Frontend:
cd frontend
npm install
npm run dev- Cover images are uploaded to the
coverImages/folder - Book files (PDFs) are uploaded to the
pdfs/folder - Temporary local files are removed after upload
- Ensure Cloudinary credentials are properly set in
.env
- JWT is used for protecting private routes
- Users can only access and modify their own books/libraries
- Admin routes are protected based on user roles
| Tab Key | Description |
|---|---|
AdminDash |
View user + public stats |
create-book |
Upload new books |
AdminBook |
Manage existing books |
BookList |
See all uploaded books |
create-library |
Create a new library |
my-libraries |
View and manage user's libraries |
library-details |
View books in a selected library |
add-books |
Add books to a specific library |
The backend and frontend are fully typed using TypeScript, ensuring:
- Better developer experience
- Fewer runtime errors
- Clean code and maintainability
- Email: [email protected]
- Twitter/X: @inaveed-tw
- LinkedIn: Naveed Khan
- GitHub: inaveed-git
MIT License – see LICENSE
© 2025 Naveed Khan
Have suggestions or want to contribute? Submit a PR or open an issue!