Free & Open-Source Invoice Generator - No Sign-Up, No Ads, Instant PDF Export, 100% In-Browser, and Fully Customizable Templates.
TypeScript fintechinvoiceinvoice-generatorinvoice-pdfinvoice-templateinvoicesnextjsopen-sourcequotesreactreact-pdf-rendererself-hostedshadcn-uitailwindcsstypescript
docs: add Star History section to README and improve e2e test navigation strategy (#179)
Vlad Sazonaua4f3a34a53be
diff --git a/README.md b/README.mdindex 2a9605d..5de4fc6 100644--- a/README.md+++ b/README.md@@ -94,6 +94,10 @@ _**Choose between multiple professional templates** (Default and Stripe) to matc</div>+## π Star History++[](https://repostars.dev/?repos=VladSez%2Feasy-invoice-pdf&theme=dark)+## π’ News & Updates- **Jan 11, 2026**: Added customizable tax/VAT labels, improved internationalization (i18n) translations, enhanced overall performance, and fixed multiple bugs. [Release notes for v1.0.1](https://github.com/VladSez/easy-invoice-pdf/releases/tag/EasyInvoicePDF-1.0.1)@@ -113,10 +117,6 @@ Built by [Vlad Sazonau](https://x.com/vladsazonau)- πΌ LinkedIn: [Vlad Sazonau](https://www.linkedin.com/in/vlad-sazonau-22a9a9126/)- π Website: [vladsazon.com](https://vladsazon.com)-## π Star History--[](https://repostars.dev/?repos=VladSez%2Feasy-invoice-pdf&theme=dark)-## β€οΈ Support the ProjectIf you find EasyInvoicePDF useful, please consider:diff --git a/e2e/default-invoice-template/default-invoice-template.test.ts b/e2e/default-invoice-template/default-invoice-template.test.tsindex 06dbd0c..dbc0547 100644--- a/e2e/default-invoice-template/default-invoice-template.test.ts+++ b/e2e/default-invoice-template/default-invoice-template.test.ts@@ -180,7 +180,10 @@ test.describe("Default Invoice Template", () => {const taxSettingsFieldset = invoiceItemsSection.getByRole("group", {name: "Tax Settings",});- await taxSettingsFieldset.getByRole("textbox", { name: "VAT" }).fill("10");+ await taxSettingsFieldset+ .getByRole("textbox", { name: "VAT Rate" })+ .fill("10");+await taxSettingsFieldset.getByRole("textbox", { name: "Tax Label" }).fill("Custom TEST TAX LABEL");@@ -712,7 +715,7 @@ test.describe("Default Invoice Template", () => {});await taxSettingsFieldset- .getByRole("textbox", { name: "TVA", exact: true })+ .getByRole("textbox", { name: "TVA Rate", exact: true }).fill("23");// wait for debounce timeout@@ -842,7 +845,10 @@ test.describe("Default Invoice Template", () => {});await expect(- newTaxSettingsFieldset.getByRole("textbox", { name: "TVA", exact: true }),+ newTaxSettingsFieldset.getByRole("textbox", {+ name: "TVA Rate",+ exact: true,+ }),).toHaveValue("23");// Verify calculations are correct@@ -1455,7 +1461,7 @@ test.describe("Default Invoice Template", () => {(i + 2) % 3 === 0 ? "50" : (i + 2) % 2 === 0 ? "20" : "10";await taxSettingsFieldset- .getByRole("textbox", { name: "Sales Tax", exact: true })+ .getByRole("textbox", { name: "Sales Tax Rate", exact: true }).fill(taxRate);await itemFieldsetdiff --git a/e2e/generate-invoice-link.test.ts b/e2e/generate-invoice-link.test.tsindex 93a4c30..3ac0085 100644--- a/e2e/generate-invoice-link.test.ts+++ b/e2e/generate-invoice-link.test.ts@@ -135,7 +135,9 @@ test.describe("Generate Invoice Link", () => {.getByRole("textbox", { name: "Tax Label" }).fill("Custom VAT");- await taxSettingsFieldset.getByRole("textbox", { name: "VAT" }).fill("23");+ await taxSettingsFieldset+ .getByRole("textbox", { name: "VAT Rate" })+ .fill("23");// check totalconst totalField = finalSection.getByRole("textbox", {@@ -168,9 +170,7 @@ test.describe("Generate Invoice Link", () => {await page.waitForTimeout(700);// Generate share link- await page- .getByRole("button", { name: "Generate a link to invoice" })- .click();+ await page.getByRole("button", { name: "Generate invoice link" }).click();// Wait for URL to update with share dataawait page.waitForURL((url) => url.searchParams.has("data"));@@ -281,7 +281,7 @@ test.describe("Generate Invoice Link", () => {).toHaveValue("Custom VAT");await expect(- newTaxSettingsFieldset.getByRole("textbox", { name: "Custom VAT" }),+ newTaxSettingsFieldset.getByRole("textbox", { name: "Custom VAT Rate" }),).toHaveValue("23");const newFinalSection = newPage.getByTestId(`final-section`);@@ -428,7 +428,7 @@ test.describe("Generate Invoice Link", () => {await expect(page.getByText(- "Click 'Generate a link to invoice' to create a new shareable link.",+ "Click 'Generate invoice link' to create a new shareable link.",),).toBeVisible();@@ -633,9 +633,7 @@ test.describe("Generate Invoice Link", () => {await page.waitForTimeout(700);// Generate share link- await page- .getByRole("button", { name: "Generate a link to invoice" })- .click();+ await page.getByRole("button", { name: "Generate invoice link" }).click();// Verify the share invoice link description toast appears after generating the linkconst toast = page.getByTestId("share-invoice-link-description-toast");@@ -854,7 +852,7 @@ test.describe("Generate Invoice Link", () => {);await firstItemTaxSettingsFieldset- .getByRole("textbox", { name: "Sales Tax", exact: true })+ .getByRole("textbox", { name: "Sales Tax Rate", exact: true }).fill("20");await firstItemFieldset@@ -921,9 +919,7 @@ test.describe("Generate Invoice Link", () => {await page.waitForTimeout(700);// Try to generate share link - should fail with error toast- await page- .getByRole("button", { name: "Generate a link to invoice" })- .click();+ await page.getByRole("button", { name: "Generate invoice link" }).click();// Verify error toast appears with correct textawait expect(diff --git a/e2e/invoice-form.test.ts b/e2e/invoice-form.test.tsindex e21a6ad..74ade89 100644--- a/e2e/invoice-form.test.ts+++ b/e2e/invoice-form.test.ts@@ -22,10 +22,13 @@ test.describe("Invoice Generator Page", () => {});test("should redirect from /:locale/app to /", async ({ page }) => {- // old url structure- await page.goto("/en/app", { waitUntil: "commit" });-- await expect(page).toHaveURL("/?template=default");+ // listener starts FIRST+ // navigation starts SECOND+ // should eliminate flakiness+ await Promise.all([+ page.waitForURL("**/?template=default"),+ page.goto("/en/app"),+ ]);// wait for the app page to loadconst downloadPDFButton = page.getByRole("link", {@@ -33,8 +36,7 @@ test.describe("Invoice Generator Page", () => {});await expect(downloadPDFButton).toBeVisible();-- await expect(page).toHaveURL("/?template=default");+ await expect(downloadPDFButton).toBeEnabled();});test("displays correct OG meta tags for default template", async ({@@ -104,7 +106,7 @@ test.describe("Invoice Generator Page", () => {// Check main action buttonsawait expect(- page.getByRole("button", { name: "Generate a link to invoice" }),+ page.getByRole("button", { name: "Generate invoice link" }),).toBeVisible();await expect(page.getByRole("link", { name: "Download PDF in English" }),@@ -165,7 +167,7 @@ test.describe("Invoice Generator Page", () => {// Verify buttons are enabledawait expect(- page.getByRole("button", { name: "Generate a link to invoice" }),+ page.getByRole("button", { name: "Generate invoice link" }),).toBeEnabled();await expect(page.getByRole("link", { name: "Download PDF in English" }),@@ -467,7 +469,10 @@ test.describe("Invoice Generator Page", () => {// VAT field and visibility toggleawait expect(- invoiceItemsSection.getByRole("textbox", { name: "VAT", exact: true }),+ invoiceItemsSection.getByRole("textbox", {+ name: "VAT Rate",+ exact: true,+ }),).toHaveValue(firstItem.vat);await expect(invoiceItemsSection.getByRole("switch", {@@ -479,7 +484,7 @@ test.describe("Invoice Generator Page", () => {await expect(invoiceItemsSection.getByTestId(`itemVat0`)- .getByText("Enter a number (0-100), or any text (i.e. NP, OO, etc)."),+ .getByText("Enter a number (0-100) or text (e.g., NP, OO, etc)."),).toBeVisible();// Net Amount field (read-only) and visibility toggle@@ -593,7 +598,7 @@ test.describe("Invoice Generator Page", () => {}).fill("100");await invoiceItemsSection- .getByRole("textbox", { name: "VAT", exact: true })+ .getByRole("textbox", { name: "VAT Rate", exact: true }).fill("23");// Check calculated values@@ -1082,7 +1087,7 @@ test.describe("Invoice Generator Page", () => {// **VAT FIELD**const vatInput = invoiceItemsSection.getByRole("textbox", {- name: "VAT",+ name: "VAT Rate",exact: true,});@@ -1168,7 +1173,7 @@ test.describe("Invoice Generator Page", () => {exact: true,});const vatInput = invoiceItemsSection.getByRole("textbox", {- name: "VAT",+ name: "VAT Rate",exact: true,});diff --git a/e2e/stripe-invoice-template/share-logic.test.ts b/e2e/stripe-invoice-template/share-logic.test.tsindex aecabfc..5b44a1e 100644--- a/e2e/stripe-invoice-template/share-logic.test.ts+++ b/e2e/stripe-invoice-template/share-logic.test.ts@@ -25,7 +25,7 @@ test.describe("Stripe Invoice Sharing Logic", () => {// Verify share button is still enabled (no logo uploaded)const shareButton = page.getByRole("button", {- name: "Generate a link to invoice",+ name: "Generate invoice link",});await expect(shareButton).toBeVisible();await expect(shareButton).toBeEnabled();@@ -119,7 +119,7 @@ test.describe("Stripe Invoice Sharing Logic", () => {// Verify share button is disabledconst shareButton = page.getByRole("button", {- name: "Generate a link to invoice",+ name: "Generate invoice link",});await expect(shareButton).toHaveAttribute("data-disabled", "true");@@ -161,7 +161,7 @@ test.describe("Stripe Invoice Sharing Logic", () => {// Verify share button is disabledconst shareButton = page.getByRole("button", {- name: "Generate a link to invoice",+ name: "Generate invoice link",});await expect(shareButton).toHaveAttribute("data-disabled", "true");@@ -213,7 +213,7 @@ test.describe("Stripe Invoice Sharing Logic", () => {// Start with default template and verify share button is enabledconst shareButton = page.getByRole("button", {- name: "Generate a link to invoice",+ name: "Generate invoice link",});await expect(shareButton).toBeEnabled();@@ -259,7 +259,7 @@ test.describe("Stripe Invoice Sharing Logic", () => {).toBeVisible();const shareButton = page.getByRole("button", {- name: "Generate a link to invoice",+ name: "Generate invoice link",});// Verify share button is disabled@@ -310,7 +310,7 @@ test.describe("Stripe Invoice Sharing Logic", () => {// Verify share button is visible and enabled in mobileconst shareButton = page.getByRole("button", {- name: "Generate a link to invoice",+ name: "Generate invoice link",});await expect(shareButton).toBeVisible();await expect(shareButton).toBeEnabled();@@ -377,7 +377,7 @@ test.describe("Stripe Invoice Sharing Logic", () => {// Click share button β should show error toast because form has validation errorsconst shareButton = page.getByRole("button", {- name: "Generate a link to invoice",+ name: "Generate invoice link",});await shareButton.click();diff --git a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts b/e2e/stripe-invoice-template/stripe-invoice-template.test.tsindex ddf5904..849f9bb 100644--- a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts+++ b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts@@ -27,6 +27,8 @@ test.describe("Stripe Invoice Template", () => {test("displays correct OG meta tags for Stripe template", async ({page,}) => {+ await expect(page).toHaveURL("/?template=default");+// Navigate to Stripe templateawait page.goto("/?template=stripe");await expect(page).toHaveURL("/?template=stripe");@@ -742,7 +744,7 @@ test.describe("Stripe Invoice Template", () => {// Set VAT to a numeric value to make Tax column visible in Stripeconst vatInput = invoiceItemsSection.getByRole("textbox", {- name: "VAT",+ name: "VAT Rate",exact: true,});await vatInput.clear();@@ -857,7 +859,7 @@ test.describe("Stripe Invoice Template", () => {await page.waitForURL("/?template=default");const newVatInput = page.getByRole("textbox", {- name: "VAT",+ name: "VAT Rate",exact: true,});@@ -1249,7 +1251,7 @@ test.describe("Stripe Invoice Template", () => {(i + 2) % 3 === 0 ? "50" : (i + 2) % 2 === 0 ? "20" : "10";await taxSettingsFieldset- .getByRole("textbox", { name: "VAT", exact: true })+ .getByRole("textbox", { name: "VAT Rate", exact: true }).fill(taxRate);await itemFieldsetdiff --git a/playwright.config.ts b/playwright.config.tsindex 4f525c6..b0d8353 100644--- a/playwright.config.ts+++ b/playwright.config.ts@@ -33,7 +33,7 @@ export default defineConfig({workers: process.env.CI ? 1 : undefined, // IMPORTANT: if tests are flaky locally, make `workers: 1` or `workers: 2`/* timeout for expect assertions */expect: {- timeout: isLocal ? 10_000 : 15_000,+ timeout: isLocal ? 10_000 : 25_000,},// /* timeout for test execution */@@ -58,7 +58,7 @@ export default defineConfig({timezoneId: "Europe/Warsaw",// applies to: page.goto(), redirects, page.waitForURL(), clicking links that trigger navigation, form submits that navigate- navigationTimeout: 30_000,+ navigationTimeout: 45_000,// Applies to interactions: locator.click(), fill(), check(), hover(), press(), dragTo()actionTimeout: 15_000,},diff --git a/src/app/(app)/components/index.tsx b/src/app/(app)/components/index.tsxindex c009af7..5489f33 100644--- a/src/app/(app)/components/index.tsx+++ b/src/app/(app)/components/index.tsx@@ -219,7 +219,7 @@ export function InvoiceClientPage({variant="outline"className={cn("mx-2 w-full")}>- Generate a link to invoice+ Generate invoice link</Button>}content={diff --git a/src/app/(app)/components/invoice-form/sections/invoice-items.tsx b/src/app/(app)/components/invoice-form/sections/invoice-items.tsxindex 3744db7..dd87f35 100644--- a/src/app/(app)/components/invoice-form/sections/invoice-items.tsx+++ b/src/app/(app)/components/invoice-form/sections/invoice-items.tsx@@ -541,7 +541,7 @@ export const InvoiceItems = memo(function InvoiceItems({<div data-testid={`itemVat${index}`} className="mt-4"><div className="mb-2 flex items-center justify-between"><Label htmlFor={`itemVat${index}`} className="">- {taxLabelText}+ {taxLabelText} Rate</Label></div>@@ -565,7 +565,7 @@ export const InvoiceItems = memo(function InvoiceItems({</ErrorMessage>) : (<InputHelperMessage>- Enter a number (0-100), or any text (i.e. NP, OO, etc).+ Enter a number (0-100) or text (e.g., NP, OO, etc).</InputHelperMessage>)}</div>diff --git a/src/app/(app)/components/invoice-page-header.tsx b/src/app/(app)/components/invoice-page-header.tsxindex 69b9d07..5846452 100644--- a/src/app/(app)/components/invoice-page-header.tsx+++ b/src/app/(app)/components/invoice-page-header.tsx@@ -104,7 +104,7 @@ export function InvoicePageHeader({variant="outline"className={cn("mx-2 mb-2 w-full lg:mx-0 lg:mb-0 lg:w-auto")}>- Generate a link to invoice+ Generate invoice link</Button>}content={diff --git a/src/app/(app)/components/invoice-pdf-download-link.tsx b/src/app/(app)/components/invoice-pdf-download-link.tsxindex 0a0502b..c797faf 100644--- a/src/app/(app)/components/invoice-pdf-download-link.tsx+++ b/src/app/(app)/components/invoice-pdf-download-link.tsx@@ -21,6 +21,7 @@ import { isTelegramInAppBrowser } from "@/utils/is-telegram-in-app-browser";import { updateAppMetadata } from "../utils/get-app-metadata";import { useCTAToast } from "../contexts/cta-toast-context";import { CTA_TOAST_TIMEOUT, showRandomCTAToast } from "./cta-toasts";+import { haptic } from "@/lib/haptic";// Separate button states into a memoized componentconst ButtonContent = ({@@ -101,6 +102,8 @@ export function InvoicePDFDownloadLink({}if (!isLoading && !error) {+ haptic();+// track download eventumamiTrackEvent("download_invoice", {data: {diff --git a/src/app/(app)/page.client.tsx b/src/app/(app)/page.client.tsxindex 065c72c..f660c78 100644--- a/src/app/(app)/page.client.tsx+++ b/src/app/(app)/page.client.tsx@@ -43,6 +43,7 @@ import { generateQrCodeDataUrl } from "./utils/generate-qr-code-data-url";import { handleInvoiceNumberBreakingChange } from "./utils/invoice-number-breaking-change";import { InvoicePageHeader } from "@/app/(app)/components/invoice-page-header";import { Button } from "@/components/ui/button";+import { haptic } from "@/lib/haptic";// TODO: enable later when PRO version is released, this is PRO FEATURE =)// import { InvoicePDFDownloadMultipleLanguages } from "./components/invoice-pdf-download-multiple-languages";@@ -389,7 +390,7 @@ export function AppPageClient({<p className="text-muted-foreground text-pretty leading-relaxed">Click{" "}<span className="font-semibold text-foreground">- 'Generate a link to invoice'+ 'Generate invoice link'</span>{" "}to create an updated shareable link.</p>@@ -448,7 +449,7 @@ export function AppPageClient({<p className="text-muted-foreground text-pretty leading-relaxed">Click{" "}<span className="font-semibold text-foreground">- 'Generate a link to invoice'+ 'Generate invoice link'</span>{" "}to create a new shareable link.</p>@@ -528,6 +529,9 @@ export function AppPageClient({try {const newInvoiceDataValidated = invoiceSchema.parse(invoiceDataState);+ // trigger haptic feedback on mobile devices+ haptic();+// Compress JSON keys before stringifying to reduce URL sizeconst compressedKeys = compressInvoiceData(newInvoiceDataValidated);const compressedJson = JSON.stringify(compressedKeys);diff --git a/src/lib/haptic.ts b/src/lib/haptic.tsnew file mode 100644index 0000000..d4cd74f--- /dev/null+++ b/src/lib/haptic.ts@@ -0,0 +1,56 @@+"use client";++export const supportsHaptic =+ typeof window !== "undefined"+ ? window.matchMedia("(pointer: coarse)").matches+ : false;++/**+ * Type guard to check if navigator supports vibrate API+ */+function hasVibrate(+ nav: Navigator,+): nav is Navigator & { vibrate: (pattern: number | number[]) => boolean } {+ return "vibrate" in nav && typeof nav.vibrate === "function";+}++/**+ * Trigger haptic feedback on mobile devices.+ * Uses Vibration API on Android/modern browsers, and iOS checkbox trick on iOS.+ *+ * @param pattern - Vibration duration (ms) or pattern.+ * Custom patterns only work on Android devices. iOS uses fixed feedback.+ * See [Vibration API](https://developer.mozilla.org/docs/Web/API/Vibration_API)+ *+ * @example+ * import { haptic } from "@/lib/haptic"+ *+ * <Button onClick={() => haptic()}>Haptic</Button>+ */+export function haptic(pattern: number | number[] = 50) {+ try {+ if (!supportsHaptic) return;++ if (hasVibrate(navigator)) {+ navigator.vibrate(pattern);+ return;+ }++ // iOS haptic trick via checkbox switch element+ const label = document.createElement("label");+ label.ariaHidden = "true";+ label.style.display = "none";++ const input = document.createElement("input");+ input.type = "checkbox";+ input.setAttribute("switch", "");+ label.appendChild(input);++ try {+ document.head.appendChild(label);+ label.click();+ } finally {+ document.head.removeChild(label);+ }+ } catch {}+}