Skip to content

Royal Lens is your AI-powered companion for exploring RoyalRoad novels with intelligent summaries, review analysis, chapter previews, and comparisons.

License

Notifications You must be signed in to change notification settings

nonvar/royallens

Repository files navigation

Mascot Logo

Royal Lens — Your AI Companion for Royal Road

Royal Lens is your AI-powered companion for exploring Royal Road novels with intelligent summaries, review analysis, chapter previews, and comparisons.

Search by novel ID or URL, or browse Latest, Popular, Best Rated, and New Releases with a modern, privacy-friendly interface.


Features

  • Search by ID/URL: Enter a numeric ID (e.g., 21220) or a Royal Road URL.
  • Browse feeds: Latest, Popular, Best Rated, and New Releases.
  • AI Novel Summary: Get quick novel summaries from metadata and comments
  • AI Review Analysis: See recent reader sentiment and highlights
  • First 3 Chapters Preview: Read spoiler-light excerpts with AI analysis
  • AI Author Analysis: View author overviews from public stats
  • Compare Two Novels: Compare side-by-side stats and AI insights
  • Favorites: Save novels to build your own feed

Live

Terms & Ethics

Tech Stack

  • Framework: Next.js 15 (App Router)
  • UI: React 19, Tailwind CSS v4
  • Data: @fsoc/royalroadl-api
  • AI: Google Gemini 2.0 Flash (via REST API)
  • Analytics: Umami (privacy-friendly)
  • Deployment: Vercel

Prerequisites

  • Node.js 20+ recommended
  • Google AI Studio API key for Gemini

Environment Variables

Create a .env.local file in the project root:

# Required for AI features (analyze novel/author/chapters)
GEMINI_KEY=your_google_gemini_api_key

Without GEMINI_KEY, general browsing works, but AI summaries will return an error/placeholder.

Scripts

# Install deps
npm install

# Start dev server
npm run dev

# Type-check and build for production
npm run build

# Start production server (after build)
npm start

# Lint
npm run lint

Development

  1. Install dependencies: npm install

  2. Set environment:

  • Add GEMINI_KEY in .env.local
  1. Start dev server: npm run dev and open http://localhost:3000

Project Structure

src/
├── app/                    # Next.js App Router
│   ├── about/             # About pages with sidebar navigation
│   │   ├── general/       # Main about content
│   │   ├── terms/         # Terms & Ethics
│   │   ├── privacy/       # Privacy policy
│   │   ├── mascot/        # Mascot (Lumen)
│   │   └── contribution/  # Contribution guidelines
│   ├── api/               # API routes
│   │   ├── analyze-*      # AI analysis endpoints
│   │   ├── chapters/      # Chapter preview endpoint
│   │   ├── compare/       # Novel comparison endpoint
│   │   └── royalroad/     # Main Royal Road data endpoint
│   ├── updates/           # Release notes page
│   └── globals.css        # Global styles
├── components/            # Reusable React components
│   ├── AnalysisModal.tsx  # AI summaries and analyses
│   ├── FictionCard.tsx    # Novel display card
│   ├── CompareModal.tsx   # Compare two novels
│   ├── Sidebar.tsx        # Main navigation
│   └── ...
├── data/                 # Static data
│   └── releases.ts       # Release notes data
└── lib/                  # Utilities
    └── lru.ts           # LRU cache implementation

API Routes

  • POST /api/royalroad — Fetch novels by filter or single ID/URL
  • POST /api/full-fiction — Get detailed novel information
  • POST /api/chapters — Retrieve first 1-3 chapter previews
  • POST /api/analyze-chapters — AI analysis of chapters (requires GEMINI_KEY)
  • POST /api/analyze-novel — AI novel summary (requires GEMINI_KEY)
  • POST /api/analyze-author — AI author analysis (requires GEMINI_KEY)
  • POST /api/analyze-reviews — AI review sentiment analysis (requires GEMINI_KEY)
  • POST /api/reviews — Fetch recent reviews
  • POST /api/compare — Compare two novels with AI insights

All routes use @fsoc/royalroadl-api for Royal Road data. AI features require Google Gemini API key.

Features in Detail

Search & Browse

  • Search by fiction ID (e.g., 21220) or full URL
  • Browse Latest, Popular, Best Rated, and New Releases
  • Pagination support for all feed views

AI-Powered Analysis

  • Novel Summaries: High-level overviews using metadata and community feedback
  • Review Sentiment: Analyzes recent reader reviews with sentiment scoring
  • Chapter Previews: First 3 chapters with optional AI analysis
  • Author Profiles: AI-generated author analysis based on public stats

Comparison & Favorites

  • Side-by-side novel comparisons with AI insights
  • Favorites system for personal reading lists

Privacy & Performance

  • No personal data collection
  • Privacy-friendly analytics via Umami
  • Client-side favorites storage

Disclaimer

Royal Lens is an independent project and is not affiliated with Royal Road. It links back to original Royal Road pages and shows only brief excerpts and metadata to help readers discover content.

Data use & rate limiting

  • Uses only public pages; no login‑required content is accessed.
  • Fetches are rate‑limited and cached to minimize requests.
  • If any author or RR staff has concerns, please open an issue and we will adjust or remove content promptly.

Contributing

Contributions are welcome! Please check the contribution guidelines for more information.

Acknowledgements

License

This project is open source under the MIT License — see LICENSE.

About

Royal Lens is your AI-powered companion for exploring RoyalRoad novels with intelligent summaries, review analysis, chapter previews, and comparisons.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published