Code Monkey home page Code Monkey logo

midas-labs-backend-engineer-assessment's Introduction

Introduction

Welcome to the Midas Labs Backend Engineer Assessment repository! This project is part of the assessment process for backend engineers at Midas Labs. It is forked from the original assessment repository to develop and showcase the required skills.

This repository contains a pre-existing Spring Boot Application developed with Java 21 and leveraging the Temporal Workflow Engine for orchestrating business logic. The main task involves integrating the Stripe payment processing service to manage customer data upon user signup.

Tasks Completed

  • Integrated the Stripe payment processing service into the Spring Boot Application, facilitating seamless handling of customer transactions.
  • Implemented temporal workflows, activities, and workers to execute essential tasks, including customer creation and updates, ensuring efficient business logic orchestration.
  • Created a multi-stage Dockerfile to streamline the deployment process, incorporating build and run stages for efficient containerization.
  • Updated the compose.yaml file to align with Docker deployment requirements.
  • Postman Workspace for API Testing

For detailed instructions on setting up the project, please refer to the following section.

Setup Instructions

To run the application you would require:

  • Java
  • Temporal
  • Docker
  • Postman

You are required to first start the temporal server using the following command

temporal server start-dev

and then run the application using the following command or using your IDE.

./gradlew bootRun

Test APIs using the workspace:- Postman Workspace for API Testing

Implementation Approach and Assumptions

Stripe Integration:

  • Utilize the Stripe Java SDK to integrate Stripe payment processing service into the Spring Boot Application.
  • StripePaymentProvider class to make Stripe API calls for customer creation and updates upon user signup.
  • Change Account model to store additional fields like providerId and providerType returned by Stripe.

Temporal Workflow Engine Integration:

  • Leverage the Temporal Workflow Engine to orchestrate business logic efficiently.
  • Define 2 temporal workflows:
    • Create Account Workflow: This workflow will handle account creation and consists of following 2 activities
      • Create Payment Account Activity: To create account with Stripe.
      • Save Account to DB Activity: To save account with updated fields like providerType and providerId to PostgreSQL DB.
    • Update Account Workflow: This workflow will handle account updation and consists of following 2 activities
      • Update Payment Account Activity: To update account with Stripe.
      • Update Account to DB Activity: To update account in PostgreSQL DB.
  • Create Account Workers listening to create-account-workflow and update-account-workflow task queues to handle tasks such as customer creation and updates seamlessly.
  • Implement retry and error handling mechanisms within temporal workflows to ensure fault tolerance and reliability.

Dockerization:

  • Create a multi-stage Dockerfile to streamline the deployment process.
  • Incorporate build and run stages within the Dockerfile to optimize containerization.
  • Update the compose.yaml file to align with Docker deployment requirements.

OpenAPI Specification:

  • Create a new route /accounts/{accountId} to handle PATCH request for updating account details.
  • Add a new file accountId.yml in the OpenAPI specification.
  • Include details for the /accounts/{accountId} route, such as parameters, request/response formats, and any other relevant information.
  • Modify the parameters.yml file to include the accountId parameter definition.
  • Define the accountId parameter with appropriate properties, such as name, description, type, format, etc.

Code Walkthrough

Code Walkthrough

References

midas-labs-backend-engineer-assessment's People

Contributors

neeraj-dev-007 avatar onlywicked 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.