Backend for team Maverick's e-commerce website
- Project Overview
- User Categories/Roles
- Features found on the platform
- Tech Stack
- Installation
- Pivotal Tracker with GitHub Best Practices
- Setting up Swagger Documentations
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.
-
Guest: Anyone who has not yet signed in to the platform.
-
User/Buyer: Someone who has an account but also is willing to buy products via the platform.
-
Vendor: someone with an account but and has products to sell via the platform.
-
Admins: someone who has access to the platforms functionality and able to change user roles.
- 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.
- 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.
Being able to access the e-commerce-mavericcks-bn backe-end:
-
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
-
Installing depedencies:
npm install
- Copy the environment configuration:
cp .env.example .env
Update the values of .env
file with your configurations
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.
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:
- No uppercase letters; use hyphens instead of spaces.
- Start with the Pivotal Tracker story ID (if connecting to a specific story).
- Use prefixes:
ch
for chores.fit
for features.bg-fix
for bug fixes.
- Keep names short and consistent with the feature you're working on.
Follow these practices for commit messages:
- Start with a verb in the imperative mood describing the change.
- Keep the subject line concise (under 50 characters).
- Explain the reason for the change, not just the mechanics.
- Aim for single, logical changes per commit.
- 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"
Attach pull requests to stories automatically by starting the branch name with the story's ID.
If setting up Swagger for the first time, follow these steps:
- Navigate to the location
src/docs
. - Create a
.yaml
file. - Write your documentation in the file.
- No need to set up Swagger-related things in
server.ts
again.
Note: YAML strictly follows indentations, so ensure you follow them.
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.
-
Run Existing Migrations: Execute existing migrations to create database tables.
npm run migrate
-
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
-
Seed Database: Add initial data to the database.
npm run seed
-
Undo Seeding: Remove seeded data from the database.
npm run seed:undo
-
Generate Model: Create a new model using the Sequelize CLI.
npx sequelize-cli model:generate --name <ModelName> --attributes <attr1>:<type>,<attr2>:<type>,...
- Generate Migration: Generate a new migration file for making changes to the database schema.
npx sequelize-cli migration:generate --name <MigrationName>
- Run Migrations: Execute the generated migration to apply changes to the database.
npm run migrate
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.