Skip to content

inaveed-git/lib-mern-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📚 MyShelf Library System

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.


📸 Screenshots

Chat UI Preview Chat UI Preview Chat UI Preview Chat UI Preview


✅ Features

Book Management

  • Upload book files (PDFs) and cover images
  • Uploads handled with Cloudinary
  • File cleanup handled after upload
  • Secure access: only owners can download private books

Library Management

  • Users can create private/public libraries
  • Add books to multiple libraries
  • Retrieve public libraries
  • Access public library details
  • Download specific files from library

Authentication & Authorization

  • User authentication required to manage content
  • Public/private control over books and libraries
  • Admin-only access to manage specific resources

Dashboard (Frontend)

  • Tab-based dashboard UI with Recoil
  • Admin pages: Create Books, Manage Books, Libraries
  • Realtime visibility control for both books and libraries

Stats & Analytics

  • Dashboard provides counts for:
    • User's books and libraries
    • Global public books and libraries

📦 Technologies Used

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

Getting Started

🔹 Using Docker Compose (Recommended)

You can run frontend, backend, and MongoDB in one command using Docker Compose.

  1. Make sure Docker is installed and running on your machine.
  2. Rename .env.simple to .env inside 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
  1. From the root of the project (where docker-compose.yml is), run:
docker-compose up --build

This command will:

  • Build frontend and backend Docker images
  • Start MongoDB, backend, and frontend containers
  • Expose ports:
    • 3000 → backend
    • 5173 → frontend (Vite default)
  • Automatically handle container dependencies
  1. Open your browser at:
Frontend: http://localhost:5173
Backend API: http://localhost:3000
  1. To stop the containers:
docker-compose down

Your MongoDB data is persisted in a Docker volume (mongo_data), so you won’t lose it when stopping containers.


💻 Manual Setup (Optional)

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

☁️ Cloudinary Notes

  • 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

🛡️ Authentication & Security

  • 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

📊 Dashboard Tabs

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

🧪 Built With TypeScript

The backend and frontend are fully typed using TypeScript, ensuring:

  • Better developer experience
  • Fewer runtime errors
  • Clean code and maintainability

📬 Contact


📜 License

MIT License – see LICENSE

© 2025 Naveed Khan


🤝 Contributing

Have suggestions or want to contribute? Submit a PR or open an issue!

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages