99
Matheus Saleh
Back to inventory
Case study#03

Crypto Wallet

  • React
  • TypeScript
  • Vite
  • TanStack Query
  • NestJS
  • Prisma
  • PostgreSQL

A simulated wallet for BRL, BTC, and ETH with a React dashboard, a NestJS API, and CoinGecko market rates.

Application
Authenticated dashboard and REST API
Hosting
Client and Server on Vercel
Persistence
PostgreSQL on Neon
Documentation
Swagger / OpenAPI
Dashboard with BRL, BTC and ETH balances and recent activity

The project

I built two projects that work together to simulate a digital wallet. The Client displays balances and activity and lets users review a conversion before confirming it. The Server applies the rules for each operation, updates balances, and records the changes in a ledger.

Screenshots

See the dashboard, the conversion review, the wallet ledger, and the API documentation.

Client · React Dashboard(3)

  • Balances, market quotes, and recent activity
  • Reviewing a conversion before confirmation
  • Paginated ledger of wallet activity

Server · Swagger API Docs(1)

  • Interactive API documentation in Swagger

These screenshots were published in the project repositories and show demo data. The live dashboard requires sign-in. The Swagger documentation is public.

Features

The API handles registration and the wallet operations available in the dashboard.

  • Wallet access

    Registration creates balances in BRL, BTC, and ETH. Sessions use a JWT access token and a refresh token.

  • Currency conversion

    The preview shows the rate, fee, net amount, and effect on balances. The receipt displays the amounts confirmed by the API.

  • Auditable ledger

    The ledger records balances before and after each movement. The dashboard displays entries with pagination.

  • Deposits and withdrawals

    Deposits use a webhook with an idempotency key. Withdrawals are validated against the available balance.

  • Market rates

    The dashboard polls the BRL ticker every minute. The conversion preview refreshes the active pair's quote every 30 seconds.

  • Responsive interface

    The dashboard offers light and dark themes, with React Hook Form and Zod validation.

Architecture

The Client calls the REST API over HTTPS. The Server queries CoinGecko, applies wallet rules, and writes to PostgreSQL through Prisma.

ClientReact 19 · TypeScript · Vite
  • React Router protects dashboard routes. Axios coordinates session refresh.
  • TanStack Query caches balances and ledger entries and refreshes them after each operation.
  • Tailwind CSS styles the responsive layout and themes.
ServerNestJS 11 · Prisma 7 · PostgreSQL
  • Modules for authentication, wallets, webhooks, withdrawals, conversions, the ledger, and rates.
  • Balances, history, and related ledger entries are written in the same database transaction.
  • Swagger/OpenAPI documents JWT-protected routes and public endpoints such as the market ticker.

Technical decisions

DecisionReasonConsideration
Deposit idempotency keyPrevents the same deposit event from being credited twice on retry.The webhook sender must reuse the same key on retry.
Balance and ledger in one transactionKeeps the balance change and its audit record together.Related writes must use the same transaction.
Fresh quote at executionThe API calculates the final amount using a quote fetched at confirmation.The final amount can differ from the preview as prices move.
Explore the API source

Rules and tests

wallet currencies
3
conversion fee
1.5%
ticker cache
60 s

The Server includes Jest tests for conversions, insufficient balances, ledger consistency, and quote cache behavior.

Demo scope

  • Balances and movements are simulated. Market rates come from CoinGecko.

Try Crypto Wallet

Sign in to explore the wallet flows or open Swagger to browse the API routes.

Achievement Unlocked!