diff --git a/README.md b/README.md index 11ecc0c..6738d0d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,26 @@ Example of a specs driven development microservices (SDD) architecture using code generation. The project is keeping simple but includes all the necesary tools to be production ready. The business logic implemented does not really matter, the goal is to demonstrate how a SDD can be organized and the good pratices of a microservices architecture. -![](schema.png) +![](diagram.png) + +# Quick start + +* Docker installed +* Run: `./services/launcher.sh` +* Run: `./services/gateway-launcher.sh` +* Play with the API ! see documentation at [http://localhost:9898/documentation](http://localhost:9898/documentation) and use the postman files in [services/documentation/postman](services/documentation/postman) +* see: [services](services) for more information + +What you can do: + +* Create/update/get articles +* Add articles in the cart, update/get cart items +* Delete an article that is in the cart: will delete the article from the cart thanks to a kafka event +* Checkout the cart: will edit the stock of articles with a kafka event +* If you don't have an auth token you can do nothing on user service +* Signup and login (auth service) to get a token +* You can now access the user service except deleting a user: requires a special role in the token + # Project structure diff --git a/generator/generators/app/templates/README.md.ejs b/generator/generators/app/templates/README.md.ejs index 49e64e4..473dccf 100644 --- a/generator/generators/app/templates/README.md.ejs +++ b/generator/generators/app/templates/README.md.ejs @@ -15,7 +15,7 @@ To run this service use the [launcher script](../launcher.sh) as described in th * Run `prisma generate` These steps are necessary to have autocompletion. -Now you can start coding but make sure to not edit code that will be overriden by the generator. In case you want to do any change in the service contracts, you need to do it through the [specification](../specification). +Now you can start coding but make sure to not edit code that will be overriden by the generator. In case you want to do any change in the service contracts, you need to do it through the [specification](../../specification). # Documentation diff --git a/services/README.md b/services/README.md index d184e89..7ac803c 100644 --- a/services/README.md +++ b/services/README.md @@ -12,11 +12,11 @@ There is a `launcher.sh` script to launch the desired services with docker. * To launch all: `./launcher.sh` -* To launch specific services: `./launcher.sh `. The "service_name" is the same as the service's directory and the services will be launched in the order you pass them to the script. The kafka (exept in "prod" env) and api-gateway services will be launched automatically. +* To launch specific services: `./launcher.sh `. The "service_name" is the same as the service's directory and the services will be launched in the order you pass them to the script. The kafka service (exept in "prod" env) and api-gateway services will be launched automatically. * A "`-e`" option can be added to the command to precise the environment: "dev", "test", "prod", the default value is "dev". When you switch between environments, make sure to call the `stop-all.sh` script before. -* To lauch the API gateway, use the `gateway-launcher.sh` script, it is important that the `auth` service is already running, otherwise the the gateway wont be able to sign tokens. +* To launch the API gateway, use the `gateway-launcher.sh` script, it is important that the `auth` service is already running, otherwise the the gateway wont be able to sign tokens. To stop all the services, you can use the `stop-all.sh` script. @@ -32,11 +32,12 @@ In production you will need to have hosted databases and a kafka service. You ne * Create its specification (see [specification](../specification)). * Generate the service with the generator (see [generator](../generator)). -* Add the new documentation endpoints [here](documention/index.js). +* Add the new documentation endpoint [here](documention/index.js). +* Add the new documentation endpoint to the api gateway [here](api-gateway/settings/documentation.json) * Edit all the `.sh` scripts to add this new service. * Implement the "TODOs" by following the bellow information about editing a service. * Use `yarn lint-check` to make sure there is no style issues, you can also install the eslint plugin in your editor if it is available -* You might want to expose some routes with the [API gateway](../services/api-gateway). +* You might want to expose some routes with the [API gateway](api-gateway). **Edit a service** diff --git a/services/article/README.md b/services/article/README.md index 2c2cda5..14c2cd6 100644 --- a/services/article/README.md +++ b/services/article/README.md @@ -15,7 +15,7 @@ Service to manage articles, an article is an item of an e-commerce website. * Run `prisma generate` These steps are necessary to have autocompletion. -Now you can start coding but make sure to not edit code that will be overriden by the generator. In case you want to do any change in the service contracts, you need to do it through the [specification](../specification). +Now you can start coding but make sure to not edit code that will be overriden by the generator. In case you want to do any change in the service contracts, you need to do it through the [specification](../../specification). # Documentation diff --git a/services/auth/README.md b/services/auth/README.md index 03761c8..405e195 100644 --- a/services/auth/README.md +++ b/services/auth/README.md @@ -16,7 +16,7 @@ This service is an orchestrator and needs `user` service to work. * Run `prisma generate` These steps are necessary to have autocompletion. -Now you can start coding but make sure to not edit code that will be overriden by the generator. In case you want to do any change in the service contracts, you need to do it through the [specification](../specification). +Now you can start coding but make sure to not edit code that will be overriden by the generator. In case you want to do any change in the service contracts, you need to do it through the [specification](../../specification). # Documentation diff --git a/services/cart/README.md b/services/cart/README.md index 95d8f63..e78ce40 100644 --- a/services/cart/README.md +++ b/services/cart/README.md @@ -15,7 +15,7 @@ Service to manage carts, to simplify the POC, we consider that there is only one * Run `prisma generate` These steps are necessary to have autocompletion. -Now you can start coding but make sure to not edit code that will be overriden by the generator. In case you want to do any change in the service contracts, you need to do it through the [specification](../specification). +Now you can start coding but make sure to not edit code that will be overriden by the generator. In case you want to do any change in the service contracts, you need to do it through the [specification](../../specification). # Documentation diff --git a/services/user/README.md b/services/user/README.md index cc6b697..bbc508e 100644 --- a/services/user/README.md +++ b/services/user/README.md @@ -15,7 +15,7 @@ Service to manage users * Run `prisma generate` These steps are necessary to have autocompletion. -Now you can start coding but make sure to not edit code that will be overriden by the generator. In case you want to do any change in the service contracts, you need to do it through the [specification](../specification). +Now you can start coding but make sure to not edit code that will be overriden by the generator. In case you want to do any change in the service contracts, you need to do it through the [specification](../../specification). # Documentation