title: SSR explained in SvelteKit
body: <p>I recently started working with Svelte via SvelteKit and I have a few questions about this framework to which I haven't been able to find any direct answers in the source/documentation:</p>
  <ol>
  <li>SvelteKit has <strong>SSR</strong> and in the documentation it says:</li>
  </ol>
  <blockquote>
  <p>All server-side code, including endpoints, has access to fetch in case you need to request data from external APIs.</p>
  </blockquote>
  <ul>
  <li>What code is <strong>server-side rendered</strong> besides endpoints and how it decides this? All the code from scripts from svelte pages runs on the client or some of it runs on the server?</li>
  <li>In order to make use of <strong>SSR locally</strong> you need an adapter for it or does svelte start a server on its own?</li>
  <li>How does <strong>SSR</strong> work in a <strong>production environment</strong> like <strong>Netlify</strong> for example. Is the netlify adapter is used for SSR (running the <strong>endpoints</strong> in a <strong>netlify function</strong>)? If a netlify adapter is not provided, how/where would the <strong>endpoints</strong> run?</li>
  </ul>
  <ol start="2">
  <li>If I want to use <strong>custom netlify functions</strong> in a <strong>sveltekit project</strong> what <strong>configurations</strong> are needed (besides netlify.toml and netlify adapter) in order <strong>for netlify to recognize the functions</strong> from inside the <strong>functions directory</strong>?</li>
  <li>What is the <strong>difference here between SSR and prerendering</strong>? <strong>SSR</strong> is used only for <strong>endpoints</strong> and other js code and <strong>prerendering</strong> is used for generating the <strong>Html</strong> to send it to the <strong>client</strong> which will then be hydrated, with the <strong>compiled js code</strong>, also sent to the browser?</li>
  </ol>
  <p>Thanks!</p>