A Next.js application demonstrating Lightning Login (LNURL-auth) for sovereign authentication. This app provides educational content, developer documentation, and a live demo of Lightning Login authentication.
This application serves three main purposes:
- Education - Explains Lightning Login to non-developers with clear, accessible content
- Developer Documentation - Provides technical guides and code examples for developers
- Live Demo - Allows users to authenticate using their Lightning wallet
- Framework: Next.js 16 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS 4
- Validation: Zod
- Content Management: Type-safe content schemas with runtime validation
src/
├── app/ # Next.js App Router pages and layouts
│ ├── components/ # Shared components (Navigation, CTAStrip, etc.)
│ ├── education/ # Education page and section components
│ ├── developer/ # Developer docs pages and components
│ ├── demo/ # Demo page
│ ├── sites/ # Sites listing page
│ └── workshop/ # Workshop/presentation page
├── content/ # Content files (TypeScript objects)
│ ├── lightning-login.education.ts
│ └── developer/
│ └── lightning-login.developer.ts
├── lib/
│ ├── content/ # Content getters with validation
│ ├── content-schemas/ # Zod schemas for content validation
│ ├── schemas/ # Re-exported schemas
│ ├── types/ # Central type exports
│ └── env.ts # Environment variable validation
└── scripts/
└── validate-content.ts # Content validation script
Content is managed through TypeScript files in the src/content/ directory. All content is validated at build time and runtime using Zod schemas with discriminated unions for type safety.
- Education Content:
src/content/lightning-login.education.ts - Developer Content:
src/content/developer/lightning-login.developer.ts
Content getters (getEducationContent, getDeveloperContent) use React's cache() for memoization and include error handling.
The application uses discriminated unions for section types, eliminating the need for type assertions. Each section kind has its own schema and TypeScript type, ensuring compile-time and runtime type safety.
- Node.js 20+
- npm, yarn, pnpm, or bun
npm installnpm run devOpen http://localhost:3000 in your browser.
npm run buildnpm startValidate all content files before committing:
npm run validateCreate a .env.local file (see .env.example for template):
NEXT_PUBLIC_BASE_URL=https://lightning-login.comNEXT_PUBLIC_BASE_URL- Base URL for the application (used in sitemap and metadata). Defaults tohttps://lightning-login.comif not set.
All pages use static generation where possible:
- Home page
- Education page
- Developer documentation pages
- Dynamic developer section pages (via
generateStaticParams)
All pages include:
- Dynamic metadata generation
- Open Graph tags
- Twitter Card tags
- Proper canonical URLs
- Global error boundary (
src/app/error.tsx) - Custom 404 page (
src/app/not-found.tsx) - Content validation error handling
- Discriminated unions for section types
- Runtime validation with Zod
- Centralized type exports (
src/lib/types/index.ts)
Content is validated using Zod schemas with discriminated unions:
- Education Sections: hero, problem, evolution, concept, technology, comparison, summary, faq, glossary
- Developer Sections: overview, architecture, protocol, code-example, library, comparison, step-by-step, faq
Each section type has specific required and optional fields defined in the schema.
npm run dev- Start development servernpm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLintnpm run validate- Validate all content files
- Make changes to content files in
src/content/ - Run
npm run validateto ensure content is valid - Run
npm run buildto verify the build succeeds - Follow conventional commit methodology
Private project.