• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
rlesser

rlesser

getNextSSR

Public
Like
getNextSSR
Home
Code
2
README.md
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
7/30/2023
README.md

getNextSSR - fetch data from Next.js SSR-based sites

Many modern websites use Next.js and Server-side Rendering (SSR) to serve their website and the data to populate it. Instead of standard API calls, this manifests in the browser as calls routed through dynamic endpoints.

This val handles the url construction and response parsing, giving you access to the endpoint and data.

Input

  • websiteUrl - The website's url, like google.com or val.town let getNextSSR: (websiteUrl: string) => Promise<(endpoint: string) => Promise<Record<string, any>>>

Returns

  • fetching function - A function that takes in an endpoint and returns the endpoint's response data:
    • Input
    • endpoint - The endpoint string, like results.json or trending.json?page=2
    • Returns
    • data - The endpoint response data, without NextJS artifacts.

Example

const fetch = await @rlesser.getNextSSR("example.com");
const data = fetch("results.json");
return data;

Migrated from folder: utils/getNextSSR

FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.