diff --git a/.gitignore b/.github/.gitignore similarity index 97% rename from .gitignore rename to .github/.gitignore index c9e74f9..493e8e2 100644 --- a/.gitignore +++ b/.github/.gitignore @@ -49,4 +49,5 @@ package-lock.json yarn.lock # Ignore any other sensitive or generated files -.npmrc \ No newline at end of file +.npmrc +.npmignore \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..e69de29 diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..e69de29 diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..db24ee5 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,26 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Attach by Process ID", + "processId": "${command:PickProcess}", + "request": "attach", + "skipFiles": [ + "/**" + ], + "type": "node" + }, + { + "type": "node", + "request": "launch", + "name": "Launch Program", + "skipFiles": [ + "/**" + ], + "program": "${workspaceFolder}/microservices/user-service/src/controllers.js" + } + ] +} \ No newline at end of file diff --git a/gateway/README.md b/gateway/README.md index 04ab2ed..a2e6138 100644 --- a/gateway/README.md +++ b/gateway/README.md @@ -1,6 +1,6 @@ # Microservices Suite -## API-GATEWAY Package +## API-GATEWAY Package. Remember to provide redundancy to eliminate the `single point of failure` The API-GATEWAY serves as the front-facing layer of our Microservices Suite, designed to efficiently route client requests to the appropriate internal service. By abstracting the internal services network from the client, it exposes a singular endpoint that consolidates and manages access to your suite of APIs. diff --git a/microservices/cart-service/.env b/microservices/cart-service/.env new file mode 100644 index 0000000..d7f43a0 --- /dev/null +++ b/microservices/cart-service/.env @@ -0,0 +1,5 @@ +PORT=9009 +DATABASE_URL=mongodb://host.docker.internal:27017/cart_service_db_dev +CLOUD_NAME=dh3brnwfp +API_KEY=945719211841459 +API_SECRET=z6UrZ9lnTq5_iM3261H4aVYao20 \ No newline at end of file diff --git a/microservices/cart-service/.env.dev b/microservices/cart-service/.env.dev new file mode 100644 index 0000000..d7f43a0 --- /dev/null +++ b/microservices/cart-service/.env.dev @@ -0,0 +1,5 @@ +PORT=9009 +DATABASE_URL=mongodb://host.docker.internal:27017/cart_service_db_dev +CLOUD_NAME=dh3brnwfp +API_KEY=945719211841459 +API_SECRET=z6UrZ9lnTq5_iM3261H4aVYao20 \ No newline at end of file diff --git a/microservices/customer-service/.env b/microservices/customer-service/.env new file mode 100644 index 0000000..c9dd8ef --- /dev/null +++ b/microservices/customer-service/.env @@ -0,0 +1,5 @@ +PORT=9000 +DATABASE_URL=mongodb://host.docker.internal:27017/customer_service_db_dev +CLOUD_NAME=dh3brnwfp +API_KEY=945719211841459 +API_SECRET=z6UrZ9lnTq5_iM3261H4aVYao20 \ No newline at end of file diff --git a/microservices/customer-service/.env.dev b/microservices/customer-service/.env.dev new file mode 100644 index 0000000..c9dd8ef --- /dev/null +++ b/microservices/customer-service/.env.dev @@ -0,0 +1,5 @@ +PORT=9000 +DATABASE_URL=mongodb://host.docker.internal:27017/customer_service_db_dev +CLOUD_NAME=dh3brnwfp +API_KEY=945719211841459 +API_SECRET=z6UrZ9lnTq5_iM3261H4aVYao20 \ No newline at end of file diff --git a/microservices/email-service/.env b/microservices/email-service/.env new file mode 100644 index 0000000..71f9ff2 --- /dev/null +++ b/microservices/email-service/.env @@ -0,0 +1,5 @@ +PORT=9008 +DATABASE_URL=mongodb://host.docker.internal:27017/email_service_db_dev +CLOUD_NAME=dh3brnwfp +API_KEY=945719211841459 +API_SECRET=z6UrZ9lnTq5_iM3261H4aVYao20 \ No newline at end of file diff --git a/microservices/email-service/.env.dev b/microservices/email-service/.env.dev new file mode 100644 index 0000000..71f9ff2 --- /dev/null +++ b/microservices/email-service/.env.dev @@ -0,0 +1,5 @@ +PORT=9008 +DATABASE_URL=mongodb://host.docker.internal:27017/email_service_db_dev +CLOUD_NAME=dh3brnwfp +API_KEY=945719211841459 +API_SECRET=z6UrZ9lnTq5_iM3261H4aVYao20 \ No newline at end of file diff --git a/microservices/notification-service/.env b/microservices/notification-service/.env new file mode 100644 index 0000000..c6494ca --- /dev/null +++ b/microservices/notification-service/.env @@ -0,0 +1,5 @@ +PORT=9007 +DATABASE_URL=mongodb://host.docker.internal:27017/notification_service_db_dev +CLOUD_NAME=dh3brnwfp +API_KEY=945719211841459 +API_SECRET=z6UrZ9lnTq5_iM3261H4aVYao20 \ No newline at end of file diff --git a/microservices/notification-service/.env.dev b/microservices/notification-service/.env.dev new file mode 100644 index 0000000..c6494ca --- /dev/null +++ b/microservices/notification-service/.env.dev @@ -0,0 +1,5 @@ +PORT=9007 +DATABASE_URL=mongodb://host.docker.internal:27017/notification_service_db_dev +CLOUD_NAME=dh3brnwfp +API_KEY=945719211841459 +API_SECRET=z6UrZ9lnTq5_iM3261H4aVYao20 \ No newline at end of file diff --git a/microservices/payment-service/.env b/microservices/payment-service/.env new file mode 100644 index 0000000..3825139 --- /dev/null +++ b/microservices/payment-service/.env @@ -0,0 +1,5 @@ +PORT=9006 +DATABASE_URL=mongodb://host.docker.internal:27017/payment_service_db_dev +CLOUD_NAME=dh3brnwfp +API_KEY=945719211841459 +API_SECRET=z6UrZ9lnTq5_iM3261H4aVYao20 \ No newline at end of file diff --git a/microservices/payment-service/.env.dev b/microservices/payment-service/.env.dev new file mode 100644 index 0000000..3825139 --- /dev/null +++ b/microservices/payment-service/.env.dev @@ -0,0 +1,5 @@ +PORT=9006 +DATABASE_URL=mongodb://host.docker.internal:27017/payment_service_db_dev +CLOUD_NAME=dh3brnwfp +API_KEY=945719211841459 +API_SECRET=z6UrZ9lnTq5_iM3261H4aVYao20 \ No newline at end of file diff --git a/microservices/product-service/.env b/microservices/product-service/.env new file mode 100644 index 0000000..5d291f2 --- /dev/null +++ b/microservices/product-service/.env @@ -0,0 +1,5 @@ +PORT=9002 +DATABASE_URL=mongodb://host.docker.internal:27017/payment_service_db_dev +CLOUD_NAME=dh3brnwfp +API_KEY=945719211841459 +API_SECRET=z6UrZ9lnTq5_iM3261H4aVYao20 \ No newline at end of file diff --git a/microservices/product-service/.env.dev b/microservices/product-service/.env.dev new file mode 100644 index 0000000..5d291f2 --- /dev/null +++ b/microservices/product-service/.env.dev @@ -0,0 +1,5 @@ +PORT=9002 +DATABASE_URL=mongodb://host.docker.internal:27017/payment_service_db_dev +CLOUD_NAME=dh3brnwfp +API_KEY=945719211841459 +API_SECRET=z6UrZ9lnTq5_iM3261H4aVYao20 \ No newline at end of file diff --git a/microservices/rbac-service/.env b/microservices/rbac-service/.env new file mode 100644 index 0000000..b8afd30 --- /dev/null +++ b/microservices/rbac-service/.env @@ -0,0 +1,5 @@ +PORT=9005 +DATABASE_URL=mongodb://host.docker.internal:27017/rbac_service_db_dev +CLOUD_NAME=dh3brnwfp +API_KEY=945719211841459 +API_SECRET=z6UrZ9lnTq5_iM3261H4aVYao20 \ No newline at end of file diff --git a/microservices/rbac-service/.env.dev b/microservices/rbac-service/.env.dev new file mode 100644 index 0000000..b8afd30 --- /dev/null +++ b/microservices/rbac-service/.env.dev @@ -0,0 +1,5 @@ +PORT=9005 +DATABASE_URL=mongodb://host.docker.internal:27017/rbac_service_db_dev +CLOUD_NAME=dh3brnwfp +API_KEY=945719211841459 +API_SECRET=z6UrZ9lnTq5_iM3261H4aVYao20 \ No newline at end of file diff --git a/microservices/supplier-service/.env b/microservices/supplier-service/.env new file mode 100644 index 0000000..4e415c8 --- /dev/null +++ b/microservices/supplier-service/.env @@ -0,0 +1,5 @@ +PORT=9001 +DATABASE_URL=mongodb://host.docker.internal:27017/supplier_service_db_dev +CLOUD_NAME=dh3brnwfp +API_KEY=945719211841459 +API_SECRET=z6UrZ9lnTq5_iM3261H4aVYao20 \ No newline at end of file diff --git a/microservices/supplier-service/.env.dev b/microservices/supplier-service/.env.dev new file mode 100644 index 0000000..4e415c8 --- /dev/null +++ b/microservices/supplier-service/.env.dev @@ -0,0 +1,5 @@ +PORT=9001 +DATABASE_URL=mongodb://host.docker.internal:27017/supplier_service_db_dev +CLOUD_NAME=dh3brnwfp +API_KEY=945719211841459 +API_SECRET=z6UrZ9lnTq5_iM3261H4aVYao20 \ No newline at end of file diff --git a/microservices/supplier-service/dockerFile.dev b/microservices/supplier-service/dockerFile.dev index c0d2574..f8ab348 100644 --- a/microservices/supplier-service/dockerFile.dev +++ b/microservices/supplier-service/dockerFile.dev @@ -1,8 +1,8 @@ -FROM node:alpine +FROM node:18-alpine3.18 WORKDIR /app -COPY package.json ./ +COPY package.json . RUN yarn install COPY . . diff --git a/microservices/supplier-service/index.js b/microservices/supplier-service/index.js index 6b1df12..0b20d55 100644 --- a/microservices/supplier-service/index.js +++ b/microservices/supplier-service/index.js @@ -6,6 +6,7 @@ const {rabbitMQMiddleware} = require('./middlewares/rabbitmq') const { config, morgan, logger } = require('@microservices-suite/config'); + app.use(express.json()) diff --git a/microservices/supplier-service/package.json b/microservices/supplier-service/package.json index 31911d9..a961840 100644 --- a/microservices/supplier-service/package.json +++ b/microservices/supplier-service/package.json @@ -4,22 +4,21 @@ "description": "The supplier service serves as the central repo for the supplier CRUD operation", "main": "index.js", "dependencies": { - "@microservices-suite/config": "^1.0.3", + "@microservices-suite/config": "1.0.7", "@microservices-suite/errors": "^1.1.6", "@microservices-suite/utilities": "^1.0.6", "@microservices-suite/validations": "^1.0.9", + "amqplib": "0.10.3", "express": "*", - "mongoose": "*", "mongodb": "^6.5.0", - "nodemon": "3.1.0", - "amqplib": "0.10.3" + "mongoose": "*", + "nodemon": "3.1.0" }, "scripts": { "start": "node index.js", - "dev": "set NODE_ENV=dev && nodemon index.js" - }, - "devDependencies": { + "dev": "NODE_ENV=dev nodemon index.js" }, + "devDependencies": {}, "author": "Dhairya Doshi", "license": "ISC" -} \ No newline at end of file +} diff --git a/microservices/upload-service/.env b/microservices/upload-service/.env new file mode 100644 index 0000000..f8129ce --- /dev/null +++ b/microservices/upload-service/.env @@ -0,0 +1,5 @@ +PORT=9004 +DATABASE_URL=mongodb://host.docker.internal:27017/upload_service_db_dev +CLOUD_NAME=dh3brnwfp +API_KEY=945719211841459 +API_SECRET=z6UrZ9lnTq5_iM3261H4aVYao20 \ No newline at end of file diff --git a/microservices/upload-service/.env.dev b/microservices/upload-service/.env.dev new file mode 100644 index 0000000..f8129ce --- /dev/null +++ b/microservices/upload-service/.env.dev @@ -0,0 +1,5 @@ +PORT=9004 +DATABASE_URL=mongodb://host.docker.internal:27017/upload_service_db_dev +CLOUD_NAME=dh3brnwfp +API_KEY=945719211841459 +API_SECRET=z6UrZ9lnTq5_iM3261H4aVYao20 \ No newline at end of file diff --git a/microservices/user-service/.env b/microservices/user-service/.env new file mode 100644 index 0000000..97eb893 --- /dev/null +++ b/microservices/user-service/.env @@ -0,0 +1,2 @@ +DATABASE_URL=mongodb://mongodb:27017/user_service_db_dev +PORT=9003 \ No newline at end of file diff --git a/microservices/user-service/.env.dev b/microservices/user-service/.env.dev new file mode 100644 index 0000000..97eb893 --- /dev/null +++ b/microservices/user-service/.env.dev @@ -0,0 +1,2 @@ +DATABASE_URL=mongodb://mongodb:27017/user_service_db_dev +PORT=9003 \ No newline at end of file diff --git a/microservices/user-service/package.json b/microservices/user-service/package.json index 4bf46e4..60df45b 100644 --- a/microservices/user-service/package.json +++ b/microservices/user-service/package.json @@ -14,10 +14,10 @@ "author": "Gilbert Andanje", "license": "ISC", "dependencies": { - "@microservices-suite/config": "^1.0.3", - "@microservices-suite/errors": "^1.1.6", - "@microservices-suite/utilities": "^1.0.6", - "@microservices-suite/validations": "^1.0.9", + "@microservices-suite/config": "1.0.3", + "@microservices-suite/errors": "1.1.6", + "@microservices-suite/utilities": "1.0.6", + "@microservices-suite/validations": "1.0.9", "dotenv": "^16.4.5", "express": "^4.18.3", "helmet": "^7.1.0", diff --git a/shared/config/package.json b/shared/config/package.json index edcc161..8dea983 100644 --- a/shared/config/package.json +++ b/shared/config/package.json @@ -1,6 +1,6 @@ { "name": "@microservices-suite/config", - "version": "1.0.3", + "version": "1.0.7", "description": "This contains common configurations for things like env files,loggers etc for easy setup of environment specific settings", "main": "index.js", "author": "Gilbert Andanje", @@ -8,5 +8,11 @@ "publishConfig": { "access": "public" }, - "private": false + "private": false, + "dependencies": { + "dotenv": "^16.4.5", + "joi": "^17.12.3", + "morgan": "^1.10.0", + "winston": "^3.13.0" + } }