Moving a Fintech startup to an Event Driven Architecture
From synchronous API requests to queues, isolated workers and event-driven serverless processing, and why peak payroll days forced us to rethink the architecture.
01
Summary
At the start, we did most of the work inside the API request itself. That worked fine on a normal day.
But this client runs a payroll and tips product, so traffic is never flat. On pay days, load increases many times over, and on those days the original design started to fail:
–
Database connection pool limits
–
Gateway request timeouts
–
Slow jobs blocking unrelated users
–
Difficult recovery and retries
–
Bursts of requests hitting third-party providers simultaneously
The fix was to move the heavy work out of the request entirely. We introduced queues, made processing asynchronous, and later built the financial platform on serverless functions triggered by events.
The result: pay days are now normal days.
This case study covers the specific problems we faced, what we changed, what we gained, and what the architecture still costs.
02
How it worked before
The original design was simple, and correct for the load it was handling at the time.
Every request followed the same path. Everything happened in one place, inside the API request, and the user waited until all of it finished.
This was not a flawed architecture. It was easy to build, easy to debug, and appropriate for the scale we had. The problem came when the scale changed, and the shape of the traffic changed with it.
03
The problems we faced
3.1
Pay day peaks
Our load is not spread evenly. Most traffic arrives in a few hours, on specific days:
–
Pay days: many businesses run payroll at the same time
–
End of business day: tips are calculated and distributed for each location
–
Month end: reports and reconciliation run
On a normal day, the system was fine. On a pay day, the same system was under serious pressure. This was not an average load problem. It was a peak load problem, and that distinction matters, because average load thinking leads to the wrong architectural decisions.
3.2
Database connection pool limits
This was the first hard limit we hit. Every request doing real work needs a database connection. When many requests arrive simultaneously, they all compete for the same pool.
The worst part was not that heavy jobs failed. A simple login request could also fail because no connection was available. One heavy job could take down the entire API for every user.
We introduced a connection pooler in front of the database, with a per-tenant connection limit. That helped, but it was not enough on its own. A pooler manages connections more efficiently, but if you keep sending the same volume of work at the same time, the pressure remains. We needed a layer that could control how much work arrived at once. That is what queues gave us.
3.3
API and gateway timeouts
A load balancer and an API gateway will not wait forever. They have an idle timeout, and if a handler runs longer than that limit, the gateway gives up.
There is a deeper problem here. The gateway gives up, but the server may still be processing the request. The user sees a failure. The work may have actually succeeded. The user presses the button again. The same work may run twice.
For a standard feature, this is annoying. For money movement, it is dangerous. We can pay someone twice.
3.4
One slow thing blocks everything
A large tip distribution running inside an API request holds a database connection, a worker process, and CPU resources for an extended period. During that time, other users cannot get the same level of service.
There was a second version of this problem. If our card or transfer provider became slow, our request sat open waiting for their response. A slow third party became our problem directly, because we were the ones waiting.
3.5
Retry was very difficult
If a process crashed halfway through, we had no clean way to continue. State existed mainly in memory. We did not always know what had finished, what had failed, where it had failed, or what could safely run again.
Someone had to inspect the database manually and fix it. For a payroll product, that is not acceptable. You need to know exactly what happened, and you need to be able to continue safely.
3.6
We were sending bursts to our providers
Our providers have rate limits. If we tried to send thousands of transfers within a few seconds, the provider pushed back.
These were failures caused by our own burst behaviour, not by any business logic error. But we still owned the cleanup.
04
What we changed
We changed the shape of the work.
The request accepts the work; it does not do the work.
The API now accepts, validates, saves, queues, and returns. A background worker handles the heavy processing.
4.1
Queues: the first step
We introduced a job queue system on top of Redis. This was probably the single biggest improvement, and also the easiest major architectural change, because it did not require replacing our infrastructure.
The new flow:
–
The API receives the request
–
It validates it and saves the record
–
It puts a job in the queue
–
It returns 202 Accepted immediately
–
A worker picks up the job and performs the real work
The user gets a response in milliseconds instead of waiting for the entire process.
We now run close to 90 job queues across our services, covering:
–
Card issuing, transfers, and earned wage access
–
Provider event processing
–
Tip calculation, tip finalisation, and reconciliation
–
POS data synchronisation
–
Scheduled syncs, file imports, and token refresh
–
Notifications and reporting
Retry is now automatic. Our default job policy retries a failed job several times using exponential backoff. If a provider goes down for a minute, the job retries. Nobody has to do anything.
4.2
We gave the workers their own servers
Putting work in a queue is not enough if the worker runs on the same server as the API. The CPU and resources are still shared.
We deployed our workers separately. Today we run four independent service types, each sized for its own workload. A heavy tip run cannot slow down a login request. They are not running on the same machine.
4.3
We added a dial to control the load
This is the change that directly fixed the database connection pool problem. Every queue worker has a concurrency setting and a rate limiter. We keep these values in our secrets configuration, which means we can adjust them without deploying code.
What we control:
–
How many jobs can run at the same time
–
Maximum jobs within a time window
–
How long a worker holds a job before releasing it
–
Separate limits for our slowest provider integrations
That last point matters. We can slow down one provider integration without affecting everything else. Before, traffic decided how many database connections we used. Now we decide.
If the database comes under pressure, we lower the concurrency. The work is not lost. It processes more slowly and waits in the queue. The queue became a buffer between our traffic and our database.
4.4
We protect our providers the same way
We apply the same principle to third-party providers. Our transfer handler is deliberately configured to process transfers at a controlled rate, with a small concurrency limit.
The provider sees a steady, controlled flow. No sudden burst. No unnecessary rate-limit errors.
4.5
Serverless and event triggers: the financial platform
Later, we built the financial platform on AWS serverless. The architecture here is different, and I think it is better.
The key idea: we do not publish an event separately. The database write is the event.
Because the write and the event are the same action, it is not possible to save the data and then forget to send the event. That is a real failure mode in many event systems. This design avoids it.
The financial platform currently runs:
–
20+ serverless consumers
–
20+ queues
–
1 central event bus
–
Multiple routing rules
–
10 independent stacks
With serverless, we do not manage servers and we do not pay for idle capacity. Quiet days cost very little. Pay days scale automatically. For traffic shaped like ours, the fit is strong. But we still maintain control: every function has a concurrency limit. Automatic scaling does not mean unlimited scaling.
4.6
Failures are now visible
Every queue has a Dead Letter Queue (DLQ). After a fixed number of failed attempts, the message moves to the DLQ. Every DLQ has an alarm that sends a message to Slack. If something fails, we know within a minute. We do not wait for a customer to tell us.
We use one shared helper for this so nobody can accidentally skip the monitoring setup. The reliability policy is consistent across services: small fixed retry count, message retention, longer DLQ retention, then investigation.
05
How a tip payment works now
Here is the full end-to-end flow.
01
Schedule
A scheduled job runs for each location at its configured time, using that location's own timezone.
02
Calculation
The scheduled job calls the tip service. The service claims the step, puts a job into the calculation queue, and immediately returns 202 Accepted.
03
Worker
A worker takes the calculation job, calculates the tips, and writes the results.
04
Finalisation
The same asynchronous pattern runs again. Before money moves, the job checks the safety gates: is the location paused? Is there an operator hold? Only after those checks does it dispatch the money.
05
Money movement
The payment service saves the batch and queues the transfers. Transfers are intentionally sent slowly and steadily so the provider is not overloaded.
06
Provider response
The provider responds later through a webhook. We also poll as a backup in case the webhook is delayed or lost.
07
Callback
The payment service calls the tip service back. That callback is also queued. The request returns immediately.
08
UI
The dashboard polls the status every few seconds until the step is finished.
Every step is asynchronous. No step waits for the next one.
06
What we gained
6.1
The peak problem is solved
Pay days are no longer special. Traffic still increases, but the API does not feel the same pressure because it is not doing the heavy work. The gateway timeouts we used to see on peak days are gone: requests do not stay open long enough to hit those limits. The database is no longer the first thing to break, because we control how much work reaches it.
6.2
A failure is now small
Before, one failure could affect the whole API. Now, one failure affects one message in one queue. The other queues keep running. The blast radius became very small.
6.3
We can retry safely
The job is now a durable record, not an in-memory state. We can retry it. But retries introduce a hard requirement: idempotency.
Our workers are designed to be idempotent. A worker can safely run again even if it partly completed the first time. This is now a hard rule in our engineering standard. Without idempotency, retries can become more dangerous than the original failures.
6.4
We can add features without touching old code
This became especially useful in the financial platform. Adding a new consumer does not require changing the code that originally produced the event. This is how we added fraud velocity checks and risk analytics: both consume events that already existed.
6.5
Deploys are safer
Our stacks and services deploy independently. A change to notifications does not require deploying transfer code. A problem in one deployment has a much smaller chance of affecting unrelated parts of the platform.
07
What I learned
1
Queues are not only for speed. They are for control.
This was probably the most important shift in thinking. The most valuable thing we gained was not faster API responses. It was this: we can decide how much work hits the database at one time. That is what actually fixed the connection pool problem.
2
Move workers to their own servers.
Adding a queue does not automatically isolate the workload. If your API and queue workers share the same CPU and memory, a heavy worker can still hurt your API. Separate workload means separate resources.
3
Make workers idempotent from day one.
Do not treat idempotency as something to add later. If a worker cannot safely execute twice, your retry system becomes a danger instead of a safety feature. Design every important worker with retries in mind from the beginning.
4
Let errors throw.
Do not catch an error inside a worker just to log it and pretend the job completed. If the error throws, the job fails visibly: it is retried, and if it keeps failing it moves to the DLQ and raises an alarm. If you catch and hide it, the job looks complete, nothing retries, and nobody knows.
Silent failure is worse than visible failure.
5
Async is not free.
This architecture solved a real production problem, and we would make the same decision again. But it also introduced more queues, more workers, more infrastructure, more monitoring, more failure states, more eventual consistency, and more operational knowledge. That complexity will stay with us for years.
The lesson is not "everything should be event-driven." The lesson is: use asynchronous, event-driven processing where you actually need it. Keep the simple synchronous path where you do not.
08
Final takeaway
We did not move this fintech startup to an event-driven architecture because it was a more modern approach.
We moved because the synchronous architecture had reached a point where peak traffic, database limits, long-running work, provider rate limits, and failure recovery were becoming production problems.
The progression was natural: synchronous requests, then queues, then isolated workers, then concurrency and rate controls, then serverless event processing. Each step solved a problem we had actually experienced.
The biggest change was not that the system became faster. The biggest change was that we gained control over when, where, and how much work the system processes.
If you are building a financial product and your synchronous stack is starting to show the same signs, the work we did here is a reasonable playbook.
09
FAQs
What is event-driven architecture in the context of a fintech product?
Event-driven architecture means that actions in the system produce events, and separate consumers react to those events asynchronously. In a fintech context, this typically means a database write or a state change triggers downstream processing, such as a transfer, a notification, or a reconciliation job, without the original request waiting for any of that work to complete.
Why did synchronous API requests cause problems on pay days?
What is a Dead Letter Queue and why does it matter for financial systems?
How does idempotency relate to queue-based processing?
What is the difference between using queues and using serverless event consumers?
How many queues does a production fintech system like this actually need?
When should a startup not move to event-driven architecture?
AT A GLANCE
INDUSTRY
FinTech (payroll & tips)
MARKET
United States
SCALE
~90 job queues across our services
ARCHITECTURE
Queues, isolated workers, serverless events
INFRASTRUCTURE
Redis queues + AWS serverless
OUTCOME
Pay days are now normal days
SERVICES
Event-driven architecture
Queue-based processing
Serverless on AWS
STACK
Redis
AWS Serverless
Dead letter queues
Webhooks
Slack alerts
→
