Skip to content

flo-finance/flo-tokenize-with-privy

Repository files navigation

flo-tokenize-with-privy

CI License: MIT

Email login → embedded wallet → tokenized AAPL in three clicks.

Heads up. The Flo sandbox API is in private beta for design partners. With no FLO_SANDBOX_KEY set, this demo runs in mock mode and returns canned mint responses. To call the live sandbox, apply for design-partner access.

A Next.js demo that pairs Privy (email-and-social-login embedded wallets) with Flo (tokenized US equity infrastructure). User signs in with email, Privy provisions an EVM wallet for them, and a single button mints fAAPL into that wallet on Base.

This is the integration most consumer fintechs in MENA, LatAm, and SEA actually need: their users don't have wallets, don't want to install MetaMask, and definitely don't want to write down a seed phrase.

What it does

  1. User clicks Continue with email. Privy sends a one-time code.
  2. Privy mints them a non-custodial EVM wallet behind the scenes. No browser extension. No seed phrase shown by default.
  3. User clicks Tokenize 10 AAPL. The server action calls Flo's /v1/mint against the user's Privy-issued wallet address.
  4. fAAPL lands in the user's wallet on Base.

Privy setup (one-time, takes 2 minutes)

  1. Sign up at dashboard.privy.io and create an app.
  2. Copy the App ID into .env.local as NEXT_PUBLIC_PRIVY_APP_ID.
  3. In the Privy dashboard, go to Configuration → Allowed origins and add http://localhost:3000. Without this, embedded wallet creation will fail with a CORS error.
  4. Enable email and Google login methods (under Login methods).

Run it

git clone https://github.com/flo-finance/flo-tokenize-with-privy
cd flo-tokenize-with-privy
cp .env.example .env.local
# Set NEXT_PUBLIC_PRIVY_APP_ID from the Privy dashboard
# (FLO_SANDBOX_KEY is optional, demo runs in mock mode without it)
npm install
npm run dev

Open http://localhost:3000, sign in with any email, hit Tokenize.

What's happening under the hood

Flo handles the broker-dealer leg (Interactive Brokers and Alpaca Securities, behind a routing layer), custody under SEC Rule 15c3-3, the SPV that issues the structured note, and the on-chain mint on Base. Privy handles wallet provisioning and key management. The integrator holds neither the wallet nor the underlying.

The user-facing leg is instant. The broker-to-exchange leg settles T+1 against DTCC and the Flo SPV absorbs that lag at the issuer level, so the user-facing experience doesn't see it.

Going live

Live mode requires KYB review with Flo (about two business days) and Privy production credentials. Swap the sandbox key, point at api.flo.finance, and ship.

Useful next steps

License

MIT.

About

Email login → embedded wallet → tokenized AAPL. Flo + Privy demo in Next.js.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors