Indie Kit provides multiple ways to protect your pages and routes based on authentication. Let's explore how to create protected content using different approaches! 🛡️
🔐 Protected by Default
In Indie Kit, these routes are automatically protected:
Any page in src/app/(in-app)/app/*
Any API route in src/app/api/app/*
No additional authentication code is needed for these paths!
Server-side authentication is more secure for initial page loads
Client-side checks are great for dynamic content and better UX
API routes should always use withAuthRequired for protection
Consider implementing refresh token logic for longer sessions
Use loading states to prevent flash of unauthorized content
Now you can create secure, authenticated pages in your Indie Kit app! Remember to always validate user permissions before displaying sensitive content. 🚀