Features: - Lightning Network payments via LNbits integration - Provably fair draws using CSPRNG - Random ticket number generation - Automatic payouts with retry/redraw logic - Nostr authentication (NIP-07) - Multiple draw cycles (hourly, daily, weekly, monthly) - PostgreSQL and SQLite database support - Real-time countdown and payment animations - Swagger API documentation - Docker support Stack: - Backend: Node.js, TypeScript, Express - Frontend: Next.js, React, TailwindCSS, Redux - Payments: LNbits
Lightning Lottery Frontend
Next.js-based frontend for the Lightning Lottery system.
Features
- Responsive Design: Mobile-first, works on all devices
- Real-time Updates: Live countdown and automatic status polling
- Lightning Payments: QR code invoice display
- Nostr Authentication: Optional user login via NIP-07
- User Dashboard: View tickets, wins, and statistics
Tech Stack
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- Styling: TailwindCSS
- State Management: Redux Toolkit
- QR Codes: qrcode.react
Setup
Prerequisites
- Node.js 18+
- Backend API running
Installation
- Install dependencies:
npm install
- Configure environment:
cp .env.example .env.local
# Edit .env.local with your configuration
- Run development server:
npm run dev
Production Build
npm run build
npm start
Environment Variables
NEXT_PUBLIC_API_BASE_URL- Backend API URLNEXT_PUBLIC_APP_BASE_URL- Frontend public URL
Pages
/- Home page with current jackpot/buy- Buy lottery tickets/tickets/[id]- Ticket status page (public)/dashboard- User dashboard (Nostr auth required)/dashboard/tickets- User's ticket history/dashboard/wins- User's wins
Components
Reusable Components
TopBar- Navigation headerFooter- Site footerJackpotCountdown- Live countdown timerJackpotPotDisplay- Pot amount displayLightningInvoiceCard- Invoice QR code and copyTicketList- Display ticket serial numbersPayoutStatus- Payout status indicatorNostrLoginButton- Nostr authentication
Deployment
Vercel
vercel
Netlify
netlify deploy --prod
Docker
docker build -t lightning-lotto-frontend .
docker run -p 3001:3000 lightning-lotto-frontend
License
MIT