{"id":15187233,"url":"https://github.com/majid-l/express-ecommerce-api","last_synced_at":"2026-03-03T01:30:59.570Z","repository":{"id":184537681,"uuid":"669093937","full_name":"majid-L/express-ecommerce-api","owner":"majid-L","description":"Express REST API featuring Prisma ORM, session-based authentication and integration testing with Mocha, Chai + SuperTest. Designed with Swagger tools and documented with OpenAPI 3.0.3.","archived":false,"fork":false,"pushed_at":"2024-02-18T18:14:25.000Z","size":1497,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-25T21:17:04.193Z","etag":null,"topics":["chai","express-session","expressjs","mocha","openapi3","passportjs","prisma-orm","psql","supertest","swagger-codegen","swagger-editor","swagger-ui"],"latest_commit_sha":null,"homepage":"https://taliphus.vercel.app/api","language":"TypeScript","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/majid-L.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-21T10:21:46.000Z","updated_at":"2023-08-05T14:13:45.000Z","dependencies_parsed_at":"2024-02-18T18:35:53.991Z","dependency_job_id":null,"html_url":"https://github.com/majid-L/express-ecommerce-api","commit_stats":{"total_commits":299,"total_committers":1,"mean_commits":299.0,"dds":0.0,"last_synced_commit":"4d1947908249735e47219a441d5e4aeef9149908"},"previous_names":["3782291211/express-ecommerce-api","majid-l/express-ecommerce-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/majid-L%2Fexpress-ecommerce-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/majid-L%2Fexpress-ecommerce-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/majid-L%2Fexpress-ecommerce-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/majid-L%2Fexpress-ecommerce-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/majid-L","download_url":"https://codeload.github.com/majid-L/express-ecommerce-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240746949,"owners_count":19850996,"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":["chai","express-session","expressjs","mocha","openapi3","passportjs","prisma-orm","psql","supertest","swagger-codegen","swagger-editor","swagger-ui"],"created_at":"2024-09-27T18:05:07.401Z","updated_at":"2026-03-03T01:30:59.516Z","avatar_url":"https://github.com/majid-L.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Express, TypeScript, [Prisma ORM](https://www.prisma.io/) and OpenAPI project\n\nThis project features a **[RESTful CRUD API](https://taliphus.vercel.app/api)** that processes data for an ecommerce application.\n\n## Key product features\n- Designed and fully documented using Swagger tools and OpenAPI Specification. \n  - Full **[API contract](./openapi.yaml)** can be found [here](./openapi.yaml).\n- Powered by Vercel's serverless functions, including a PSQL database server for managing application data (configured for [session persistence](./auth/session.ts)).\n- [Session and cookie-based authentication](./auth/) enabling persistent logins.\n- [Middleware functions](./middleware) for data validation and user authentication.\n  - In-depth error handling, casting a wide net over potential edge cases and sources of error.\n- [Data modelling](./prisma/schema.prisma) and [database migrations](./prisma/migrations/20230728105408_/migration.sql) with Prisma ORM.\n- Comprehensive [integration testing](./api_tests/), achieving **90% test coverage** as reported by Istanbul's *nyc* CLI.\n- Programmatic [database reseeding](/prisma/seed.ts) using [dummy data](/prisma/dev_data.ts).\n\n\u003cp float=\"left\"\u003e\n  \u003cimg src=\"./images/node.svg\" width=\"60\" /\u003e\n  \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n  \u003cimg src=\"./images/ts.svg\" width=\"60\" /\u003e\n  \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n  \u003cimg src=\"./images/prisma.svg\" width=\"140\" /\u003e\n  \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n  \u003cimg src=\"./images/psql.svg\" width=\"60\" /\u003e \n  \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n  \u003cimg src=\"./images/mocha.svg\" width=\"60\" /\u003e \n  \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n  \u003cimg src=\"./images/chai.svg\" width=\"60\" /\u003e\n\u003c/p\u003e\n\n---\n## Endpoints\nFor more information on available query parameters and request body requirements, visit the **[API base url](https://taliphus.vercel.app/api)**.\n\nMany of these endpoints require authenticated access, which you can accomplish by first signing up and then logging in.\n\n```json\n// 1) Send a POST request to /api/signup\n{\n  \"username\": ...,\n  \"password\": ...,\n  \"email\": ... ,\n  \"name\": ...\n}\n\n// 2) Send a POST request to /api/login\n{\n  \"username\": ... /* your username from step 1) */,\n  \"password\": ... /* your password from step 1) */\n}\n```\n\n| HTTP method(s) | URL\n|---|---|\nPOST | /api/signup\nPOST | /api/login\nPOST | /api/logout\nGET | /api/products\nGET | /api/products/bestsellers\nGET | /api/products/:id\nGET | /api/products/:id/reviws\nGET, PUT, DELETE | /api/customers/:id\nGET, PUT | /api/customers/:id/cart\nGET, PUT | /api/customers/:id/wishlist\nGET, POST | /api/customers/:id/orders\nGET | /api/customers/:id/favorites\nGET | /api/customers/:id/orders/:orderId\nGET | /api/customers/:id/reviews\nPOST | /api/customers/:id/addresses\nDELETE | /api/customers/:id/addresses/:addressId\nGET | /api/categories\nGET | /api/suppliers\nGET, POST | /api/reviews\nGET, PUT, DELETE | /api/reviews/:id\n\n---\n## Data model\nThis is a simplified view of the entity relationships that exist within the database. For a more complete picture, consult the **[schema configuration](/prisma/schema.prisma)** and **[migration](/prisma//migrations/20230728105408_/migration.sql)** files.\n\n\u003cimg src=\"./images/erd-dark.svg\" width=\"900\" /\u003e \n\n---\n## Main project dependencies\n| Package | Purpose\n|---|---|\nExpress | Web API framework\nPrisma | Node.js \u0026 TypeScript ORM\nSuperTest | Integration testing\nMocha | Test framework\nChai | Assertion library\nPassport.js | Authentication middleware\nexpress-session | Session middleware\n\n---\n## Running the project on localhost\n\u003e This project requires PSQL to be installed locally.\n\n### Setup instructions\n1) Clone and fork the repository and install all dependencies.\n2) Create a local empty PSQL database called **ecommerce_db**.\n3) Create a **.env** file in the root of the repository with 4 environment variables:\n```\nDATABASE_PRISMA_URL=postgresql://\u003cUSER\u003e:\u003cpassword\u003e@localhost:5432/ecommerce_db\nDATABASE_URL_NON_POOLING=postgresql://\u003cUSER\u003e:\u003cpassword\u003e@localhost:5432/ecommerce_db\nSESSION_SECRET=sessionsecret\nPORT=3000\n```\n4) For the database connection strings, Replace ```\u003cUSER\u003e``` with the name of your local database user (e.g. *postgres*) and replace ```\u003cPASSWORD\u003e``` with whatever password you used to set up the local user.\n\nYou can now run the scripts below and begin to explore the project.\n\n### Run the Express server in development mode.\n```sh\nnpm run dev\n\n# or\n\nnpm run start\n```\n\n### Compile and run Mocha test suite\n```sh\nnpm run test\n```\n\n### Test coverage report \n```sh\nnpm run testcov\n```\n\n### Update database schema \nThis command performs 2 actions: syncs the database schema with Prisma schema and regenerates Prisma Client.\n```sh\nnpx prisma migrate dev\n\n# or\n\nprisma db push\n```\n\n### Seed database\n```sh\nnpx prisma db seed\n```\n\n### [Prisma Studio](https://www.prisma.io/studio) (browser-based GUI and database visualiser)\n```sh\nnpx prisma studio\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmajid-l%2Fexpress-ecommerce-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmajid-l%2Fexpress-ecommerce-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmajid-l%2Fexpress-ecommerce-api/lists"}