$ show VladSez/easy-invoice-pdf
EasyInvoicePDF is a free, open-source, browser-based invoice generator that creates PDF invoices with live preview, no sign-up required, and no ads. Built with Next.js (App Router), React 19, TypeScript, Tailwind CSS, and shadcn/ui, it runs entirely client-side for the public editorβinvoice data stays in localStorage and is never uploaded to a server. The application supports 10 languages, 120+ currencies, two PDF templates (default and Stripe-inspired), QR codes, multi-page PDFs, and shareable compressed URLs. A private server-side API (Bearer token + Upstash rate-limited) handles monthly recurring invoice generation via Trigger.dev cron, uploading PDFs to Google Drive, emailing via Resend, and sending Telegram notifications. The codebase also includes extensive SEO landing pages, a changelog, a founder page, and comprehensive testing (Vitest unit tests, Playwright e2e with PDF screenshot baselines). Architecture: The app uses two root layoutsβunprefixed English-only routes (/) and locale-prefixed routes (/[locale]) for i18n via next-intl. The main invoice form is a large client component with react-hook-form and Zod validation, debounced autosave, and template/language switching. PDF rendering uses @react-pdf/renderer on the client for live preview and on the server for automation. External dependencies include Upstash Redis (rate limiting, queue), Resend (email), Google Drive (archive), Telegram (notifications), Sentry (error tracking), Umami (analytics), and Trigger.dev (scheduled tasks). The repository also contains a rich ecosystem of agent skills (Vercel React best practices, composition patterns, SEO audit, etc.) used in development workflows. Key data flows: User fills form β state stored in localStorage and optionally shared via compressed URL β PDF preview rendered client-side via @react-pdf/renderer β download or share. For monthly automation: Trigger.dev cron triggers server-side PDF generation β upload to Google Drive β email via Resend β Telegram notification. The backend API also supports a preview endpoint for sample PDFs and a Telegram webhook for on-demand generation.
The LLM identified 4 files worth highlighting for reuse:
Compresses invoice data into shareable URLs using a key mapping (long keys to single characters) and lz-string encoding. This isolated utility can be extracted and reused in any application that needs to encode complex state into a compact URL query parameter, demonstrating a practical pattern for URL-based state sharing without a backend.
A defensive wrapper around localStorage that handles the iOS in-app webview null storage issue (where localStorage exists but throws on access). It provides a consistent API with fallback to an in-memory store. This pattern is reusable across any web application that needs to gracefully handle browser storage quirks, demonstrating defensive coding for edge cases.
Central schema definition using Zod that defines the entire invoice data model, including invoice items, sellers, buyers, supported currencies, languages, templates, date formats, and localStorage key constants with automatic duplicate detection. This schema-driven approach ensures data consistency across client and server, and the pattern of centralizing validation and constants is reusable in any TypeScript application.
Custom number-to-words converters for 10 languages (en, pl, de, es, pt, ru, uk, fr, it, nl), replacing the n2words library due to Safari BigInt parse errors. Each language file implements a self-contained converter with proper handling of gender, plural forms, and currency-specific rules. This demonstrates cross-language engineering and the pattern of replacing a library dependency with a tailored, bug-free implementation.