- a typed fetch helper,
lib/vacademy.ts; - a server-rendered course grid with stream tabs, linking each course to its hosted page;
- optionally, your own course page with
generateMetadataand schema.org JSON-LD; app/sitemap.ts.
1. Add the key
Create a publishable key in the Vacademy dashboard under Settings → Integrations → Catalogue API & websites (details). Put it in.env.local, and in your host’s environment variables (for example Vercel → Project → Settings → Environment Variables):
.env.local
Server-side requests (no
Origin header) work without verifying a website. You only need a verified website for requests made from browser JavaScript.2. The fetch helper
lib/vacademy.ts
next: { revalidate: 60 } matches the API’s own 60-second cache: Next.js serves the cached response and refreshes it in the background at most once a minute, whatever your traffic.
3. A course grid
app/courses/page.tsx
course.url, the course’s page on the hosted catalogue site, where the visitor picks a version, adds it to the cart and pays.
4. Choose where course pages live
- Link to hosted pages (recommended)
- Host your own course pages
Your site lists courses; each card links to
course.url on the hosted catalogue site. The hosted page already has its own metadata, structured data and checkout. You do not build a course page.Example: Brahm Varchas. The main site brahmvarchas.org is a custom Next.js site. It renders stream tabs and course grids from this API on the server. Every card links to the course’s page on learning.brahmvarchas.org/store/…, where enrolment, cart and payment happen. Enquiry forms on the main site post to POST /leads.In this setup, do not put course URLs in your own sitemap: they are on another host (learning.brahmvarchas.org), and a sitemap may only list URLs of its own host. Your sitemap lists your own pages (home, the course grid, stream pages).Your own course page (optional)
app/courses/[id]/page.tsx
generateMetadataand the page both callload(id); Next.js runs that fetch once per request.- Every
*_htmlfield is sanitised by the API (jsoup relaxed safelist; images only fromhttp(s)URLs), so it is safe to render as HTML. generateStaticParamspre-renders every course at build time. Courses published later render on their first visit.structured_datadescribes the course for search engines. Itsoffers[].urlstays the hosted page, where the course is bought; the snippet sets the top-levelurlto your page.
5. Sitemap
app/sitemap.ts
Next
- Send enquiries from a server action.
- Courses: versions, languages, prices and availability.
- Going live: the checklist.