Automatically generate professional style guide PDFs from any website in seconds
Style Guide Generator is a web application that analyzes any website's design system and generates a comprehensive, professionally formatted style guide PDF. Simply enter a URL, and within seconds you'll have a detailed document covering colors, typography, components, layout, and accessibility standards.
Live Demo: https://styleguidegenerator-production.up.railway.app
- One-Click Analysis - Enter any website URL and get instant design system extraction
- Comprehensive Extraction - Automatically identifies:
- Color palettes with semantic classification (primary, secondary, accent, text, backgrounds)
- Typography system (font families, sizes, weights, line heights)
- Spacing values and patterns
- Component inventory
- Layout and responsive breakpoints
- Accessibility compliance (WCAG contrast ratios)
- Professional PDF Output - Industry-standard style guide format ready for team distribution
- Real-Time Progress - Live status updates during website analysis
- Smart Color Classification - Automatically categorizes colors by role and usage
- WCAG Compliance Checking - Built-in contrast ratio calculations for accessibility
- Next.js 16 - React framework with App Router
- React 19 - UI library
- TypeScript - Type safety
- Tailwind CSS v4 - Utility-first styling
- shadcn/ui - Accessible component library
- TanStack Query - Async state management
- Lucide React - Icon library
- Playwright - Headless browser for website analysis
- @react-pdf/renderer - PDF generation
- Zod - Schema validation
- Railway - Cloud deployment platform
- Docker - Containerized deployment
- Node.js - Runtime environment
- Node.js 20+
- npm or yarn
- Clone the repository:
git clone https://github.com/TomsTools11/styleguidegenerator.git
cd styleguidegenerator- Navigate to the app directory:
cd style-guide-app- Install dependencies:
npm install- Install Playwright browsers:
npx playwright install chromium- Start the development server:
npm run dev- Open http://localhost:3000 in your browser
npm run build
npm start- URL Submission - User enters a website URL
- Browser Launch - Playwright spawns a headless Chromium instance
- Page Loading - Navigates to the URL with smart popup dismissal and lazy-load handling
- Style Extraction - Analyzes computed styles from all page elements:
- Colors from backgrounds, text, borders, and CSS variables
- Font families, sizes, weights, and line heights
- Spacing values (margins, paddings, gaps)
- Classification - Intelligently categorizes extracted data:
- Colors grouped by semantic role (primary, secondary, accent, text, backgrounds)
- Typography organized into type scales and hierarchies
- Contrast ratios calculated for accessibility compliance
- PDF Generation - Creates a professional style guide using industry-standard template structure
- Download - User receives downloadable PDF
Generated style guides follow professional documentation standards:
- Cover Page - Website name, URL, generation date
- Color Palette - Primary, secondary, accent, text, and background colors with hex/RGB values
- Typography - Font families, type scale, weights, and line heights
- Spacing System - Margin and padding patterns
- Components - UI elements and patterns identified
- Layout & Grid - Breakpoints and container widths
- Accessibility - WCAG contrast ratios and compliance notes
styleguidegenerator/
├── Dockerfile # Production deployment configuration
├── railway.json # Railway deployment settings
├── PROGRESS.md # Development progress and notes
└── style-guide-app/ # Main Next.js application
├── src/
│ ├── app/
│ │ ├── page.tsx # Landing page with URL input
│ │ ├── processing/ # Analysis progress page
│ │ │ └── page.tsx
│ │ ├── results/ # Results display and PDF download
│ │ │ └── page.tsx
│ │ └── api/
│ │ ├── analyze/ # Start analysis job
│ │ │ └── route.ts
│ │ ├── status/ # Check job status
│ │ │ └── [id]/route.ts
│ │ ├── results/ # Get analysis results
│ │ │ └── [id]/route.ts
│ │ └── generate-pdf/ # Generate PDF from results
│ │ └── route.ts
│ ├── components/
│ │ └── ui/ # shadcn/ui components
│ ├── lib/
│ │ ├── analyzer.ts # Website analysis engine (Playwright)
│ │ ├── job-store.ts # In-memory job storage
│ │ ├── utils.ts # Utility functions
│ │ └── pdf/
│ │ ├── StyleGuideDocument.tsx # PDF template
│ │ └── styles.ts # PDF styling
│ └── types/
│ └── style-guide.ts # TypeScript interfaces
├── package.json
└── tsconfig.json
The app is configured for Vercel deployment via style-guide-app/vercel.json.
- Push the repo to GitHub.
- In Vercel, click Add New → Project and import the repo.
- Set Root Directory to
style-guide-app← critical. If you skip this, Vercel will still build (it auto-detects Next.js inside the subfolder) but the Lambda's working directory ends up as/var/task/style-guide-app/...instead of/var/task/..., which silently breaks any path resolution fromprocess.cwd(). Verify under Settings → General → Root Directory before you deploy. - Framework preset: Next.js (auto-detected).
- Build command, output, and install command: leave as defaults.
- Click Deploy.
- Vercel Pro is required. The
/api/analyzeroute launches headless Chromium and runs for ~30–60s per request; Hobby caps functionmaxDurationat 10s, which kills every analyze request. Pro lifts that to 300s. Thevercel.jsonrequests 60s for/api/analyzeand 30s for/api/generate-pdf. - Chromium runs via
@sparticuz/chromium-min. Regular Playwright won't fit in a Vercel function bundle (~300 MB), and the standard@sparticuz/chromiumpackage's binary doesn't always survive Next/Webpack file tracing.chromium-minships only the JS shim and downloads the binary from the GitHub release matchingSPARTICUZ_CHROMIUM_VERSIONinanalyzer.tsto/tmpon first invocation. When you bump the npm package, bump the URL in lockstep — the binary version must match the JS API version. - No environment variables are required for the basic flow. Optional extras:
ANTHROPIC_API_KEYfor the planned brand-copy generation,REDIS_URLfor persistent job storage (the current in-memoryMapresets on every cold start, which on Vercel happens often). - Function memory is set to 1024 MB (default 1024 on Vercel) for both Chromium-bearing routes.
The original deployment uses Dockerfile + railway.json at the repo root, built on the Microsoft Playwright base image. Both files are kept in the repo so the Railway service keeps working as a fallback, but the Vercel migration is now the primary deployment path. Delete those two files when you're ready to commit fully to Vercel.
Build and run locally with Docker (matches the Railway production image):
docker build -t style-guide-generator .
docker run -p 3000:3000 style-guide-generatorCurrently, no environment variables are required for basic operation. Future features may require:
REDIS_URL- For persistent job storageDATABASE_URL- For user accounts and historyANTHROPIC_API_KEY- For planned creative brief feature
- In-Memory Job Storage - Jobs are lost on server restart. Recommended to implement Redis or PostgreSQL for production.
- No Concurrency Control - Unlimited browser instances can spawn under high load. Implement job queue with concurrency limits.
- No Browser Pooling - Each analysis spawns a new Chromium instance (~150-300MB). Consider browser reuse or connection pooling.
- Fixed Timeouts - 30-second page load timeout may be too short for slow sites. Make configurable via environment variables.
- Limited Error Handling - No retry logic for flaky websites or handling of auth-protected sites.
- Add Redis for persistent job storage
- Implement job queue with max 2-3 concurrent browser instances
- Add browser connection pooling
- Implement job cleanup/TTL (prevent memory leaks)
- Add environment variable configuration
- Enhance error handling with retry logic
See PROGRESS.md for detailed technical notes and improvement roadmap.
- User Accounts - Save analysis history and re-download past guides
- Creative Brief Generator - Upload screenshots to generate marketing content briefs using Claude Vision AI
- Multiple URL Analysis - Analyze multiple pages for comprehensive design system extraction
- Custom Templates - Choose from different PDF templates and styles
- Export Formats - JSON, Figma tokens, CSS variables
- API Access - Programmatic style guide generation for developers
- Team Workspaces - Collaborate on style guides
- Custom Branding - Add company logo to generated PDFs
npm run lintnpm run build- The analyzer uses Playwright's
domcontentloadedstrategy for faster, more reliable loading - Auto-scrolling triggers lazy-loaded content
- Popup dismissal automatically handles cookie banners and modals
- Colors are deduplicated and classified by luminance and usage patterns
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License.
- Built with Next.js
- Website analysis powered by Playwright
- PDF generation using @react-pdf/renderer
- UI components from shadcn/ui
For issues, questions, or suggestions:
- Open an issue on GitHub
- Check PROGRESS.md for technical details and development notes
Made with ❤️ by TomsTools11