This is a basic astro template with Supabase SSR integration.
Supabase + Astro = ❤️
The auth flow is made on the client, tokens are then passed to the server through cookies, the authentication for private pages is performed on the server.
Prerequisites
The template builds on top of Astro's default blank theme, the structure should be self explanatory but if you have any doubts you'll probably find most answers in the astro docs.
For the service I'm using the supabase local development setup.
Supabase should be configured with "user management data" template (in the SQL editor), in alternative you can run the sql queries following this guide (just for the supabase configuration).
A boilerplate .env file with placeholders is provided, you'll need to add your supabase keys there.
Included pages
- home: which has no authentication requirements.
- profile: reachable only if authenticated.
- login: if authentication is already in place it will redirect to the home page.