Architecture

The Underwriting API decides whether a user is eligible for a float or loan. It exposes a REST API for eligibility checks and profile management — called by floatme-flutter, by float-service (server-side re-check before creating a float), and by admin-api / backoffice — and runs an asynchronous rule pipeline that re-evaluates users whenever new data arrives.

System context

System context

Two evaluation paths exist:

  • Event-driven — new transactions, new insights, or an explicit recalculate event trigger a rule run via SQS; results are stored and served from cache on the next API call.

  • Instant — POST /{user_id}/underwriting/instant invokes the rule runner and result runner Lambdas synchronously and returns a fresh result in one request.

Details: Rule Engine.

Components

Lambda Trigger Purpose

api

API Gateway (ANY /{proxy+}, AWS_IAM)

REST API: float/loan/eligibility checks, profiles, history; renders the float decision

rule-runner

SQS tap; direct invoke (instant path)

Fetches user data from peer services, runs the CFI increase check, executes rules, stores outcomes

result-runner

SQS tap; direct invoke (instant path)

Aggregates rule outcomes into the final decision, persists the evaluation, sends the early-advance notification

float-created-handler

SQS tap (user_float_created)

Preserves a permanent historical evaluation, settles the ML result, sends the risk score to Segment, triggers a rule re-run

profile-handler

SQS tap (new_bank_account_added)

Creates the default float profile for a user’s first bank account

Source: cmd/, deploy/lambda.tf

Physical configuration (memory, timeouts, IAM, queues): Infrastructure.

External dependencies

Dependency Kind Role

user-service

REST

User status, memberships (premium fee waiver), Firebase app instance ID for ad events

txn-service

REST

Bank transactions, primary account

float-service

REST + events

Float history, collection logs; emits user_float_created

payments

REST

Collection payments (early-advance verification)

subscription-service

REST

Subscription term and payment history

loc-service

REST

Open loans (good standing)

insight-service

REST + events

Employment data, next payday; emits user_new_insights_available

SageMaker

inference

Rule-ML endpoint, payback predictor v2 endpoint, feature store

GrowthBook

config

Feature flags and fee schedule — Feature Flags

Segment

events

CFI limit-change analytics; float-created risk score for ad targeting

Iterable

events

Early-advance user notification

Datadog

metrics

Metrics and SLOs

DynamoDB

storage

Single-table data store — DynamoDB

Source: deploy/main.tf, deploy/lambda.tf