sveltejs / sveltejs/kit

Guarded / private `prerender` remote functions

Open
#15,712 13 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

I’d like to prerender data at build time without exposing it via a public endpoint.

Currently, prerender remote functions appear to always generate publicly callable HTTP endpoints, even if they are only used internally (e.g., only referenced from guarded remote functions and never directly from the client). This makes it impossible to safely prerender sensitive or restricted data.

Examples:

  • An admin‑only “System Info” page showing build metadata (build time, branch, commit hash, etc.) that should only be visible to administrators.
  • A course platform where course content is prerendered for performance, but access to the content must stay behind a paywall and only be available to paying users.
Describe the proposed solution

I would like support for guarded or non‑public prerender functions. For example:

  • The ability to declare a prerender remote function as:
    • Authenticated / role‑protected, so that access is checked when it’s called, or
    • Internal/private, so no public HTTP endpoint is generated at all.
  • These functions should still:
    • Run at build time to compute and cache their data, and
    • Be callable from other (guarded) remote functions or server‑side logic.

This would allow us to combine the performance and stability of prerendering with proper access control for admin‑only and paywalled content.

Alternatives considered

No response

Importance

would make my life easier

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named in the issue. Start by locating the prerender remote-function implementation and how it generates HTTP endpoints, then compare it with guarded remote functions and server-side callers. Done means a documented, tested way to keep prerendered data access-controlled or private while retaining build-time computation and caching.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, backend, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.