This is the web frontend monorepo for Lendasat, built with Turborepo and Vite.
Install dependencies:
pnpm installRun the development servers:
pnpm devThis Turborepo includes the following packages and apps:
-
apps/iframe: Main Lendasat borrower application (runs in iframe)- React Router v7 app
- Communicates with parent wallet via wallet-bridge
- Manages loan contracts, applications, and offers
-
apps/sample-wallet: Demo wallet application for testing- Embeds the iframe app
- Implements wallet-bridge provider
- Shows how to integrate Lendasat into a wallet
-
@lendasat/lendasat-wallet-bridge: Communication bridge between iframe and parent wallet- Type-safe PostMessage API
- Handles authentication, signing, and wallet capabilities
- Exports
LendasatClient(for iframe) andWalletProvider(for parent wallet)
-
@repo/api: API client for Lendasat backend- OpenAPI-generated TypeScript client
- Handles authentication, contracts, offers, and applications
- Price context provider
-
@repo/ui: Shared UI components- Button, Spinner, and other reusable components
- Tailwind CSS styling
-
@repo/eslint-config: Shared ESLint configurations -
@repo/typescript-config: Sharedtsconfig.jsonconfigurations
┌─────────────────────────────────────┐
│ Parent Wallet (sample-wallet) │
│ ┌───────────────────────────────┐ │
│ │ Lendasat iframe (apps/iframe) │ │
│ │ │ │
│ │ - Loan management UI │ │
│ │ - Uses LendasatClient │ │
│ └───────────────────────────────┘ │
│ │
│ - Uses WalletProvider │
│ - Signs transactions & messages │
│ - Provides capabilities │
└─────────────────────────────────────┘
The iframe app uses secp256k1 pubkey challenge-response authentication:
- Iframe requests public key from wallet via wallet-bridge
- Iframe requests challenge from backend
- Wallet signs challenge with private key (ECDSA signature in DER format)
- Iframe sends signature to backend for verification
- Backend returns JWT token for authenticated requests
Create .env files in each app:
apps/iframe/.env:
VITE_BORROWER_BASE_URL=http://localhost:7337apps/sample-wallet/.env:
VITE_IFRAME_URL=http://localhost:5173Each package and app is 100% TypeScript.
Build all packages:
pnpm buildRun tests:
pnpm testLint:
pnpm lintThis Turborepo has some additional tools already setup:
- TypeScript for static type checking
- ESLint for code linting
- Prettier for code formatting
- Tailwind CSS for styling
- Vite for fast development and building