Skip to content

gokulbsofficial/Book_Store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Book Store

Description

Book Store is a simple single page application (SPA) that lets you buy, rate and leave your comment for all the books that are available in the store. You can also see all of your purchased books history or create your own favorite books list.

Tech

Book Store uses a number of open source projects to work:

  • MongoDB - Free and open-source cross-platform document-oriented database
  • Mongoose - Elegant MongoDB object modeling for NodeJS
  • NodeJS - Evented I/O for the backend
  • ExpressJS - Fast, unopinionated, minimalist web framework for NodeJS
  • JSONWebToken - Used for authorization
  • Angular - Platform that makes it easy to build applications with the web

The goal of this project is to show the core concepts of building SPA with ExpressJS and Angular. In this project I've used:

  • Wrapped each major feature into a module
  • Lazy-loading for most of the modules so the app can start faster
  • Preload lazy-loaded modules after the app starts so they can be ready for use as soon as possible
  • Shared module for compoennts, directives and pipes that can be imported into any feature module
  • Services for each major feature
  • Guards to prevent unauthorized users to view routes that require authentication or admin rights
  • Interceptors for attaching JWT token to the request headers, showing notifications from the server response and error handling
  • Custom directives
  • Custom pipes
  • TypeScript models
  • Reactive forms for handling user input

Installation

Book Store requires

To start the database (port: 27017): Install MongoDB, open new cmd window (in project root) and run

$ cd server
$ mongod --dbpath=BookStore

To add initial seeding: (do this step once only the first time you start the app) After you start MondoDB open new cmd window (in project root) and run

$ cd server
$ mongoimport --db BookStore --collection books --file books.json

To start the server (port: 5000): open new cmd window (in project root) and run

$ cd server
$ npm install (if you havent already installed the dependencies)
$ npm start

To start the client (port: 3000): open new cmd window (in project root) and run

$ cd client
$ npm install (if you havent already installed the dependencies)
$ ng serve

Features

  • Anonymous users

    • Login/Register
    • View all books
    • View books details, rating and comments
  • Authenticated users

    • Buy books
    • Rate books
    • Comment books
    • View user profiles
    • View his own purchases history
    • Create favorite books list
    • Can change his own avatar
  • Admin users

    • Add books to the store
    • Edit books
    • Delete books
    • Edit/Delete offensive user comments
    • Block/Unblock user from commenting
    • Change unappropriate user avatars