Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Minimal Astro starter with Supabase authentication, server-side protected routes, and client-to-server token flow.
Supabase + Astro Template is a minimal boilerplate that adds server-side session protection to an Astro site using Supabase authentication.
The Supabase + Astro Template is a starter project that integrates Supabase authentication with Astro's server-side rendering. It takes your Supabase URL and anon key from an .env file, lets visitors log in through a client-side flow, and protects server-rendered pages by validating session cookies. The template includes three pages: a public home, a protected profile, and a login page that redirects authenticated users away. It builds on Astro's default blank theme, so no UI framework or styling library is included.
The browser starts the Supabase auth flow; once logged in, the session tokens are stored in cookies. On protected pages, the server reads those cookies and validates the session before rendering content. The login page checks whether a session already exists, and if so redirects to home.
No. The template builds on Astro's default blank theme, so no CSS framework or UI component library is included.
It expects Supabase CLI local development and the "user management data" template in the SQL editor. An alternative is to run the SQL queries from Supabase's with-react tutorial.
The profile page is reachable only when authenticated. The home page has no authentication requirements, and the login page redirects to home if you are already logged in.
A boilerplate .env file with placeholders lives in the project root; fill in your Supabase URL and anon key there.
