mirror of
https://github.com/supabase/supabase.git
synced 2026-05-07 17:30:25 -04:00
d8bd6b047c
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Updated examples and guides to use Supabase publishable (client) keys instead of anon keys for client-side usage across frameworks and platforms. * Renamed environment variable examples and .env templates to reflect publishable key naming. * Adjusted sample requests and client-init examples to send/use the publishable key via the apikey header where applicable. * Updated references from service_role to secret for server-side credential guidance. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: fadymak <fady@fadymak.com>
Hono Supabase Auth Example
Based on the Hono/JSX + Vite example by @MathurAditya724 \o/
This example shows how to use Supabase Auth both on the client and server side with Hono.
Supabase setup
- Create a new Supabase project at database.new
- Go to the
SQL Editorand run the following query to create thecountriestable.
-- Create the table
create table countries (
id bigint primary key generated always as identity,
name text not null
);
-- Insert some sample data into the table
insert into countries (name)
values
('Canada'),
('United States'),
('Mexico');
alter table countries enable row level security;
- In a new query, create the following access policy.
create policy "authenticated users can read countries"
on public.countries
for select to authenticated
using (true);
- Enable anonymous sign-ins in the Auth settings.
Setup
- Run
npm installto install the dependencies. - Run
cp .env.example .env. - Set the required environment vairables in your
.envfile.
Commands
Run the vite dev server
npm run dev
Building
npm run build
This project is configured to use node runtime, you can change it to your desired runtime in the vite.config.js file. We are using @hono/vite-build package for building the project and @hono/vite-dev-server for running the dev server.