How mitchyugan/obscura-frontend works
1. Repository scope
This repo is the Next.js 15 frontend for Obscura, a Starknet dapp for shielded strkBTC payments. The on-chain shielded pool and ERC20 token are described in the README, but the file tree here is primarily the UI + wallet orchestration layer, not the Cairo contract source itself.
2. Top-level app structure
The app uses the Next.js App Router. app/layout.tsx and app/globals.css provide the global shell and styling, while app/page.tsx is the public landing page. app/app/page.tsx is the main authenticated dapp surface where wallet actions and pool operations happen.
3. Main user flows
The frontend centers on three flows: connect a wallet, inspect balances/status, and execute pool actions such as deposit, withdraw, transfer, and faucet/mint-related actions. These flows are coordinated through shared wallet state and then dispatched to Starknet contracts.
4. Wallet and account orchestration
store/wallet-context.tsx is the primary client-side state boundary. It likely tracks the selected wallet type, connection status, account/address, contract instances, and transaction state. This is the central bridge between UI components and chain interactions.
5. Connection layer
components/frontend/connect-button.tsx, connect-modal.tsx, and privy-provider.tsx implement the wallet onboarding experience. The README shows two wallet modes:
- Social login via Privy/StarkZap, backed by server-side signing
- Browser wallets via get-starknet-core / Starknet.js
This creates a split between extension-based signing in the browser and managed social-login accounts.
6. Backend signing API
The only backend routes are under app/api/wallet/:
- app/api/wallet/sign/route.ts
- app/api/wallet/starknet/route.ts
These are the server-side trust boundary for social-login wallet operations. They exist to support signing/account-related Starknet actions without exposing private credentials to the browser.
7. Contract interaction layer
lib/contracts.ts is the main chain integration module. It likely holds:
- deployed contract addresses from env/config
- ABIs / call selectors
- helpers for creating contract instances and formatting Starknet calls
This module is the standard entry point from UI state into on-chain reads/writes.
8. Transaction-oriented UI
components/pool/ contains the action forms:
- deposit-form.tsx
- withdraw-form.tsx
- transfer-form.tsx
- faucet-form.tsx
These map directly to the pool’s contract operations and likely consume wallet context plus contract helpers. They are the main “write” surfaces of the app.
9. Read/feedback surfaces
components/frontend/balance-cards.tsx presents user and pool balances, while components/frontend/tx-status.tsx provides transaction lifecycle feedback. Together they form the main read-only feedback loop from chain state back to the user.
10. Shared UI primitives
components/ui/ contains reusable presentation primitives (button, card, dialog, input, label, badge). These are generic building blocks used across wallet onboarding and pool forms, keeping domain logic out of the visual layer.
11. Styling and app shell
The app uses Tailwind-based component styling with components.json, globals.css, and standard Next.js layout files. This indicates a client-heavy dapp UI with no separate design-system service or rendering backend.
12. External dependencies that matter architecturally
The architecture depends on:
- Starknet Sepolia RPC for chain reads/writes
- Privy for social login identity
- AVNU paymaster for gas sponsorship on social-login flows
- Browser wallets for self-custodied signing
These are not just libraries; they define the key trust and execution boundaries of the app.
13. End-to-end data flow
A typical transaction path is: user action in a pool form → wallet context resolves signer/account → contract helper builds Starknet call → either browser wallet signs locally or API route assists social-login signing → RPC sends transaction → tx status component reflects result → balance cards refresh on-chain state.
14. Architectural takeaway
The repo is a thin frontend over Starknet contracts, with most complexity concentrated in wallet connection, signing mode selection, and transaction UX. There is no evident database, job queue, or server-side business logic beyond the wallet/signing API routes.
Main entry points: page.tsx Dapp page · wallet-context.tsx Wallet state · contracts.ts Contracts · ui UI kit
Components 18
App shell
Next.js routes, layout, and global styling for the dapp.
Wallet layer
Connection, identity, and signing orchestration.
- Wallet state · Central client state for account, connection, contracts, and tx flow.
store/wallet-context.tsx - Connect btn · Entry point for wallet connection.
components/frontend/connect-button.tsx - Connect modal · Wallet onboarding and mode selection UI.
components/frontend/connect-modal.tsx - Privy provider · Social-login identity and wallet provider integration.
components/frontend/privy-provider.tsx
Pool actions
User-facing transaction forms for shielded pool operations.
- Deposit · UI for depositing into the shielded pool.
components/pool/deposit-form.tsx - Withdraw · UI for withdrawing from the shielded pool.
components/pool/withdraw-form.tsx - Transfer · UI for shielded transfer actions.
components/pool/transfer-form.tsx - Faucet · UI for mint or faucet-related actions.
components/pool/faucet-form.tsx
Shared UI
Reusable presentation primitives and chain helpers.
- Contracts · Starknet contract addresses, instances, and call helpers.
lib/contracts.ts - Balances · Read-only balance and pool status display.
components/frontend/balance-cards.tsx - Tx status · Transaction lifecycle and result feedback.
components/frontend/tx-status.tsx - UI kit · Reusable visual primitives used across the app.
components/ui
Backend API
Server-side signing endpoints for social-login wallet flows.
- Sign API · Server-side signing endpoint for wallet operations.
app/api/wallet/sign/route.ts - Starknet API · Backend route supporting social-login Starknet actions.
app/api/wallet/starknet/route.ts
Connections 28
- Layout → Privy provider: wraps · The app shell includes the social-login provider boundary.
- Layout → Globals: loads · Global layout applies shared styles.
- Landing → Connect btn: uses · Public landing page exposes connection entry point.
- Dapp page → Wallet state: consumes · Authenticated surface reads shared wallet state.
- Dapp page → Balances: shows · Main surface displays balances and pool status.
- Dapp page → Tx status: shows · Main surface displays transaction feedback.
- Dapp page → Deposit: hosts · Main surface contains pool action forms.
- Dapp page → Withdraw: hosts · Main surface contains pool action forms.
- Dapp page → Transfer: hosts · Main surface contains pool action forms.
- Dapp page → Faucet: hosts · Main surface contains pool action forms.
- Connect btn → Connect modal: opens · Connection button launches wallet chooser modal.
- Connect modal → Wallet state: updates · Selected wallet mode and session state flow into shared store.
- Privy provider → Sign API: authenticates · Social-login flows rely on backend signing support.
- Privy provider → Starknet API: authenticates · Social-login Starknet actions are mediated by server routes.
- Wallet state → Contracts: drives · Wallet state resolves contract access and call execution.
- Wallet state → Sign API: routes · Managed-wallet flows delegate signing to the server boundary.
- Wallet state → Starknet API: routes · Managed-wallet flows delegate Starknet actions to the server boundary.
- Deposit → Contracts: calls · Deposit form submits Starknet contract actions.
- Withdraw → Contracts: calls · Withdraw form submits Starknet contract actions.
- Transfer → Contracts: calls · Transfer form submits Starknet contract actions.
- Faucet → Contracts: calls · Faucet form submits mint-related contract actions.
- Balances → Contracts: reads · Balance cards reflect on-chain state.
- Tx status → Wallet state: observes · Tx feedback tracks the shared transaction state.
- Connect btn → UI kit: uses · Connection UI is built from shared primitives.
- Deposit → UI kit: uses · Pool forms use shared inputs and controls.
- Withdraw → UI kit: uses · Pool forms use shared inputs and controls.
- Transfer → UI kit: uses · Pool forms use shared inputs and controls.
- Faucet → UI kit: uses · Pool forms use shared inputs and controls.