Short answer: render a <script type="application/ld+json"> tag from your page.tsx, build the object from the same data the page shows, escape < before you inject it, and type it with schema-dts. For Google's software app rich result you need name, offers.price and either aggregateRating or review. With no real ratings, ship the markup anyway and leave the rating fields out.
I run a small software directory, website.show, where every product page carries a SoftwareApplication block. Most of what follows comes from wiring that up in the App Router and from fixing the mistakes I made on the way.
What is SoftwareApplication JSON-LD?
It is a schema.org type that describes an app: its name, what it does, what it costs, which platform it runs on and where to get it. JSON-LD is the format Google recommends for structured data, because it sits in one script tag and does not touch your markup.
There is also WebApplication, a subtype for software that runs in the browser. Either works for a SaaS. The full property list is on schema.org/SoftwareApplication.
What does Google require for the software app rich result?
Google's software app documentation lists three required pieces:
| Property | Required? | Notes |
|---|---|---|
name |
Yes | The app's name |
offers.price |
Yes | Use 0 for a free app; add priceCurrency when the price is above 0 |
aggregateRating or review
|
One of them | Must follow the review snippet rules |
applicationCategory |
Recommended | One of Google's fixed values, like BusinessApplication or DeveloperApplication
|
operatingSystem |
Recommended | For a web app, Web or a browser list is common |
The rating line is where most SaaS sites go wrong. The review snippet guidelines say ratings must come from real users and be visible to them on the page. A hard-coded 4.9 that nobody gave is the fastest way to a manual action. If you have no ratings, drop the field. You will not get stars, but the rest of the markup still tells search engines and AI crawlers what the page is about.
How do you add JSON-LD in the Next.js App Router?
The Next.js JSON-LD guide recommends a plain script tag in layout.tsx or page.tsx. There is no special Metadata API field for it.
Here is a version for a product page. It builds the object from the same record the page renders, so the markup never drifts from what users see.
// app/product/[slug]/page.tsx
import type { SoftwareApplication, WithContext } from "schema-dts";
import { getProduct } from "@/lib/products";
export default async function ProductPage({
params,
}: {
params: Promise<{ slug: string }>;
}) {
const { slug } = await params;
const product = await getProduct(slug);
const jsonLd: WithContext<SoftwareApplication> = {
"@context": "https://schema.org",
"@type": "SoftwareApplication",
name: product.name,
description: product.tagline,
url: product.website,
applicationCategory: product.googleCategory, // e.g. "DeveloperApplication"
operatingSystem: "Web",
offers: {
"@type": "Offer",
price: product.price ?? 0,
priceCurrency: "USD",
},
...(product.ratingCount > 0 && {
aggregateRating: {
"@type": "AggregateRating",
ratingValue: product.ratingAverage,
ratingCount: product.ratingCount,
},
}),
};
return (
<main>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify(jsonLd).replace(/</g, "\\u003c"),
}}
/>
<h1>{product.name}</h1>
{/* the rest of the page */}
</main>
);
}
Three details in that snippet are easy to miss.
-
The
.replace(/</g, "\\u003c").JSON.stringifydoes not escape HTML. If a product description contains</script>, it closes your tag early and whatever follows runs as markup. The Next.js docs call this out as an XSS risk. Swapping<for its unicode escape keeps the JSON valid and the tag closed. -
The conditional rating. The spread only adds
aggregateRatingwhen real ratings exist. No ratings, no field, no fake stars. -
schema-dtstypes.WithContext<SoftwareApplication>catches typos likeaplicationCategoryat build time. Install it withnpm i -D schema-dts; it ships types only, nothing reaches the client bundle.
Which applicationCategory should you use?
Google accepts a fixed list. The ones that fit most SaaS products:
-
DeveloperApplicationfor dev tools, APIs, CLIs -
BusinessApplicationfor CRM, invoicing, analytics, most B2B -
DesignApplicationfor design and image tools -
UtilitiesApplicationfor small single-purpose tools -
FinanceApplication,EducationalApplication,HealthApplicationfor those niches
A free-text value like "Productivity" or "AI tool" is valid schema.org, but Google treats it as unknown. If your app has its own category names, keep them for the UI and map them to Google's list in one small function:
const GOOGLE_CATEGORY: Record<string, string> = {
"developer-tools": "DeveloperApplication",
marketing: "BusinessApplication",
design: "DesignApplication",
finance: "FinanceApplication",
};
export function googleCategory(slug: string) {
return GOOGLE_CATEGORY[slug] ?? "UtilitiesApplication";
}
Should the homepage and product pages use the same type?
Not always. A rough rule:
-
Your own SaaS homepage:
SoftwareApplication(orWebApplication) describing your product, plus anOrganizationblock for the company. -
A page that lists many apps (a directory, a marketplace category): an
ItemListof links, not one bigSoftwareApplication. -
A page about one app you do not own (a review, a directory listing):
SoftwareApplicationis fine, withurlpointing to the app's own site.
Add a BreadcrumbList on deep pages too. It is cheap, and it often shows in results even when nothing else does.
How do you test SoftwareApplication markup?
Check it at three levels, from fastest to slowest.
-
Unit test the object. Your JSON-LD is a plain object, so test it like one. Assert that
nameandoffers.priceexist, and thataggregateRatingis absent whenratingCountis 0. This catches regressions on every commit. - Validate the syntax. Paste the rendered HTML or a URL into the Schema Markup Validator. It checks against schema.org itself, so it flags unknown properties and wrong types.
- Check Google's view. Google's Rich Results Test, linked from the structured data introduction, shows whether the page is eligible for the software app result and lists missing required fields. Without ratings it will tell you the rating is missing. That is expected.
A minimal Vitest check:
import { describe, it, expect } from "vitest";
import { buildJsonLd } from "@/lib/jsonld";
describe("SoftwareApplication JSON-LD", () => {
it("never invents ratings", () => {
const ld = buildJsonLd({ name: "Demo", price: 0, ratingCount: 0 });
expect(ld.name).toBe("Demo");
expect(ld.offers).toMatchObject({ price: 0 });
expect(ld).not.toHaveProperty("aggregateRating");
});
it("escapes closing script tags", () => {
const html = serialize({ description: "</script><b>x</b>" });
expect(html).not.toContain("</script>");
});
});
To make the second test work, move the JSON.stringify(...).replace(...) call into a small serialize() helper instead of inlining it in JSX.
Common mistakes
- Copying a generator block with a rating in it. Remove any rating you cannot back with real reviews shown on the page.
- Markup that disagrees with the page. A price of 0 in JSON-LD and "$29/month" in the pricing table is a mismatch. Build both from one source.
- Rendering JSON-LD only on the client. If the script is added by a client component after hydration, crawlers that do not run JavaScript never see it. Keep it in a server component.
-
One giant block for a listing page. Ten apps on a category page should be an
ItemList, not tenSoftwareApplicationobjects that all claim to be the main entity. -
Forgetting
priceCurrencyon paid apps. Google will guess, and it can guess wrong.
FAQ
Do I need JSON-LD if I already have good meta tags?
They do different jobs. Meta tags describe the page; JSON-LD describes the thing the page is about. Search engines and AI assistants use the second to understand entities.
Can I use the Next.js Metadata API for JSON-LD?
No. The current recommendation is a script tag in the page or layout.
SoftwareApplication or WebApplication?
Both are accepted. WebApplication is more precise for a browser-only SaaS. Pick one and stay consistent across pages.
Will this get me review stars?
Only with real ratings that follow Google's review snippet rules. Without them you still get a clearer entity for search and AI answers, just no stars.
Where can I read more about the rating rules?
I wrote up the rating rules and a full SaaS example in more detail, including which fields to leave out when you are just starting.
Top comments (0)