Protecting resources with a Protected Layout and slots in Svelte / SvelteKit

Often times, we'll have pages that need to be protected and expect a user to be logged in. We covered the basics of doing this previously with the settings page, but we want to make sure we can do this anywhere without repeating too much code. We can easily do this with "slots" from Svelte and layout files from SvelteKit. In this episode I show how to do that.
🤯 Support

⏱️ Timestamps:
  • 00:00 - Introduction
  • 00:38 - Demo
  • 01:15 - Nav changes
  • 01:50 - About changes
  • 02:10 - Settings changes
  • 03:20 - Protected Layout
  • 05:00 - Other ways to do this

💌 Newsletter:

  • Twitter:
  • Twitter:
  • GitHub:

  • Slots in Svelte
  • Layouts


🎬 Subscribe!

My name is David W Parker and I’m creating and publishing videos on ProgrammingTIL to help teach anyone and everyone who wants to code. I’m a huge fan of Ruby on Rails, Svelte, TailwindCSS, and WebGL. I’ve used React a lot in the past, as well as some Vue and AngularJS. I’ve done some professional Python and Django. I like to create real applications and my tutorials will walk you through how to build something real from beginning-to-end.

svelte #sveltekit