ensaio runs in two modes:
- Without Supabase (default). Leave the Supabase variables empty. There are no accounts, and the backend stores data in the local SQLite file
backend/data/voicebot.sqlite3. - With Supabase. Sign-in is required to practise, and sessions, transcripts, feedback and consents are stored in Supabase Postgres with row level security.
- Create a project at https://supabase.com/dashboard. Choose an EU region.
- In Authentication → URL Configuration, set:
- Site URL:
http://localhost:3000 - Redirect URLs: add
http://localhost:3000/auth/callback
- Site URL:
- Keep Authentication → Sign In / Providers → Email on, with "Confirm email" enabled and a minimum password length of 8.
npx supabase login
npx supabase link --project-ref <project-ref>
npx supabase db push --remote
Run these commands in a regular terminal: login opens the browser and link asks for the database password.
db push --remote applies supabase/migrations/ to the linked project. It creates profiles, consents, practice_sessions, session_events and feedback_reports, enables RLS on all of them and adds a trigger that creates a profile for every new user. It also creates the private recordings Storage bucket (audio up to 50 MB, WebM, Ogg or MP4) with its access policies.
Signed-in users send problems and ideas on /report. Admins read them and change their status on /admin. Admins are listed in private.admins, which the API cannot read or change. To make someone an admin, run this in SQL Editor after they have signed in once:
insert into private.admins (user_id)
select id from auth.users where email = 'admin@example.com';To remove an admin, delete their row from private.admins.
frontend/.env.local:
NEXT_PUBLIC_SUPABASE_URL=https://<project-ref>.supabase.co
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=sb_publishable_...
backend/.env:
VOICEBOT_SUPABASE_URL=https://<project-ref>.supabase.co
VOICEBOT_DATABASE_URL=postgresql://... # Connect → Session pooler; replace [YOUR-PASSWORD]
VOICEBOT_SUPABASE_SECRET_KEY=sb_secret_... # deletes accounts and removes expired recordings
The publishable key is safe in the browser. Never put the secret key or the database URL in the frontend.
Restart both servers after changing the environment.
The login and signup pages always show "Continue with Google" and "Continue with GitHub". Each button works only after its provider is turned on in Supabase. The client secrets stay in the Supabase dashboard. Never put them in the repo or in an environment file.
Both providers send the user back to the same Supabase URL: https://<project-ref>.supabase.co/auth/v1/callback. Supabase then sends the user to /auth/callback in the app, which must be in the Redirect URLs from step 1.
- On GitHub, open Settings → Developer settings → OAuth Apps → New OAuth App.
- Set Homepage URL to
http://localhost:3000and Authorization callback URL to the Supabase callback above. Leave Enable Device Flow off. - Copy the Client ID and generate a Client secret.
- In Supabase, open Authentication → Sign In / Providers → GitHub, turn it on and paste both values.
- Create a project at https://console.cloud.google.com.
- In Google Auth Platform → Branding, set the app name, the support email and the developer contact email.
- In Audience, choose External. While the app is in testing mode, add every Google account that should be able to sign in under Test users.
- In Clients → Create client, choose Web application and set:
- Authorized JavaScript origins:
http://localhost:3000 - Authorized redirect URIs: the Supabase callback above
- Authorized JavaScript origins:
- In Supabase, open Authentication → Sign In / Providers → Google, turn it on and paste the client ID and secret.
A new Google client can take a few minutes to start working.
When the app gets a public domain:
- Add
https://<domain>/auth/callbackto the Supabase Redirect URLs and set the Site URL tohttps://<domain>. - Add
https://<domain>to the Google Authorized JavaScript origins, set the privacy policy link in Branding tohttps://<domain>/en/privacy, and publish the app in Audience so that any Google account can sign in. - Set the GitHub OAuth App Homepage URL to
https://<domain>.
| Data | Written by | Readable by |
|---|---|---|
practice_sessions |
backend | the owner, only public columns and the context they typed (no instructions or token hash). The owner can delete a finished session, which also deletes its events |
session_events |
backend | the owner, only transcript.final and feedback.created |
consents |
backend, when a session starts | the owner, who can also withdraw them |
profiles |
trigger on sign-up | the owner, who can change locale |
Storage recordings/<user id>/<session id> |
the owner's browser, once, only for their own finished session and only after they choose to save it | the owner, through short-lived signed links, for 30 days after it was saved. The owner can delete it; the frontend deletes it with the session and the backend deletes the whole folder before it deletes the account. Every hour the backend removes recordings older than 30 days (VOICEBOT_RECORDING_RETENTION_DAYS); this needs both VOICEBOT_DATABASE_URL and the secret key |
The backend connects to Postgres directly and verifies user access tokens against the project's JWKS (/auth/v1/.well-known/jwks.json, ES256 or RS256). The project must use asymmetric JWT signing keys, which is the default for new projects.
Backend tests can run the migrations against a disposable Postgres server:
VOICEBOT_TEST_DATABASE_URL=postgresql://postgres@127.0.0.1:54329/postgres uv run pytest
backend/tests/supabase_stub.sql stands in for the Supabase auth schema and roles. Without the variable, the Postgres test is skipped.