GraphQL Microservice Architecture implementation for basic e-commerce store using Apollo Federation. This project is just meant to serve as a PoC ( Proof of Concept ).
You cannot use the buyProduct
mutation without having a frontend, which has integrated stripe, as it involves payment intent creation. And required Frontend app is not included in this repo!
Install Rover CLI
npm i -g @apollo/rover
Follow these two steps: #1 and #2
Clone the project from Github.
Run following command in every service directory, namely "auth", "cart", "rest-api".
rover subgraph publish ${Graph id}@${variant} --schema "./src/${service name}-schema.graphql" --name ${service name} --routing-url "http://localhost:${service port}/graphql"
Install Dev dependencies in the root directory of project by running:
npm i -D
Install the dependencies of all the components by running:
npm run load-dependencies
Install and login into Stripe CLI by following this guide.
To start listening for webhook on localhost run following command:
stripe listen --forward-to http://localhost:${Router Port}/rest/api/v1/webhook/stripe
Run following command in every component's directory, namely "router", "auth", "cart", "rest-api".
npm run copy-env
Fill up the created .env files in all the components with appropriate values.
Migrate back to root directory of the project, and run:
npm run dev