Giter VIP home page Giter VIP logo

rinha-backend's Introduction

Rinha Backend

Project developed to participate in the "Rinha de Backend" challenge. The aim of the challenge is to create an API for manipulating people's data, with cache, database and a load balancer to manage two instances, all in a limited environment with 1.5vCPUs and 3GB of memory.

Technologies

Practices adopted

  • SOLID
  • API REST
  • Resource optimization
  • Queries with Spring Data R2DBC
  • Data caching for faster queries
  • Dependency Injection
  • Automated tests
  • Containerization with docker
  • Load Distribution with Load Balancer

Get started

In the project, an example environment variables file will be available. The project will start using it, if you want to change the database user and password, or some other value, feel free

  1. Clone git repository with modules

    git clone https://github.com/WeversonL/rinha-backend.git
    cd rinha-backend
    

Running the application with docker-compose

  1. Start with docker-compose

    docker-compose up -d
    

You can access the API via load balancer, sending requests to localhost:9999. Due to resource limitations, it is necessary to wait a while for the entire application to be up and running.

API Endpoints

The endpoints offered are based on those requested by the challenge!!

To make the HTTP requests below, the httpie tool was used:

  • Create a person
$ http POST :9999/pessoas apelido="nickname" nome="My Name" nascimento="2003-01-22" stack:='["Java", "C", "Python"]'

[
    {
        "id": "b987f790-7c92-42ca-ab99-2358adcd5e38",
        "nome": "My Name",
        "apelido": "nickname",
        "nascimento": "2003-01-22",
        "stack": [
            "Java",
            "C",
            "Python"
        ]
    }
]
  • Get person by id
$ http GET :9999/pessoas/{id}

[
    {
        "id": "b987f790-7c92-42ca-ab99-2358adcd5e38",
        "nome": "My Name",
        "apelido": "nickname",
        "nascimento": "2003-01-22",
        "stack": [
            "Java",
            "C",
            "Python"
        ]
    }
]
  • Get person by term

In this endpoint you can search for people by any term. It will check whether the term entered appears in any of the columns. For example, knowing if there is someone in my bank who has a STRING with the value "John"

$ http GET ':9999/pessoas?t=nickname'

[
    {
        "id": "b987f790-7c92-42ca-ab99-2358adcd5e38",
        "nome": "My Name",
        "apelido": "nickname",
        "nascimento": "2003-01-22",
        "stack": [
            "Java",
            "C",
            "Python"
        ]
    }
]

$ http GET ':9999/pessoas?t=2003-01-22'

[
    {
        "id": "b987f790-7c92-42ca-ab99-2358adcd5e38",
        "nome": "My Name",
        "apelido": "nickname",
        "nascimento": "2003-01-22",
        "stack": [
            "Java",
            "C",
            "Python"
        ]
    }
]

$ http GET ':9999/pessoas?t=python'

[
    {
        "id": "b987f790-7c92-42ca-ab99-2358adcd5e38",
        "nome": "My Name",
        "apelido": "nickname",
        "nascimento": "2003-01-22",
        "stack": [
            "Java",
            "C",
            "Python"
        ]
    }
]

License

Rinha Backend is MIT licensed.

rinha-backend's People

Contributors

weversonl avatar

Watchers

 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.