Skip to content

atlp-rwanda/e-commerce-mavericcks-bn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reviewed by Hound .github/workflows/main.yaml Coverage Status Version Code Climate maintainability Test Coverage

NodeJS Express.js Static Badge Static Badge Static Badge Static Badge Swagger

e-commerce-mavericcks-bn

Backend for team Maverick's e-commerce website

Table of Contents

  1. Project Overview
  2. User Categories/Roles
  3. Features found on the platform
  4. Tech Stack
  5. Installation
  6. Pivotal Tracker with GitHub Best Practices
  7. Setting up Swagger Documentations

Project Overview

A platform providing a marketplace for buyers and sellers to meet:

The platform serves as a meeting point for buyers and sellers, where each seller operates a virtual "stall" showcasing their products. Sellers have full control over their inventory, allowing them to manage stock levels, adjust prices, and offer discounts. Despite similarities, different sellers can offer identical items.

Shoppers can freely navigate between stalls to find the best deals, selecting items from various sellers and adding them to their shopping bag. They can modify their bag's contents as they browse. Payments are processed at checkout, and items can be returned to the stall before purchase. Market owners and administrators have comprehensive access, enabling them to view all sellers' stock and inspect shoppers' bags.

User Categories/Roles

  1. Guest: Anyone who has not yet signed in to the platform.

  2. User/Buyer: Someone who has an account but also is willing to buy products via the platform.

  3. Vendor: someone with an account but and has products to sell via the platform.

  4. Admins: someone who has access to the platforms functionality and able to change user roles.

Features found on the platform

  • Users/guests should be able to view all items.
  • Guests should be able to sign up.
  • Admins should be able to change user roles.
  • Users/Vendors/Admins should be able to log in.
  • Users should be able to manage their cart.
  • Users should be able to buy items from the platform.
  • Users should be able to rate the platform/specific vendors.
  • Guests should be able to send questions or queries using a contact form provided on the site.
  • Vendors should be able to fully manage their stock.
  • Users should be able to effect payments/checkout.
  • Online payment with a credit/debit card.
  • Mobile money payments.
  • On delivery payments. - Across the counter payments.

Tech Stack

  • Node.js: Backend environment for server-side logic.
  • Express.js: Web application framework for Node.js.
  • PostgreSQL: Relational database management system.
  • Typescript: Supercript of JavaScript used as for back-end programming.

Installation

Being able to access the e-commerce-mavericcks-bn backe-end:

  1. Clone the repository

    • Using HTTPS :
    git clone https://github.com/atlp-rwanda/e-commerce-mavericcks-bn.git
    cd e-commerce-mavericcks-bn
    
    • Using SSH :
    git clone [email protected]:atlp-rwanda/e-commerce-mavericcks-bn.git
    cd e-commerce-mavericcks-bn
    
  2. Installing depedencies:

npm install

  1. Copy the environment configuration:

cp .env.example .env

Update the values of .env file with your configurations

Pivotal Tracker with GitHub Best Practices

Pivotal Tracker's Docs

Welcome! This document will guide you through the best practices for ensuring that your work is available in Pivotal Tracker and matches the provided tasks.

Naming Conventions

Branches

When creating a branch, include the story ID in the branch name to automatically attach it to the story in Tracker.

Best Practices for Branch Names:

  1. No uppercase letters; use hyphens instead of spaces.
  2. Start with the Pivotal Tracker story ID (if connecting to a specific story).
  3. Use prefixes:
  • ch for chores.
  • fit for features.
  • bg-fix for bug fixes.
  1. Keep names short and consistent with the feature you're working on.

Commits

Follow these practices for commit messages:

  1. Start with a verb in the imperative mood describing the change.
  2. Keep the subject line concise (under 50 characters).
  3. Explain the reason for the change, not just the mechanics.
  4. Aim for single, logical changes per commit.
  5. Capitalize the first letter of the subject line and any following words.

Example commit message: git commit -m "[finishes #123123] Updated settings for holograph projector"

Pull Requests

Attach pull requests to stories automatically by starting the branch name with the story's ID.

Setting up Swagger Documentations

If setting up Swagger for the first time, follow these steps:

  1. Navigate to the location src/docs.
  2. Create a .yaml file.
  3. Write your documentation in the file.
  4. No need to set up Swagger-related things in server.ts again.

Note: YAML strictly follows indentations, so ensure you follow them.

Sequelize Usage Guide

Introduction

This documentation provides guidance on setting up and using Sequelize in the project. Sequelize is a promise-based Node.js ORM for PostgreSQL, MySQL, SQLite, and MSSQL databases.

Setup

  1. Run Existing Migrations: Execute existing migrations to create database tables.

    npm run migrate
    

Usage

Running Migrations

  • Create Tables: To create database tables based on existing migrations.

    npm run migrate
    
  • Undo Changes: If you need to rollback changes made by migrations.

    npm run migrate:undo
    

Seeding Data

  • Seed Database: Add initial data to the database.

    npm run seed
    
  • Undo Seeding: Remove seeded data from the database.

    npm run seed:undo
    

Creating Models

  • Generate Model: Create a new model using the Sequelize CLI.

    npx sequelize-cli model:generate --name <ModelName> --attributes <attr1>:<type>,<attr2>:<type>,...
    

Generating Migrations

  • Generate Migration: Generate a new migration file for making changes to the database schema.
     npx sequelize-cli migration:generate --name <MigrationName>
    

Executing Migrations

  • Run Migrations: Execute the generated migration to apply changes to the database.
    npm run migrate
    

Conclusion

Sequelize simplifies database interactions in the project by providing an ORM layer. Follow the steps outlined above to set up Sequelize and manage database schema changes effectively. For more information, refer to the Sequelize documentation.

Useful Links

  1. Pivotal Tracker's Official Documentation
  2. freeCodeCamp Article on Naming Commits
  3. Medium Article on Naming Branches