---
title: "Discussion on \"SSR Authentication guide for SvelteKit\" | Hashnode"
description: "Discussion on \"SSR Authentication guide for SvelteKit\". In this post, I will write about how to guard your pages and endpoints and how to authenticate easily with SSR.\n\nDisclaimer: SvelteKit is still in beta; it could change a lot before the first official release. I will try to keep this post updated as ..."
url: "https://hashnode.com/posts/ssr-authentication-guide-for-sveltekit/60aa508320d1f45ceb7efab1"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [SSR Authentication guide for SvelteKit](https://blog.andrasbacsai.com/ssr-authentication-guide-for-sveltekit?utm_source=hashnode&utm_medium=feed)

In this post, I will write about how to guard your pages and endpoints and how to authenticate easily with SSR. Disclaimer: SvelteKit is still in beta; it could change a lot before the first official release. I will try to keep this post updated as ...

May 23, 2021 · 5 min read · blog.andrasbacsai.com  
Updated Jun 17, 2022  
Read the article

-   [#svelte](https://hashnode.com/tag/svelte)
-   [#authentication](https://hashnode.com/tag/authentication)
-   [#ssr](https://hashnode.com/tag/ssr)

## Written by

[Andras Bacsai](https://hashnode.com/@andrasbacsai)

@andrasbacsai · Székesfehérvár, Hungary

  
[View profile](https://hashnode.com/@andrasbacsai)

Indie hacker

More about me

## Responses 4

Markdown supported · ⌘↵ to post

[Andre Esteves Perrone](https://hashnode.com/@Artneo)

[Jul 6, 2022](https://hashnode.com/posts/ssr-authentication-guide-for-sveltekit/60aa508320d1f45ceb7efab1/comment/62c5b77560d6757393f824da)

I managed to retrieve the "isLoggedIn" with the load( {session} ). Awesome tutorial, thanks a lot! 🙂

[Franco Zenatti](https://hashnode.com/@frankz)

[Apr 5, 2022](https://hashnode.com/posts/ssr-authentication-guide-for-sveltekit/60aa508320d1f45ceb7efab1/comment/624c6b3a24471c433062be71)

Thanks for answering so quickly. What I didn’t understand in your answer is how do I generate HTML on the server (I know this is what PHP does) with JS and Svelte or run it on the client side. you have some link possibly with examples to give me, relative to such topic ?

[Franco Zenatti](https://hashnode.com/@frankz)

[Apr 4, 2022](https://hashnode.com/posts/ssr-authentication-guide-for-sveltekit/60aa508320d1f45ceb7efab1/comment/624b298d16cdedfe9f7d1036)

the program should run on xampp where I have apache, php and mysql, and then works with adapter-static? Also I did not understand the difference of implentation between SPA and SSR, could you explain it to me ?

[Andras Bacsai](https://hashnode.com/@andrasbacsai)

[Apr 5, 2022](https://hashnode.com/posts/ssr-authentication-guide-for-sveltekit/60aa508320d1f45ceb7efab1/comment/624b298d16cdedfe9f7d1036#reply-624c104b2b09bb392ea5cad4)

Yes, if you build it with adapter-static, you can serve it with Apache as the built files are regular HTML/CSS/JS files.

In short:

-   SPA means it will run in the browser only, so it only contains HTML/CSS/JS files. Routing (navigating within the app to a different route) is done on the client side.
-   SSR means the HTML is generated on the server-side, so you need to have a NodeJS running and serving your SSR application.

I hope it helps you!

[Aditya](https://hashnode.com/@adityavinodh)

[Sep 15, 2021](https://hashnode.com/posts/ssr-authentication-guide-for-sveltekit/60aa508320d1f45ceb7efab1/comment/614278739c949972b85c799a)

Thanks for the article. It was the perfect guide I was searching for. Very well written and easy to understand.

[Andras Bacsai](https://hashnode.com/@andrasbacsai)

[Sep 16, 2021](https://hashnode.com/posts/ssr-authentication-guide-for-sveltekit/60aa508320d1f45ceb7efab1/comment/614278739c949972b85c799a#reply-6142eef09c949972b85c83ff)

Thank you, Aditya! 🙂
