{"id":22404424,"url":"https://github.com/devdbrandy/restful-ecommerce","last_synced_at":"2025-07-31T17:32:21.957Z","repository":{"id":39856803,"uuid":"264283029","full_name":"devdbrandy/restful-ecommerce","owner":"devdbrandy","description":"A simple minimalistic ecommerce REST API built with Node.js and Express.js","archived":false,"fork":false,"pushed_at":"2022-05-24T14:24:18.000Z","size":592,"stargazers_count":42,"open_issues_count":2,"forks_count":18,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-03-02T21:45:47.842Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://restful-ecommerce.herokuapp.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devdbrandy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-15T19:40:08.000Z","updated_at":"2023-01-26T05:26:35.000Z","dependencies_parsed_at":"2022-07-20T05:47:33.295Z","dependency_job_id":null,"html_url":"https://github.com/devdbrandy/restful-ecommerce","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devdbrandy%2Frestful-ecommerce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devdbrandy%2Frestful-ecommerce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devdbrandy%2Frestful-ecommerce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devdbrandy%2Frestful-ecommerce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devdbrandy","download_url":"https://codeload.github.com/devdbrandy/restful-ecommerce/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228275028,"owners_count":17895008,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-05T10:13:02.640Z","updated_at":"2024-12-05T10:13:03.385Z","avatar_url":"https://github.com/devdbrandy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Restful Ecommerce\n\n![Docker Image CI](https://github.com/devdbrandy/restful-ecommerce/workflows/Docker%20Image%20CI/badge.svg?branch=master)\n![Node.js CI](https://github.com/devdbrandy/restful-ecommerce/workflows/Node.js%20CI/badge.svg?branch=master)\n\n## Overview\n\nA simple minimalistic ecommerce REST API built with Node.js and Express.js, showcasing three major functionalities:\n\n1. Authentication\n2. Products listing\n3. Order placements\n4. Access restrictions\n\n\u003e Demo Users\n\u003e\n\u003e | Email               | Password | Access       |\n\u003e | ------------------- | -------- | ------------ |\n\u003e | `admin@example.com` | `secret` | Admin Access |\n\u003e | `user@example.com`  | `secret` | User Access  |\n\n[![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/cfdf0e762edcf3abe91b)\n\n---\n\nDatabase Schema Design\n![Database Schema Design](/screenshots/db-schema-design.png)\n\n---\n\n\u003c!-- TOC depthFrom:2 --\u003e\n\n- [Overview](#overview)\n- [1. :rocket: Getting Started](#1-rocket-getting-started)\n  - [1.1 Prerequisites](#11-prerequisites)\n  - [1.2. Run locally](#12-run-locally)\n  - [1.3. Test Locally](#13-test-locally)\n  - [1.4. Running Test](#14-running-test)\n- [2. :lock: Authentication](#2-lock-authentication)\n- [3. :bookmark: API Versioning](#3-bookmark-api-versioning)\n- [3. :green_heart: HTTP Response Codes](#3-green_heart-http-response-codes)\n- [4. :pencil: License](#4-pencil-license)\n\n\u003c!-- /TOC --\u003e\n\n## 1. :rocket: Getting Started\n\n### 1.1 Prerequisites\n\nTo get started, ensure that you have the following installed on your local machine:\n\n- [NodeJS](https://nodejs.org/en/download/)\n- [PostgreSQL](https://www.postgresql.org/download/)\n\n### 1.2. Run locally\n\n- Clone repository or clone your own fork\n\n  ```bash\n  git clone https://github.com/devdbrandy/restful-ecommerce.git\n  ```\n\n- Make a duplicate of `.env.example` and rename to `.env`, then configure your credentials.\n  NB: After creating `.env` file, ensure that you set `APP_PKEY` to any secret phrase you want.\n- Install dependencies by running `npm i` or `npm install` on your terminal.\n- Run migration: `npm run db:migrate`\n- (Optional) Seed dummy data `npm run db:seed`\n- Two npm scripts are availiable to spin up the app server:\n  - `npm run start` spin up the server without watching for any file changes (Requires `npm run build`)\n  - `npm run serve` watches for any file changes and reloads the server\n\n### 1.3. Test Locally\n\nTo test or consume api locally, you can make use of [_Postman_](https://www.getpostman.com) or [_Insomnia_](https://insomnia.rest/download/)\n\n[![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/cfdf0e762edcf3abe91b)\n\n### 1.4. Running Test\n\nTest specs are implemented using [_jest_](https://jestjs.io).\n\nTwo npm scripts are available to run the test suite:\n\n1. `npm t` or `npm test` - Performs a single full test suite run, including jest code coverage reporting. Summary coverage reports are written to stdout, and detailed HTML reports are available in `/coverage/lcov-report/index.html`\n2. `npm run test:watch` - This watches for any file changes and runs the full test suite.\n\n## 2. :lock: Authentication\n\nAccess to restricted API endpoints requires an access token. To obtain your access token, make a request along with any dummy `username` and `password` credentials to `/login`.\n\n**Sample Response:**\n\n```http\nPOST http://localhost:3000/login\nHTTP/1.1\nAccept: application/json\n\nHTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n  \"success\": true,\n  \"data\": {\n    \"token\": \"...\",\n  }\n}\n```\n\n## 3. :bookmark: API Versioning\n\nThe second part of the URI specifies the API version you wish to access in the format `v{version_number}`.\nFor example, version 1 of the API (most current) is accessible via:\n\n```http\n  http://localhost:3000/api/v1\n```\n\n## 3. :green_heart: HTTP Response Codes\n\nEach response will be returned with one of the following HTTP status codes:\n\n- `200` `OK` The request was successful\n- `400` `Bad Request` There was a problem with the request (security, malformed)\n- `401` `Unauthorized` The supplied API credentials are invalid\n- `403` `Forbidden` The credentials provided do not have permissions to access the requested resource\n- `404` `Not Found` An attempt was made to access a resource that does not exist in the API\n- `500` `Server Error` An error on the server occurred\n\n## 4. :pencil: License\n\nThis project is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevdbrandy%2Frestful-ecommerce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevdbrandy%2Frestful-ecommerce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevdbrandy%2Frestful-ecommerce/lists"}