Merchant dashboard and customer payment portal for the DupDub crypto-to-fiat settlement platform.
This is the Next.js app merchants use to manage payments and settlements, and the page customers land on to pay a merchant with USDC on Stellar. It talks exclusively to the dupdap-backend REST API — there is no direct on-chain write path from the frontend itself beyond what the customer's wallet signs.
Related repos:
dupdap-backend— the API this app calls (NEXT_PUBLIC_API_URL)dupdapp_stellar— the Soroban contracts (payment_escrow, etc.) that the customer payment flow ultimately settles into
The customer-facing payment flow here is built around Stellar, not a generic multi-chain wallet connector:
- One asset, one chain to reason about — the payment page only needs to handle Stellar/USDC, so there's no chain-switching UX, no gas-token juggling, and no per-network RPC config on the client.
- Sub-second-feeling confirmations — Stellar's ~5s ledger close means the "waiting for payment" state on
/pay/[paymentId]resolves fast enough to keep a checkout flow feeling responsive. - Escrow, not a bare wallet transfer — the customer flow is approve → deposit into the
payment_escrowSoroban contract, not a raw transfer to a merchant address, so funds are held under contract logic until settlement conditions are met (seedupdapp_stellar). - Fees low enough for small payments — near-zero base fees keep the platform viable for low-ticket merchant transactions.
/ marketing/landing page
/waitlist public waitlist signup
/auth/login merchant login
/auth/register merchant registration
/pay/[paymentId] customer-facing payment page (approve → deposit → status → receipt)
/dashboard merchant dashboard shell (layout.tsx wraps the routes below)
/dashboard overview
/dashboard/payments payment list/detail
/dashboard/settlements merchant settlement tracking
/dashboard/analytics revenue/conversion analytics
/dashboard/webhooks webhook endpoint management
/dashboard/settings profile, API keys, notification prefs
/dashboard/admin internal/admin views
/dashboard/admin/settlements
src/lib/api.ts— a single Axios instance (NEXT_PUBLIC_API_URL, defaulthttp://localhost:3000/api/v1) with:- a request interceptor that attaches
Authorization: Bearer <token>fromlocalStorage - a response interceptor that clears the token and redirects to
/auth/loginon401 - grouped API helpers (
authApi,paymentsApi, …) rather than ad-hoc fetches scattered through components
- a request interceptor that attaches
src/lib/store.ts— Zustand +persistfor auth state (token,merchant), persisted tolocalStorageunder thedupdub-authkey. This is the only global client state; everything else (payment lists, analytics, etc.) is fetched per-page throughapi.ts.src/lib/utils.ts— shared formatting/className helpers (clsx+tailwind-merge).
- Approve USDC allowance for the escrow contract (
approve(escrow_contract, amount)) - Deposit into escrow (
deposit()), which pulls funds viatransfer_from - Customer confirms/signs in their own wallet — the app never touches a private key
- Frontend polls the backend for payment status (
GET /payments/:id/status) until it's confirmed/settled - Receipt view once settled
- Framework: Next.js 14 (App Router), React 18, TypeScript
- Styling: Tailwind CSS (custom
brandcolor scale intailwind.config.ts) - State: Zustand (with
persistfor auth) - HTTP: Axios, with interceptors for auth + 401 handling
- Blockchain:
@stellar/stellar-sdk(client-side Stellar operations for the payment flow) - UI utilities:
lucide-react(icons),clsx+tailwind-merge,react-hot-toast(notifications) - Data viz:
recharts(dashboard analytics) - QR codes:
qrcode.react(payment request QR codes) - Dates:
date-fns
Note: this app does not currently use a wallet-connector library (wagmi/viem/RainbowKit) or ship a PWA manifest/service worker — if you've seen references to those in older platform docs, treat them as roadmap items, not what's implemented today.
- Node.js 18+
- A running
dupdap-backendinstance (or a deployed API you can point at)
# Install dependencies
npm install
# Set up environment variables
cp .env.local.example .env.local
# Edit .env.local — see below
# Start development server
npm run dev
# Build for production
npm run build
# Start production server
npm run start
# Lint
npm run lintThe app runs at http://localhost:3001 by default (or whatever port next dev picks if 3000 — the backend's default — is taken).
Full list in .env.local.example:
# Backend API base URL — must include the /api/v1 prefix
NEXT_PUBLIC_API_URL=http://localhost:3000/api/v1That's the only required variable today. next.config.js also falls back to http://localhost:3000/api/v1 if it's unset, so local dev works against a locally-running backend with zero config.
If you're pointing this at a deployed backend, set it to that backend's public URL including the /api/v1 prefix, e.g.:
NEXT_PUBLIC_API_URL=https://api.dupdub.xyz/api/v1This app is a pure client of dupdap-backend's REST API — see that repo's README for the full endpoint list and its Swagger docs (/docs on the backend) for request/response shapes. The helpers in src/lib/api.ts currently cover:
authApi— register/loginpaymentsApi— create/list/get/stats for payments
Extend api.ts with additional grouped helpers (e.g. settlementsApi, webhooksApi, merchantsApi) as dashboard pages need them, rather than calling api.get(...) directly from components, to keep endpoint paths in one place.
npm run lint # next lint (ESLint, see .eslintrc.json)There is no test suite in this repo yet — if you add one, wire it into this section and into CI.
vercel --prodThe app is a standard Next.js app, so any platform that supports Next.js (Vercel, Railway, etc.) works. The only required runtime config is NEXT_PUBLIC_API_URL pointed at the deployed backend.