Skip to content

feat: Admin UI for Nutshell mint#886

Closed
joelklabo wants to merge 1 commit intocashubtc:mainfrom
joelklabo:feat/admin-ui
Closed

feat: Admin UI for Nutshell mint#886
joelklabo wants to merge 1 commit intocashubtc:mainfrom
joelklabo:feat/admin-ui

Conversation

@joelklabo
Copy link
Copy Markdown

@joelklabo joelklabo commented Feb 7, 2026

Summary

Add a web-based Admin UI for managing a Cashu mint. The dashboard communicates with the mint via its gRPC management interface and REST API, providing a visual interface for common administrative tasks.

Features

  • Dashboard: Mint status overview, keyset summary, system metrics
  • Settings: Update mint name, description, MOTD, icon URL, lightning fees, quote TTL, URLs, contacts
  • Keysets: View all keysets, rotate to new keyset (with confirmation)
  • Quotes: Look up mint/melt quotes by ID, update quote state (with validation)
  • Monitoring: Live CPU/memory/disk usage with auto-refresh, mint REST API info

Security & Reliability

  • HTTP Basic Auth: Enable with --admin-password or ADMIN_PASSWORD env var
  • Error sanitization: gRPC error details are logged server-side, never leaked to the browser
  • Quote state validation: Only valid states (PENDING, UNPAID, PAID, ISSUED) accepted
  • Async safety: All sync gRPC calls wrapped with asyncio.to_thread() to avoid blocking the event loop
  • Channel cleanup: Proper gRPC channel shutdown on app exit

Dependencies

  • python-multipart (required for Form(...) — crashes without it)
  • psutil (optional, for system monitoring metrics)

Screenshots

Dashboard

Dashboard

Settings

Settings

Keysets

Keysets

Quotes

Quotes

Monitoring

Monitoring

Usage

Start the mint with gRPC management enabled, then start the admin UI:

# Start mint
MINT_BACKEND_BOLT11_SAT=FakeWallet MINT_RPC_SERVER_ENABLE=TRUE \
  MINT_RPC_SERVER_MUTUAL_TLS=FALSE MINT_PRIVATE_KEY=secretkey123 \
  poetry run mint

# Start admin UI with auth
ADMIN_PASSWORD=mysecretpass poetry run mint-admin --no-tls
# Browse to http://127.0.0.1:4448, login as admin:mysecretpass

Test plan

  • poetry run pytest tests/test_admin.py -v — 31 tests pass
  • Start mint + admin UI, verify all 5 pages render
  • Verify auth: unauthenticated access blocked when password is set
  • Verify settings changes propagate via gRPC
  • Verify keyset rotation with confirmation dialog
  • Verify quote lookup and state updates
  • Verify monitoring auto-refresh and connection loss indicator

Add a separate web dashboard for managing a Cashu mint via its gRPC
management interface and REST API. Runs as `poetry run mint-admin`.

Features:
- Dashboard with mint status, keyset overview, system metrics
- Settings management (name, description, MOTD, fees, URLs, contacts)
- Keyset viewing and rotation with confirmation
- Quote lookup and state updates with validation
- Live monitoring with auto-refresh (CPU, memory, disk)

Security:
- HTTP Basic Auth via --admin-password / ADMIN_PASSWORD env var
- Security headers (X-Frame-Options DENY, CSP frame-ancestors, nosniff)
- gRPC error details logged server-side, never leaked to browser
- Quote state and type validation before gRPC calls
- Numeric input validation on all form fields
- CSRF limitation documented (recommend VPN for production)

Technical:
- All sync gRPC calls wrapped with asyncio.to_thread()
- Proper gRPC channel cleanup on shutdown
- python-multipart dependency (required for Form())
- psutil as optional dependency for system monitoring
- Template deduplication via Jinja2 includes
- Timestamp formatting filter for quote datetimes
- Favicon route to prevent browser auth prompts
- 40 tests covering auth, pages, validation, errors, and security

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@joelklabo joelklabo marked this pull request as ready for review February 7, 2026 09:45
@a1denvalu3 a1denvalu3 closed this Mar 20, 2026
@github-project-automation github-project-automation bot moved this from Backlog to Done in nutshell Mar 20, 2026
@a1denvalu3
Copy link
Copy Markdown
Collaborator

We don't really want Admin UIs inside nutshell. You're free to build your own external solution, like Orchard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants