Code Monkey home page Code Monkey logo

book-store's Introduction

LoveBook

Table of contents

Introduction

A Book ecommerce website using Node js, Expressjs,EJS and Mongoose.

Demo

  • User Page screenshot
  • Admin Page screenshot

The application is deployed to Heroku and can be accessed through the following link:

LoveBook on Heroku

  • Test User Credentials
  • Test Admin Credentials
  • Test Stripe Card Details
    • Card Number: 4242 4242 4242 4242
    • Expiry: Any Future Month
    • CVV: Any three Digit Number

Run

To run this application, you have to set your own environmental variables. For security reasons, some variables have been hidden from view and used as environmental variables with the help of dotenv package. Below are the variables that you need to set in order to run the application:

  • MONGO_URI: this is the connection string of your MongoDB Atlas database.

  • JWT_KEY: a secret jsonwebtoken

  • STRIPE_SECRET_KEY: the stripe package is used to process payment in the checkout route. To get this, you should set up a stripe account and put your private API key here.

  • USER_EMAIL, USER_PASSWORD: the email and password to login to home page

  • ADMIN_EMAIL, ADMIN_PASSWORD: the email and password used to log into the admin panel using Now you can run "npm run start" in the terminal and the application should work.

Technology

The application is built with:

  • Node.js
  • MongoDB
  • Express
  • EJS
  • Bootstrap
  • FontAwesome
  • Stripe API
  • Multer: used to upload file
  • Jsonwebtoken: used for authentication
  • Validator: used for form validation
  • nodemailer: used for send email
  • And many other package

Features

The application displays a virtual bags store that contains virtual products and contact information.

Users can do the following:

  • Create an account, login or logout
  • Browse available products added by the admin
  • Add products to the shopping cart
  • Delete products from the shopping cart
  • Display the shopping cart
  • To checkout
  • Checkout information is processed using stripe and the payment is send to the admin
  • The profile contains all the orders a user has made -upload image profile Admins can do the following:
  • Send email to reset password
  • Login or logout to the admin panel
  • View all the information stored in the database. They can view/add/edit/delete orders, users, products . The cart model cannot be modified by an admin because a cart is either modified by the logged in user before the purchase or deleted after the purchase.

Database

All the models can be found in the models directory created using mongoose.

User Schema:

  • name (String)
  • email (String)
  • password (String)
  • passwordConfirm(String)
  • photo(String)
  • createdAt (Date)

Book Schema:

  • id (String)
  • book (ObjectId - a reference to the Review schema)
  • name (String)
  • author (String)
  • price (String)
  • description (String)
  • percentSale
  • img (String)
  • priceafterSale (Number)
  • category (String)
  • slug (String)
  • rating (Boolean)
  • createdAt (Date)

Review Schema:

  • book (ObjectId - a reference to the Book schema)
  • pushlishDate (String)
  • sizeWidth (Number)
  • sizeHeight (Number)
  • chapter (Number)
  • coverImage (String)
  • pageNumber (Number)
  • weight(Number)
  • introduction: String,
  • createdAt (Date)

Cart Schema:

  • book (ObjectId - a reference to the Book schema)
  • user (ObjectId - a reference to the User schema)
  • createdAt (Date)

Order Schema:

  • user (ObjectId - a reference to the user schema)
  • book (ObjectId - a reference to the book schema)
  • createdAt (Date)
  • paid (Boolean)

book-store's People

Contributors

thanhhiep206 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.