Code Monkey home page Code Monkey logo

crypto_app's Introduction

Cryptoapp

A simple app that allows users to have wallets and send money to other users. The application contains 2 main services: the account and notify service, each was developed using Hexagonal Architecture. The services communicate with each other using Event driven Architecture in this case, the account service communicates with the notification via Rabbitmq. And in front of the services, there is an Nginx and its role is to be an API gateway, so we can make a request to a single service (Nginx) then it will automatically redirect the request to a service.

architecture architecture

Database design

database

Run the application Locally

I recorded a video that you can follow to run the application localy link

To run the application localy, you have to use docker-compose.yaml file.

  1. Run ./init.sh this allows to add the http://cryptoapp.com url to the /etc/hosts file.
  2. To be able to send emails you have to use a Gmail account and set the env variables GMAIL_PASSWORD and GMAIL_EMAIL
- example:
    - export `GMAIL_PASSWORD=password`
    - export `[email protected]`
note: if the gmail credentials are not set the application will not sent emails
  1. Build the docker-compose file using make build
  2. Run the docker-compose file using make up
  3. import cryptoapp_collection.postman_collection.json in postman
  4. Inside postman add environment group
  5. Run requests:
    • register user1
    • register user2
    • activate user1 account
    • activate user2 account
    • login user1
    • login user2
    • copy the access_token user1 and replace the one inside the curl_websocket.txt file then copy the first block and run it inside the terminal, this allows to connect to websocket.
    • copy the access_token user2 and replace the one inside the curl_websocket.txt file then copy the first block and run it inside the terminal, this allows to connect to websocket.
    • list user1 wallets
    • list user2 wallets
    • send money user1
    • list transactions
  6. Run make down to stop the application.

GKE

The application was deployed using kubernetes (GKE) http://35.246.250.118:80/

Routes

  1. Check if account service is healthy http://35.246.250.118:80/account/healthy
  2. Check if notify service is healthy http://35.246.250.118:80/notify/healthy You can test the application using the same postman file, the only thing to change is the base_url to http://35.246.250.118

Websocket: To test the websocket you can use the following curl command:

curl --include \
     --no-buffer \
     --header "Authorization:Bearer $$$$$$" \
     --header "Connection: Upgrade" \
     --header "Upgrade: websocket" \
     --header "Host: 35.246.250.118:80" \
     --header "Origin: http://35.246.250.118:80" \
     --header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
     --header "Sec-WebSocket-Version: 13" \
     35.246.250.118:80/notify/ws

you have only to replace $$$$$$ with the access_token returned when you login.

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.