Supabase Setup
Use this guide to bootstrap a fresh Supabase project for Hikyaku before starting the web frontend, scheduler, or server services.
Prerequisites
- A Supabase account(either self hosted or on supabase.com)
- Access to the local
schemarepository in this workspace - Your local or deployed Hikyaku app URLs
Create a New Supabase Project
- Open the Supabase dashboard and create a new project.
- Pick the organization, project name, region, and database password.
- Wait for the project to finish provisioning.
- From Project Settings copy and store these values:
- Project URL
- anon/public key
- service role key
- database connection string or database password
Hikyaku services use the same Supabase project for auth, storage, and the Postgres database, so keep these values available before moving on.
Bootstrap the Database Schema
The schema repository in this workspace is the canonical database bootstrap source. Run the SQL files in this order against a fresh Supabase database:
schema/schema.sqlschema/roles.sqlschema/default_data.sql
That order matters:
schema.sqlcreates extensions, tables, functions, triggers, and policiesroles.sqlapplies role-level configurationdefault_data.sqlseeds required lookup data such as permissions, package statuses, and vehicle types
Running the bootstrap scripts
The simplest option is Supabase Dashboard -> SQL Editor:
- Open
schema/schema.sql, paste it into a new query, and run it. - Repeat for
schema/roles.sql. - Repeat for
schema/default_data.sql.
If you prefer local tooling, run the same files in the same order with psql or your database client of choice. Do not start with default_data.sql; it depends on tables created by schema.sql.
Configure Auth Providers
Hikyaku already uses Supabase Auth for email/password sign-in and password recovery, and it includes an OTP confirmation route that also supports magic-link style flows.
In Authentication -> Providers -> Email:
- Enable the Email provider.
- Enable Email + Password.
- Enable Magic Link if you want passwordless sign-in or email-link onboarding.
In Authentication -> URL Configuration:
- Set Site URL to your active frontend origin, for example
http://localhost:3000during local development. - Add the Hikyaku auth callback URLs you expect to use, including:
http://localhost:3000/auth/confirmhttp://localhost:3000/auth/update-password
- Add matching production URLs for your deployed frontend.
The current frontend also sends sign-up email redirects using window.location.origin, so the active frontend origin must be present in your Supabase URL configuration.
Create the Required Storage Buckets
Create these buckets in Storage:
| Bucket | Access | Purpose |
|---|---|---|
packages | Private | Package upload images and related package assets |
vehicles | Public | Vehicle images shown directly in the dashboard |
avatars | Public | Driver and team profile images |
Recommended bucket setup:
- allow image uploads for all three buckets
- keep
packagesprivate because package files are read through signed URLs - keep
vehiclesandavatarspublic because the current UI reads them via public URLs
Post-Setup Checklist
After setup, confirm that:
Once those are in place, you can move on to the frontend, scheduler, and server setup docs.