The Astro Supabase starter demonstrates how to integrate Supabase into an Astro project deployed on Netlify.
All commands are run from the root of the project, from a terminal:
| Command | Action |
|---|---|
npm install |
Installs dependencies |
npm run dev |
Starts local dev server at localhost:4321 |
npm run build |
Build your production site to ./dist/ |
npm run preview |
Preview your build locally, before deploying |
npm run astro ... |
Run CLI commands like astro add, astro check |
npm run astro -- --help |
Get help using the Astro CLI |
| Prerequisites |
|---|
| Node.js v18.14+ |
| (optional) nvm for Node version management |
| Netlify account |
| Netlify CLI. |
| Supabase account |
To use this template, you’ll need to set up and seed a new Supabase database.
- Create a new Supabase project.
- Run the SQL commands found in the
supabase/migrationsdirectory in the Supabase UI. - To seed the database with data, you can import the contents of the
supabase/seed.csvfile in the Supabase UI.
ℹ️ Note: This template was created to be used with the Supabase extension for Netlify. If you don’t wish to use the Netlify Supabase extension, you will need to set the SUPABASE_DATABASE_URL and SUPABASE_ANON_KEY environment variables in the .env file.
-
Clone this repository, then run
npm installin its root directory. -
For the starter to have full functionality locally, please ensure you have an up-to-date version of Netlify CLI. Run:
npm install netlify-cli@latest -g
- Link your local repository to the deployed Netlify site. This will ensure you're using the same runtime version for both local development and your deployed site.
netlify link
- Then, run the Astro.js development server via Netlify CLI:
netlify dev --target-port 4321
If your browser doesn't navigate to the site automatically, visit localhost:8888.
If you get stuck along the way, get help in our support forums.