[FULLSTACK_02] · Personal project · full stack
TradeFlow
Bitcoin trading simulator with double-spend prevention and financial precision.
- React Native
- Laravel 11
- PostgreSQL
- Redis
- Docker

[01] Problem
Simulate real trading, with concurrent orders, money precision and live prices, without the shortcuts a demo usually takes.
[02] Solution
- Two-layer lock against double-spend: a Redis distributed lock before any trade logic, plus lockForUpdate() inside a database transaction.
- Money math with bcmath and DECIMAL(20,8) columns, never floats.
- BTC price cached in Redis for 30 s; the app polls every 10 s with React Query.
- A typed InsufficientFundsException becomes an HTTP 422 with a readable message, shown in a toast.
[03] Result
- Users start with R$ 10,000 in virtual balance and always see a price at most 30 s old.
- Every trade is logged with price, amount and timestamp.
[04] Architecture
- React Native app
- Laravel 11 API
- Redis · lock + price cache
- PostgreSQL · row lock