Skip to content

MuhammadTanveerAbbas/Readlyn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Readlyn Logo

Readlyn

AI-powered infographic generator β€” describe any topic, get a stunning visual in seconds

Live Demo GitHub Repo License TypeScript Next.js Supabase Vercel AI SDK Upstash Tailwind CSS Vitest


Readlyn

Overview

Readlyn turns plain text prompts into professional infographics using Groq AI (Llama 3.3 70B). Instead of spending hours in Canva or Figma, you describe your topic, pick a layout style and theme, and the AI generates a fully structured, pixel-perfect infographic on a Fabric.js canvas ready to export as PNG or JSON. Built for content creators, marketers, and developers who need visual content fast.


✨ Features

  • πŸ€– AI Infographic Generation Describe any topic and Groq AI (Llama 3.3 70B) generates a complete, data-rich infographic with real facts and statistics
  • 🎨 9 Layout Archetypes Steps, Stats, Timeline, Compare, List, Pyramid, Funnel, Cycle, or Auto each with mathematically pre-computed element positions
  • πŸ–ŒοΈ 5 Color Themes Violet, Ocean, Ember, Forest, and Slate palettes applied consistently across every generated element
  • πŸ“ 3 Canvas Sizes A4 Portrait (800Γ—1100), Square (1080Γ—1080), and Wide (1920Γ—600) for any use case
  • πŸ–±οΈ Interactive Canvas Editor Drag, resize, rotate, and edit any element directly on the Fabric.js canvas with select and hand tool modes
  • πŸ”’ Layers Panel Full layer management with visibility toggle, lock/unlock, and per-layer deletion
  • βš™οΈ Properties Panel Edit transform (X, Y, W, H, rotation, opacity), fill/stroke colors, border radius, and typography per selected element
  • ↩️ Undo / Redo Full canvas history with keyboard shortcuts (Cmd+Z / Cmd+Shift+Z)
  • πŸ“€ Export PNG & JSON Download as high-res PNG or save the raw JSON schema for later
  • πŸ”’ Auth with Supabase Email/password sign up, login, forgot password, and protected routes via Next.js proxy
  • ⚑ Streaming Generation Elements stream to the canvas in real time as the AI generates them
  • πŸ” Zoom Controls Zoom in/out, fit-to-screen, mouse wheel zoom toward cursor, and pan with hand tool or Space+drag
  • πŸ–ΌοΈ Parallax Studio Standalone layer-based parallax scene builder with 6 presets, scroll/tilt effects, image upload, and clean HTML/CSS/JS code export

🎨 Design System

