Skip to content

Latest commit

 

History

190 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📚 Book API Project

A full-stack web application for managing books, users, and reviews.

🛠️ Technologies

  • Backend: Node.js, Express, MongoDB, Mongoose
  • Frontend: Vue 3 (Composition API), Vite
  • Authentication: JSON Web Tokens (JWT)
  • Styling: SCSS

📦 Database Models

Users

{
  username: String,
  password: String,
  is_admin: Boolean,
  created_at: Date
}

Books

{
  title: String,
  description: String,
  author: String,
  genres: [String],
  image: String,
  published_year: Number,
  reviews: [ObjectId]
}

Reviews

{
  name: String,
  content: String,
  rating: Number,
  created_at: Date
}

🔗 API Endpoints

👤 Users

Method Endpoint Description Auth Required

  • GET /users Retrieve all users ❌
  • GET /users/:id Get a specific user by ID ❌
  • PATCH /users/:id Update a user ✅
  • DELETE /users/:id Delete a user ✅

📚 Books

  • GET /books – Get all books
  • GET /books/:id – Get a single book (with reviews)
  • POST /books – Create a new book (auth required)
  • PATCH /books/:id – Update a book (auth required)
  • DELETE /books/:id – Delete a book (auth required)

📝 Reviews

  • GET /reviews – Get all reviews
  • GET /reviews/:id – Get a single review
  • POST /reviews – Submit a review
  • PATCH /reviews/:id – Update a review (auth required)
  • DELETE /reviews/:id – Delete a review (auth required)

🖥️ Frontend Pages

  • 📖 Book List – Shows all books with title, image, and author
  • 📄 Book Details – View book info and associated reviews
  • ✍️ Review Form – Submit a review to a book
  • 🔐 Login/Register – Authentication forms
  • 🛡 Admin Panel – View all users (admin access only)

🔐 Environment Variables

Backend – .env

Create a .env file in the root of your backend folder with the following:

MONGODB_URL=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret

Descriptions:

  • MONGODB_URL: The connection string to your MongoDB database.
  • JWT_SECRET: A secret key used to sign and verify JWT tokens.

⚠️ Never commit your actual credentials to a public repository.

Frontend – .env

Create a .env file in the root of your frontend folder with:

VITE_API_URL=http://localhost:3000/

Description:

  • VITE_API_URL: The base URL for your backend API.

Change this to your production API URL when deploying.

👥 Team & Contributions

This project was built in a group where we divided different areas:

  • User system & authentication: @TeaGross Tea
  • Books & admin view: @DulamaA Antonina
  • Reviews: @amandawiktorsson Amanda

We collaborated closely to get the backend and frontend connected effectively.

About

A full-stack web application for managing books, users, and reviews. (Medieinstitutet group project for API course))

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages