Giter VIP home page Giter VIP logo

vouchers-k8s's Introduction

Design API For Voucher Pool Microservices (k8s)

Getting Started

First Step

To get started, make sure you have Docker installed and enabled kubernates on your system, and then clone this repository.

Second Step (Skaffold)

Skaffold handles the workflow for building, pushing and deploying your application, allowing you to focus on what matters most: writing code.

setup skaffold Installing skaffold

Third Step

install ingress-nginx by running

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.4.0/deploy/static/provider/cloud/deploy.yaml

Creating a secret / accessing secret

kubectl create secret generic jwt-secret --from-literal=JWT_KEY=my-secret-key

Fourth Step

add vouchers.dev domain to hosts files into your machine

  • windows => C:\Windows\System32\drivers\etc\hosts
  • mac / linux => nano /etc/hosts

Hosts file

Last Step

Next, navigate in your terminal to the directory you cloned this, and spin up the containers for the web server by running

skaffold dev

API Collection of Voucher Pool app on postman

NOTE create new environment in postman with domain variable has values: https://vouchers.dev make it https to store cookies

Voucher Pool App Service app collection

You can access your application via localhost, if you're running the containers directly https://vouchers.dev

Running the tests

To get started, make sure you have NODE installed on your system,.

Next, navigate in your terminal to the directory you cloned this, run command below: npm install && npm install --save-dev

  • running tests:
  • users: cd auth && npm run test
  • vouchers: cd vouchers && npm run test
  • redeem: cd redeem && npm run test

** Note our running test outside the container to prevent container to upload large libraries like: mongodb-memory-server every time change package.json mongodb-memory-server

Architecture Microservice App

  • architect ,scalable app using collections of services handle by kubernets.
  • using load balancing is called nginx-ingress.
  • communication between services using a lighting-fast event bus by using nats-streaming.
  • share reusable code between multiple express services using custom. NPM Package to prevent repeating code common package.

API

  • implemented JWT based security in a test Core Web API REST project

Authentication

  • Sign In
  • Sign Up
  • Me
  • Logout

Voucher Pool

  • Create
  • Update
  • Show
  • Get All

Vouchers

  • Create
  • Update
  • Show
  • Get All
  • emits voucher:created event when create new vouceher
  • emits voucher:updated event when update voucher

redeem

  • redeem voucher
  • check if voucher is expired
  • check if voucher is already used.
  • emits redeem:created event when redeem created
  • listen voucher:creaetd evnet
  • listen voucher:updated evnet

Common

share reusable code between multiple express services using custom. NPM Package to prevent repeating code
  • middlewares
  • events
  • errors
  • publish lib on npm packages

vouchers-k8s's People

Contributors

dev-el-badry avatar elbadry-dev avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.