Readlyn uses a hand-crafted dark design language think Resend meets Framer. The entire UI is driven by CSS custom properties defined in globals.css:

  • Background scale --bg-base (#080808), --bg-panel (#0f0f0f), --bg-elevated (#161616). No pure black.
  • Accent (--accent: #F5C518) Used sparingly: primary CTAs, active states, icon containers, and inline accent text only.
  • Semantic tokens --text-primary, --text-secondary, --text-body, --text-muted-val, --text-dim for typography; --destructive, --success, --purple, --blue, --orange for status/accent colors.
  • Typography Mixed-case headings with tight tracking (-0.02em to -0.03em). All-caps reserved for labels and badges only.
  • Noise texture Subtle SVG fractal noise overlay on all pages for depth.
  • Scroll animations useReveal() hook triggers animate-fade-up at 15% viewport entry on every section.
  • Micro-interactions hover:scale-[1.02] active:scale-[0.98] on buttons, border brightens + top accent line on cards, yellow focus ring on inputs, chevron rotation on FAQ accordion.
  • Auth pages Card with deep shadow, labeled inputs, yellow glow submit button, animate-fade-up on mount.
  • Canvas editor Panels at --bg-panel, borders at --border-default, active tool uses --accent, generate button with glow.

πŸ›  Tech Stack

Category Technology
Framework Next.js 16 + React 19 + TypeScript
Styling Tailwind CSS v4 + Radix UI
Canvas Fabric.js v6
Parallax Pure CSS transforms (no extra dependencies)
AI Groq (llama-3.3-70b-versatile) via Vercel AI SDK
Rate Limiting Upstash Redis (with in-memory fallback for development)
Auth & Database Supabase (Auth + SSR)
Input Sanitization isomorphic-dompurify
Testing Vitest
Fonts Space Grotesk + IBM Plex Mono
Deployment Vercel

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • pnpm (recommended) or npm
  • Supabase account
  • Groq API key (free at console.groq.com)

Installation

# 1. Clone the repo
git clone https://github.com/MuhammadTanveerAbbas/Readlyn.git
cd Readlyn

# 2. Install dependencies
pnpm install

# 3. Set up environment variables
cp .env.example .env.local
# Fill in your values (see Environment Variables section below)

# 4. Run the development server
pnpm dev

# 5. Open in browser
http://localhost:3000

πŸ” Environment Variables

Create a .env.local file in the root directory (or copy .env.example):

# Required
NEXT_PUBLIC_SUPABASE_URL=https://your-project-ref.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
GROQ_API_KEY=your-groq-api-key

# Optional (rate limiting)  https://console.upstash.com/redis
# Without these, rate limiting falls back to an in-memory store.
UPSTASH_REDIS_REST_URL=https://your-upstash-url.upstash.io
UPSTASH_REDIS_REST_TOKEN=your-upstash-token

Get your keys:

GROQ_API_KEY is server-side only (no NEXT_PUBLIC_ prefix). The NEXT_PUBLIC_ Supabase vars are safe to expose to the browser.

Testing

pnpm test        # Run tests
pnpm test:watch  # Watch mode

Tests use Vitest with path alias resolution (@/ β†’ ./). Test files live in tests/.


πŸ›‘ Security

  • CSRF Protection All state-changing API routes (/api/generate, /api/account/delete, /api/export-multi, /api/keep-alive) validate the Origin header matches the deployed host.
  • Rate Limiting The /api/generate route enforces a daily generation quota (10/day per user by default, configurable in config/plans.ts). Uses Upstash Redis in production; falls back to an in-memory Map when Upstash env vars are absent.
  • Input Sanitization Prompt text is stripped of HTML tags and control characters before being sent to the AI. Generated output is sanitized via isomorphic-dompurify to prevent XSS.
  • Route Params All dynamic route segments ([id]) are validated as UUIDs via parseRouteId().

βš™οΈ Configuration

Usage limits are defined in config/plans.ts. The default Free plan allows:

  • 5 projects
  • 10 AI generations per day
  • 50 exports

To adjust limits, edit the PLANS object in config/plans.ts.


Supabase Setup

After creating your Supabase project, run the schema in supabase/schema.sql via the Supabase SQL editor to create the required tables (projects, templates, generation_history) and enable Row Level Security.


πŸ“ Project Structure

readlyn/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ (auth)/              # Login, signup, forgot-password pages
β”‚   β”œβ”€β”€ (protected)/         # Dashboard + app editor (auth-gated)
β”‚   β”œβ”€β”€ api/generate/        # AI generation (Vercel AI SDK + CSRF + rate limit + sanitize)
β”‚   β”œβ”€β”€ globals.css          # Design tokens (CSS custom properties), noise texture, animations
β”‚   └── layout.tsx
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ app/                 # Editor UI: Canvas, Toolbar, Layers, Properties, Prompt
β”‚   β”œβ”€β”€ auth/                # AuthCard with refined dark card design
β”‚   β”œβ”€β”€ landing/             # Landing page sections (all "use client" with useReveal)
β”‚   β”œβ”€β”€ parallax/            # Parallax Studio: Preview, ConfigPanel, ImagePicker, ExportModal
β”‚   └── ui/                  # Shared UI primitives
β”œβ”€β”€ hooks/
β”‚   β”œβ”€β”€ use-canvas-history.ts
β”‚   β”œβ”€β”€ use-canvas-selection.ts
β”‚   β”œβ”€β”€ use-reveal.ts        # IntersectionObserver scroll animation hook
β”‚   └── use-mobile.ts
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ archetypeLayouts.ts  # Pre-computed pixel positions for all layout archetypes
β”‚   β”œβ”€β”€ contentAwareness.ts  # AI content analysis helpers
β”‚   β”œβ”€β”€ csrf.ts              # Origin + Host CSRF validation for API routes
β”‚   β”œβ”€β”€ defaultInfographic.ts
β”‚   β”œβ”€β”€ env.ts               # Environment variable validation
β”‚   β”œβ”€β”€ exportMultiFormat.ts # PNG / ZIP export logic
β”‚   β”œβ”€β”€ params.ts            # UUID route param validator
β”‚   β”œβ”€β”€ rate-limit.ts        # Upstash Redis rate limiter (with in-memory fallback)
β”‚   β”œβ”€β”€ renderElements.ts    # Fabric.js object factory + canvas renderer
β”‚   β”œβ”€β”€ sanitize.ts          # Prompt + output sanitization (isomorphic-dompurify)
β”‚   β”œβ”€β”€ parallax-types.ts    # Parallax Studio types, defaults, constants
β”‚   β”œβ”€β”€ presets.ts           # 6 parallax scene presets
β”‚   β”œβ”€β”€ code-generator.ts    # HTML/CSS/JS export for parallax scenes
β”‚   β”œβ”€β”€ parallax-upload.ts   # Supabase Storage upload for parallax images
β”‚   └── supabase/            # Client, server, middleware helpers
β”œβ”€β”€ types/
β”‚   └── infographic.ts       # Zod schemas + TypeScript types for all element types
β”œβ”€β”€ supabase/
β”‚   └── schema.sql           # Database schema  run this in Supabase SQL editor
β”œβ”€β”€ proxy.ts                 # Auth middleware (route protection)
β”œβ”€β”€ .env.example
└── package.json

πŸ“¦ Available Scripts

Command Description
pnpm dev Start development server
pnpm start Start production server
pnpm lint Run ESLint
pnpm test Run Vitest

🌐 Deployment

This project is deployed on Vercel.

Deploy Your Own

Deploy with Vercel

  1. Click the button above
  2. Connect your GitHub account
  3. Add the following environment variables in the Vercel dashboard:
    • NEXT_PUBLIC_SUPABASE_URL
    • NEXT_PUBLIC_SUPABASE_ANON_KEY
    • GROQ_API_KEY
    • UPSTASH_REDIS_REST_URL (optional β€” rate limiting)
    • UPSTASH_REDIS_REST_TOKEN (optional β€” rate limiting)
  4. Deploy

The /api/generate route uses streaming and has a 60-second max duration this works on Vercel's Hobby plan.


πŸ—Ί Roadmap

  • AI infographic generation with Groq (Llama 3.3 70B)
  • 9 layout archetypes with pre-computed positions
  • Interactive Fabric.js canvas editor
  • Layers panel with visibility and lock controls
  • Properties panel for transform, color, and typography
  • PNG and JSON export
  • Supabase authentication
  • Streaming partial generation
  • Generation history per project
  • Multi-format export (PNG, ZIP)
  • Parallax Studio layer-based scene builder (scroll/tilt effects)
  • CSRF protection on all API routes
  • Rate limiting via Upstash Redis (with dev fallback)
  • Input sanitization (strip HTML, control chars, DOMPurify)
  • UUID validation on all dynamic route params
  • CSS custom property design system (no hardcoded hex colors)
  • Real-time team collaboration
  • Custom font upload
  • Figma import
  • More canvas sizes (Instagram Story, Twitter/X banner)
  • Image element support

🀝 Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

Distributed under the MIT License. See LICENSE for more information.


πŸ‘¨β€πŸ’» Built by The MVP Guy

Muhammad Tanveer Abbas SaaS Developer | Building production-ready MVPs in 14 to 21 days

Portfolio GitHub Twitter LinkedIn

Repository: https://github.com/MuhammadTanveerAbbas/Readlyn

If this project helped you, please consider giving it a ⭐

About

AI-powered infographic generator describe any topic, get a stunning visual in seconds

Topics

Resources

License

Stars

11 stars

Watchers

0 watching

Forks

Contributors