Skip to content

An online shop website. Developed in Node.js, Ejs, MongoDB, Jest(for unit and integrated testing) and Selenium(for end-to-end tests).Project done adhering to best node.js and general programming practices.Incoporates MPESA daraja API for online payment, SendGrid for email sending and Twillio for sms sending

License

Notifications You must be signed in to change notification settings

samuelmaina/sokoni

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sokoni

Sokoni is a swahili word for 'market'. Sokoni is a web-based online shop written in Node.js with Ejs.
The application has the normal online shopping functionality but controls impulsive buying behavior of customers by restricting their spending. This is enabled by periodical account recharge and tracking of currently cart products and totals.
Jest had been used for unit and intergration tests while Selenium has been employed for end-to-end tests.

How the App works

There are two users of the application, sellers(admins) and customers.
Sellers can add , edit and delete products from the application. They can also view their sales which are shows through dashboards with a variety of charts.
Customers buy products from the shop and see their purchases. They top up their balance at their own convinience which is later deduced during shopping. They are shown the current purchasd items.They can also download invoices as pdf. They have a dashboard showing their current balance and details.

Other Features

  • The home page, product page and pages for different categories have accurate paginations(first page,next page, prev, last page).
  • Good feedback message. Success messages are shown in green,errors shown in red and notifications are shown in blue.
  • Ultimate validation and standardization of input and output data.
  • Incorporation of email for signup and reset confirmations, sms for phone number validation.
  • Mobile phone payment integration using M-PESA.

Technologies used

Node.js .
Ejs
Jest for unit and integration testing.
Selenium for End-to-End testing.
Mongo DB database.
Mongoose for Object Document Mapping.
Cloudinary for image hosting.
Sendgrid for email sending.
Twillio for sms sending(used mostly for confirming telephone numbers). MPesa (a mobile transfer platform in Eastern Africa) for account recharge.

Other technological implementation

  • Resused most page login,sign-up
  • Comprehensive unit, integration and end-to-end tests
  • Small and single purpose functions, classes, routes, controllers.
  • Use of some design patterns such as builder pattern.

Running the automated tests

  • Some tests are failing but most are passing. Includes unit, integrated and e2e testing.
  • Can watch the video from the youtube video https://youtu.be/ata3ngksGGU cropped

Some Parts of the Application

The home page

homepage

A logged in customer page

logged_in_user

Showing the current cart total and the current total balance when adding product to cart

showing_the_current_balance_and_total

Refusing to add to cart when the cart total exceeds the balance

refusing_to_add_to_cart_when_balance_is_low

Product in cart

products_in_the_cart

Downloading the invoice as pdf

downloading_invoice_as_pdf



The Admin Page

admin_products

Adding Product

Admin_adding_Products

Admin Sales

Sales_Presentation

Running the application

  1. clone the repository
  2. put all key-values pairs for all the fields exported in the src/config/env.js file in a .env file such as MONGO_URI
  3. run npm install
  4. npm start
  5. Open the browser at http://localhost:3000/ (in my case,3000 was set as the PORT number in the .env file. Put your port as the port number when opening in the browser)

Running tests

  1. create an empty MongoDB database, say test.
  2. Put the name of the database in the MONGO_TEST_URI field in the .env file.
  3. Download chrome driver for your chrome version and include the path where one has unziped it in the PATH in the system. The chrome driver is used to run end-to-end tests
  4. Run npm test

About

An online shop website. Developed in Node.js, Ejs, MongoDB, Jest(for unit and integrated testing) and Selenium(for end-to-end tests).Project done adhering to best node.js and general programming practices.Incoporates MPESA daraja API for online payment, SendGrid for email sending and Twillio for sms sending

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published