NICOLÁS BOTTARINI
Tokencars

Tokencars

Year:2022
Industry:
FintechStartup
Deliverables:
androidioswebbackend
Technologies:
KotlinMongoDBJavalinRabbitMQReact NativeTypeScriptNext.jsAWSKubernetesTerraform
Technical focus:
TDDContinuous DeliveryDDDClean Architecture

Introduction

Tokencars was a startup that tokenized luxury and collectible cars: each car was divided into tokens, and anyone could buy a part and later sell it.

We built the complete product: the mobile app, the backoffice, the API and the infrastructure.

Screens

What the app did

  • Car catalog, with photos, car price, token price and number of tokens available.
  • Token purchase and a secondary market, where users posted sell orders and others bought them.
  • Wallet with the balance, the token portfolio and the history of operations.
  • Deposits and withdrawals with credit card and with stablecoins.
  • A PIN to confirm each transaction, and comments and favorites on each car.

Technical approach

I led the project technically: I defined the architecture, led the team and coded the hardest parts with them.

  • The API was a modular monolith in Kotlin with Javalin and MongoDB. It had four modules (marketplace, exchange, ledger and security), each one with its application, domain, HTTP and infrastructure layers.
  • Each module exposed a facade: a class with the operations the other modules could use. For example, the ledger's facade allowed creating wallets, minting tokens and recording trades. Internally, the facade ran the module's commands and queries through a bus. The modules were wired up in a single place, which gave each one the facades of the modules it needed, so the dependencies between modules were explicit.
  • Modules also reacted to events. For example, when a crypto deposit came in, exchange converted it to dollars and credited it in the ledger.
  • Each command declared which roles could run it, and a bus middleware checked the permissions.
  • We developed the API with TDD. Use cases were tested with in-memory repositories and with the other modules' facades mocked, so each module was tested in isolation. On top of that, the endpoints had end-to-end tests.
  • Token ownership was recorded in an external ledger, card payments went through Decidir and crypto deposits through CryptoCheckout. The integrations were behind domain interfaces, with simulated implementations for development and tests.
  • Asynchronous tasks were processed with a worker and RabbitMQ.
  • The app was built in React Native and the backoffice in Next.js, both with TypeScript.
  • The infrastructure ran on AWS on Kubernetes (EKS) and was provisioned with Terraform.
  • There was a GitHub Actions pipeline for each component: API, backoffice, app and infrastructure.
Infrastructure
AWS infrastructure