LaWallet NWC
Architecture

lawallet-web

Next.js application serving frontend, REST API, and lightning address resolution.

Overview

The main application serving the frontend, REST API, admin dashboard, user dashboard, wallet interface, and lightning address resolution endpoints.

Container: lawallet-web Port: 3000 Storage: Own PostgreSQL database (Prisma ORM)


Responsibilities

  • Serve frontend (React + Tailwind/shadcn)
  • Expose REST API for all platform operations
  • Resolve lightning addresses via .well-known/lnurlp (LUD-16)
  • Serve NIP-05 identity via .well-known/nostr.json
  • Handle alias/redirect resolution (proxy LNURL-pay to target)
  • Admin dashboard
  • User dashboard (profile, npub, address config, preferences)
  • Wallet interface (payments, NWC connection)
  • Authentication (JWT + Nostr)
  • White-label customization
  • Customizable landing page

Tech Stack

  • Framework: Next.js 14 (App Router)
  • Language: TypeScript
  • Frontend: React + Tailwind CSS + shadcn/ui
  • Database: PostgreSQL via Prisma ORM
  • NWC: Alby JS SDK
  • Testing: Vitest + React Testing Library + Playwright + MSW
  • Logging: pino

Directory Structure

PathPurpose
/appNext.js App Router pages and API routes
/app/adminAdmin dashboard pages
/app/dashboardUser dashboard pages
/app/walletWallet interface
/app/.well-knownLUD-16 + NIP-05 endpoints
/app/apiREST API routes
/componentsShared React components
/hooksReact hooks (consuming SDK)
/libShared utilities, types, constants
/providersReact context providers
/prismaDatabase schema, migrations, seeds

Key Endpoints

Lightning Address

  • GET /.well-known/lnurlp/:username — LUD-16 resolution (with alias/redirect support)
  • GET /.well-known/nostr.json?name=:username — NIP-05 identity verification

API

  • POST /api/auth/login — JWT login
  • POST /api/auth/refresh — Refresh token
  • POST /api/auth/nostr — Nostr login (NIP-07/NIP-46)
  • GET /api/addresses — List addresses
  • POST /api/addresses — Create address
  • GET /api/addresses/:id — Get address details
  • PUT /api/addresses/:id — Update address
  • DELETE /api/addresses/:id — Delete address
  • PUT /api/addresses/:id/redirect — Set redirect target
  • GET /api/users — List users (admin)
  • GET /api/users/:id — Get user details
  • PUT /api/users/:id — Update user
  • GET /api/webhooks — List webhooks
  • POST /api/webhooks — Register webhook
  • DELETE /api/webhooks/:id — Remove webhook
  • GET /api/payments — Payment history

Communication with Other Services

  • lawallet-listener: Receives WebSocket events for real-time payment updates
  • lawallet-nwc-proxy: HTTP API calls to provision/revoke courtesy NWC connections
  • No shared database or filesystem with either service

On this page