Skip to content

Free & Open-Source Invoice Generator - No Sign-Up, No Ads, Instant PDF Export, 100% In-Browser, and Fully Customizable Templates.

chore: add metadata + minor fixes

VladSezc6418457ac29
diff --git a/README.md b/README.md
index 76724e3..5bcd3c6 100644
--- a/README.md
+++ b/README.md
@@ -1,21 +1,14 @@
## TODO
-- [ ] Add multiple items in invoice table and calculate total price and vat correctly, display pdf correctly
-- [ ] BUG: type '15NP' or any Invalid input 'lol' in VAT input -> see error and can't clear input
-- [ ] try to use 'update' from useFieldArray?
-
- [ ] Test with big values/numbers on the invoice, e.g. 1 000 000 (check if pdf is displayed correctly)
- [ ] Add error handling and error pages/messages
-- [ ] Add link to github repo and make it open source
- [ ] Create a name for the project
-- [ ] Add link to our prod website in the footer of pdf
- [ ] TEST EVERYTHING on chrome, safari, firefox and maybe on mobile?? + introduce beta testers (colleagues, friends, family)
-- [ ] Deploy to Vercel
- [ ] Add email to contact us
-- [ ] Update to next 15???
+- [ ] Add link to github repo and make it open source
- Check https://x.com/levelsio/status/1860015822472905091
-(Payments)
+(Payments, not sure if we need this)
- [ ] Introduce payments via stripe? https://chatgpt.com/c/673db98b-a860-8007-8b53-1d7e0a9f40c1 or https://polar.sh/
- [ ] Force to log in to download invoice? (for log in we can use https://github.com/vvo/iron-session)
@@ -23,7 +16,6 @@
(BUGS and improvements, double check everything also if we need this)
- [ ] BindingError issue https://github.com/diegomura/react-pdf/issues/2892
-- [ ] smth is wrong with bold styles after downgrading deps
- [ ] Add a button to create a shareable link to invoice. Fix current logic, because now we always put all invoice data in url.
- [ ] do not save those things (in page.tsx) in local storage, because they are not needed to be saved, we need them to be recalculated every time for better UX:
@@ -32,14 +24,11 @@
const invoiceCurrentMonthAndYear = dayjs().format("MM-YYYY");
const paymentDue = dayjs(today).add(14, "days").format("YYYY-MM-DD");
-(FONTS, check fonts here https://fontsource.org/)
-
-- [ ] use https://next-international.vercel.app/docs for translations (i18n)?
-- [ ] Add PL language and font that supports it, use https://www.npmjs.com/package/n2words or similar for numbers into words
-- [ ] add new font to match afaktury.pl or at least supports polish language https://github.com/diegomura/react-pdf/issues/2675#issuecomment-2388723178 (FreeSans, FreeSansBold, Helvetica or just use Roboto https://fonts.google.com/?lang=pl_Latn&categoryFilters=Sans+Serif:%2FSans%2F*;Feeling:%2FExpressive%2FBusiness)
-
(OTHER)
- [ ] cleanup code
- [ ] Move to SPA? vite or smth, because we have pure SPA
-- [ ] Add more languages?
+- [ ] Add more languages to pdf?
+- [ ] Update to next 15???
+- [ ] Use https://onedollarstats.com/analytics for analytics?
+- [ ] Add changelog public and on github
diff --git a/package.json b/package.json
index 65dbf6a..33c68ba 100644
--- a/package.json
+++ b/package.json
@@ -12,6 +12,7 @@
"@hookform/resolvers": "3.9.0",
"@react-pdf/layout": "4.0.1",
"@react-pdf/renderer": "4.0.1",
+ "@vercel/analytics": "1.4.1",
"dayjs": "1.11.13",
"lucide-react": "0.460.0",
"lz-string": "1.5.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 10ae8c4..68fc029 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -17,6 +17,9 @@ importers:
'@react-pdf/renderer':
specifier: 4.0.1
version: 4.0.1([email protected])
+ '@vercel/analytics':
+ specifier: 1.4.1
dayjs:
specifier: 1.11.13
version: 1.11.13
@@ -352,6 +355,32 @@ packages:
resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==}
+ '@vercel/[email protected]':
+ resolution: {integrity: sha512-ekpL4ReX2TH3LnrRZTUKjHHNpNy9S1I7QmS+g/RQXoSUQ8ienzosuX7T9djZ/s8zPhBx1mpHP/Rw5875N+zQIQ==}
+ peerDependencies:
+ '@remix-run/react': ^2
+ '@sveltejs/kit': ^1 || ^2
+ next: '>= 13'
+ react: ^18 || ^19 || ^19.0.0-rc
+ svelte: '>= 4'
+ vue: ^3
+ vue-router: ^4
+ peerDependenciesMeta:
+ '@remix-run/react':
+ optional: true
+ '@sveltejs/kit':
+ optional: true
+ next:
+ optional: true
+ react:
+ optional: true
+ svelte:
+ optional: true
+ vue:
+ optional: true
+ vue-router:
+ optional: true
+
resolution: {integrity: sha512-d8XPSGjfyzlXC3Xx891DJRyZfqk5JU0BJrDQcsWomFIV1/BIzPW5HDH5iDdWpqWaav0YVIEzT1RHTwWr0FFshA==}
@@ -2150,6 +2179,11 @@ snapshots:
'@ungap/[email protected]': {}
+ optionalDependencies:
+ react: 18.3.1
+
diff --git a/src/app/components/invoice-pdf-template/index.tsx b/src/app/components/invoice-pdf-template/index.tsx
index 1934916..f4bebe8 100644
--- a/src/app/components/invoice-pdf-template/index.tsx
+++ b/src/app/components/invoice-pdf-template/index.tsx
@@ -4,6 +4,7 @@ import { type InvoiceData } from "@/app/schema";
import {
Document,
Font,
+ Link,
Page,
StyleSheet,
Text,
@@ -17,6 +18,8 @@ import { InvoiceVATSummaryTable } from "./invoice-vat-summary-table";
import { InvoicePaymentTotals } from "./invoice-payment-totals";
import { translations } from "./translations";
+const PROD_WEBSITE_URL = "https://pdf-invoice-generator-one.vercel.app";
+
// Open sans seems to be working fine with EN and PL
const fontFamily = "Open Sans";
const fontFamilyBold = "Open Sans";
@@ -236,10 +239,14 @@ export const InvoicePdfTemplate = ({
{/* Footer */}
<View style={styles.footer}>
- {/* Created with */}
<Text style={[styles.fontSize7]}>
- {/* TODO: change this later to our prod website */}
- Created by OUR PROJECT NAME
+ Created with{" "}
+ <Link
+ style={[styles.fontSize7, { color: "black" }]}
+ src={PROD_WEBSITE_URL}
+ >
+ {PROD_WEBSITE_URL}
+ </Link>
</Text>
{/* Page number */}
<Text
diff --git a/src/app/components/invoice-pdf-viewer.tsx b/src/app/components/invoice-pdf-viewer.tsx
index 9b3b7e3..cbaddb9 100644
--- a/src/app/components/invoice-pdf-viewer.tsx
+++ b/src/app/components/invoice-pdf-viewer.tsx
@@ -2,11 +2,7 @@ import { PDFViewer } from "@react-pdf/renderer";
export function InvoicePDFViewer({ children }: { children: React.ReactNode }) {
return (
- <PDFViewer
- width="100%"
- height="650px"
- className="mb-4 h-[600px] lg:h-[650px]"
- >
+ <PDFViewer width="100%" className="mb-4 h-[600px] lg:h-[650px] w-full">
{/* @ts-expect-error PR with fix?: https://github.com/diegomura/react-pdf/pull/2888 */}
{children}
</PDFViewer>
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 82d4b88..2128d22 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -1,11 +1,60 @@
import type { Metadata } from "next";
import { NuqsAdapter } from "nuqs/adapters/next/app";
+import { Analytics } from "@vercel/analytics/next";
import "./globals.css";
export const metadata: Metadata = {
- title: "Create Next App",
- description: "Generated by create next app",
+ title: "Free PDF Invoice Generator",
+ description:
+ "Generate professional PDF invoices for free. Supports multiple languages, currencies, and customizable templates. Perfect for freelancers and small businesses.",
+ keywords:
+ "invoice generator, pdf invoice, free invoice generator, business invoice, invoice template, open source, free, pdf, invoice, generator, business, freelancer",
+ authors: [{ name: "Uladzislau Sazonau" }],
+ creator: "Uladzislau Sazonau",
+ publisher: "Uladzislau Sazonau",
+ metadataBase: new URL("https://pdf-invoice-generator-one.vercel.app"),
+ alternates: {
+ canonical: "/",
+ },
+ openGraph: {
+ title: "Free PDF Invoice Generator",
+ description:
+ "Generate professional PDF invoices for free. Supports multiple languages, currencies, and customizable templates.",
+ url: "https://pdf-invoice-generator-one.vercel.app",
+ siteName: "PDF Invoice Generator",
+ locale: "en_US",
+ type: "website",
+ // images: [
+ // {
+ // url: "/og-image.png",
+ // width: 1200,
+ // height: 630,
+ // alt: "PDF Invoice Generator Preview",
+ // },
+ // ],
+ },
+ twitter: {
+ card: "summary_large_image",
+ title: "Free PDF Invoice Generator",
+ description:
+ "Generate professional PDF invoices for free. Supports multiple languages, currencies, and customizable templates.",
+ // images: ["/og-image.png"],
+ },
+ robots: {
+ index: true,
+ follow: true,
+ googleBot: {
+ index: true,
+ follow: true,
+ },
+ },
+ themeColor: "#ffffff",
+ appleWebApp: {
+ capable: true,
+ statusBarStyle: "default",
+ title: "PDF Invoice Generator",
+ },
};
export default function RootLayout({
@@ -17,6 +66,7 @@ export default function RootLayout({
<html lang="en">
<body className={`antialiased`}>
<NuqsAdapter>{children}</NuqsAdapter>
+ <Analytics />
</body>
</html>
);
diff --git a/src/app/page.tsx b/src/app/page.tsx
index ab7cad2..2924620 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -29,7 +29,7 @@ const InvoicePDFDownloadLink = dynamic(
{
ssr: false,
loading: () => (
- <div className="mb-4 lg:mb-0 w-full lg:w-[180px] text-center px-4 py-2 text-white bg-blue-500 rounded hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50">
+ <div className="mb-4 lg:mb-0 w-full lg:w-[180px] text-center px-4 py-2 text-white bg-blue-500 rounded hover:bg-blue-600">
Loading document...
</div>
),
@@ -44,7 +44,14 @@ const InvoicePDFViewer = dynamic(
{
ssr: false,
- loading: () => <div className="">Loading pdf viewer...</div>,
+ loading: () => (
+ <div className="h-full w-full flex items-center justify-center bg-gray-200 border border-gray-200">
+ <div className="text-center">
+ <div className="animate-spin w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full mx-auto mb-4" />
+ <p className="text-gray-600">Loading PDF viewer...</p>
+ </div>
+ </div>
+ ),
}
);
@@ -172,7 +179,7 @@ export default function Home() {
<div className="bg-white p-6 rounded-lg shadow-lg w-full max-w-7xl">
<div className="flex flex-row flex-wrap lg:flex-nowrap items-center justify-between w-full">
<h1 className="text-2xl font-bold mb-4 w-full text-center lg:text-left">
- Free PDF Invoice Generator
+ Free Invoice PDF Generator • Open Source
</h1>
<div className="w-full flex justify-center flex-wrap lg:flex-nowrap lg:justify-end gap-3 mb-1">
@@ -204,8 +211,18 @@ export default function Home() {
onInvoiceDataChange={handleInvoiceDataChange}
/>
</div>
+ <div className="flex justify-center mt-4">
+ <a
+ href="https://github.com/VladSez/pdf-invoice-generator"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="inline-flex items-center gap-2 text-gray-600 hover:text-gray-900"
+ >
+ <GithubIcon />
+ </a>
+ </div>
</div>
- <div className="lg:col-span-8 h-[600px] lg:h-[630px]">
+ <div className="lg:col-span-8 h-[600px] lg:h-[630px] w-full max-w-full">
<InvoicePDFViewer>
<InvoicePdfTemplate invoiceData={invoiceDataParam} />
</InvoicePDFViewer>
@@ -215,3 +232,17 @@ export default function Home() {
</div>
);
}
+
+const GithubIcon = () => {
+ return (
+ <svg
+ role="img"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ className="h-5 w-5"
+ >
+ <title>View on GitHub</title>
+ <path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" />
+ </svg>
+ );
+};