Git Product home page Git Product logo

furious's Introduction

Furious API

Technologies used

  • Kotlin 1.5.31
  • SpringBoot
  • Reactive Programming using Kotlin Coroutines and Spring WebFlux
  • Arrow-kt
  • PostgreSQL
  • Redis
  • Junit 5 Juniper
  • Mockk
  • Wiremock
  • Testcontainers

Architectural and Technical Decisions

Architecture

The project is created using the "ports and adapters architecture", also known as "hexagonal architecture".

With this architecture, the code is organized into layers: logic, controllers, adapters, and ports.

I'm using it because it provides an easy way of understanding what the code is doing and benefits a more functional approach, also improves the readability and testability of the code.

logic

The classes inside the logic package deal with pure business logic and must not have side effects or throw exceptions.

adapters

A layer to convert external data to internal ones, and vice-versa. The domain that is the same as the external data should not have an adapter. The point is if the outside world changes, you only have to change the adapter, or creating a new one for the domain that does not have it.

ports

The classes inside the ports package communicate with the outside world, such as HTTP, Redis, Postgres.

controllers

The classes inside the package controllers are the glue between all the other layers, orchestrating calls between pure business logic, adapters, and ports.

Error Handling

I'm using arrow-kt Either for functional error handling to try to avoid exceptions being thrown, because exceptions break referential transparency and are not consistent. The Either also let the code more readable because it is clear what a call can return.

Reactive Programming

I'm using Kotlin Coroutines because this is an IO first API, meaning the majority of operations that the API is performing are IO calls. With that, the Coroutines can make the API more scalable.

Next Steps I would like to do

  1. Add spring security to prevent customers to do add movie times using roles (customer, owner)
  2. Add retry and circuit break in the API call

Instructions on how to run the API

  1. To run the API in a local environment, is necessary to have installed the following resources:
  • Docker
  • Docker-Compose
  • Java 11
  1. With the resources installed, execute the command, on the app root folder:
  $sh run.sh {api-key}

Swagger and API usage

The API has swagger installed and can be accessed in the link:http://localhost:8080/swagger-ui/

img.png

furious's People

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.