Skip to content

atlp-rwanda/e-commerce-ninjas-bn

Repository files navigation

E-COMMERCE WEB APPLICATION SERVER - TEAM NINJAS.

Our e-commerce web application server, developed by Team Ninjas, facilitates smooth online shopping with features like user authentication, product cataloging, and secure payments. It's built to enhance the user experience with high performance and reliability. Suitable for any online marketplace looking to grow.

Reviewed by Hound Maintainability Test Coverage Coverage Status CircleCI codecov

HOSTED SERVER URL

https://e-commerce-ninjas-platform-backend.onrender.com/

Hosted Swagger Documentation

https://e-commerce-ninjas-platform-backend.onrender.com/api-docs

Github Repository For E-Commerce-Ninjas Backend

https://github.com/atlp-rwanda/e-commerce-ninjas-bn

COMPLETED FEATURES

  • Welcome Endpoint
  • Register Endpoint
  • Verification Email Endpoint
  • Resend verification Endpoint
  • Login Endpoint
  • Admin get users Endpoint
  • Admin get user Endpoint
  • Admin Update Status Endpoint
  • Admin Update Role Endpoint
  • Logout Endpoint
  • Update User Profile Endpoint
  • Get User Profile Endpoint
  • Login Via google account

TABLE OF API ENDPOINTS SPECIFICATION AND DESCRIPTION

No VERBS ENDPOINTS STATUS ACCESS DESCRIPTION
1 GET / 200 OK public Show welcome message
2 POST /api/auth/register 201 CREATED public create user account
3 GET /api/auth/verify-email/:token 200 OK public Verifying email
4 POST /api/auth/send-verify-email 200 OK public Resend verification email
5 POST /api/auth/login 200 OK public Login with Email and Password
6 GET /api/user/admin-get-users 200 OK private Admin get all users Endpoint
7 GET /api/user/admin-get-user/:id 200 OK private Admin get user Endpoint
8 PUT /api/user/admin-update-user-status/:id 200 OK private Admin Update Status Endpoint
9 PUT /api/user/admin-update-role/:id 200 OK private Admin Update Role Endpoint
10 POST /api/auth/logout 200 OK private Logout user
11 PUT /api/user/user-update-profile 200 OK private Update User Profile Endpoint
11 GET /api/user/user-get-profile 200 OK private Get User Profile Endpoint
12 GET /api/auth/google 200 OK public Login Via google account

INSTALLATION

  1. Clone the repository:

    git clone https://github.com/atlp-rwanda/e-commerce-ninjas-bn.git
  2. Install dependencies:

    npm install
  3. Copy .env.example to .env and add values to all variables.

  4. Start the server:

    npm run dev

FOLDER STRUCTURE

  • .env: Secure environment variables.

  • src/: Source code directory.

    • databases/: Database related files.
      • config/: Database connectivity configuration.
      • models/: Sequelize models.
    • middlewares/: Middleware functions.
    • modules/: Modules like User, Products, etc.
      • user/: user module.
        • controller/: user controllers.
        • repository/: user repositories.
        • test/: user test cases.
        • validation/: user validation schemas.
    • routes/: API routes.
    • helpers/: Utility functions.
    • validation/: Validation schemas.
    • services/: Service functions like sendEmails.
    • index.ts: Startup file for all requests.

INITILIAZE SEQUELIZE CLI

  1. Initialize Sequelize CLI:
    npx sequelize-cli init
  2. Generate Seeder:
    npx sequelize-cli seed:generate --name name-of-your-seeder
  3. Generate Migrations:
    npx sequelize-cli migration:generate --name name-of-your-migration
  4. Define Migration: Edit the generated migration file to include the tables you want to create.
  5. Define Seeder Data: Edit the generated seeder file to include the data you want to insert.
  6. Run the Seeder:
    npm run createAllSeeders
  7. Run the Migration:
    npm run createAllTables
  8. Delete the Seeder:
    npm run deleteAllSeeders
  9. Delete the Migration:
    npm run deleteAllTables