npm create vite
and install the dependencies.
- Add server config to
vite.config.js
:
export default defineConfig({
plugins: [react()],
server: {
hrm: {},
port: 1337
}
});
- Remove
"type": "module"
from package.json
.
- Run
npm i -D supabase
to add superbase (run npx supabase --help
to confirm installation).
- Run
npx supabase init
to initialize supabase.
- Run
npx supabase start
to run the supabase instance(make sure Docker daemon is running).
- Create a
.env
file in the root directory and add the following:
VITE_SUPABASE_ANON_KEY=xxx
VITE_SUPABASE_URL=xxx
- Go to Supabase Projects and create a new project.
- Create
.env.production
and add the following based on the project created in step 8:
VITE_SUPABASE_ANON_KEY=xxx
VITE_SUPABASE_URL=xxx
- Go to Local Supabase Dashboard and go to Authentication tab and turn off Confirm Email locally.
- Open up
supabase/config.toml
and change double_confirm_changes
and enable_confirmations
to false
. (Leave those on for prod environment.)
- Create a migration file using
npx supabase migration new original-ddl
.
E2E Testing(Optional) Using Playwright
- Run
npm create playwright
to add playwright.
- In
playwright.config.js
, uncomment the following(also turn on Chrome and Mobile Chrome):
webServer: {
command: 'npm run dev',
port: 1337,
reuseExistingServer: true
},
- Install
detect-port
using npm i -D detect-port
, then create e2e/utils.js
with the same content.
- Create
supabase/clear-db-data.sql
with the same content.
- Install auth with
npm i @supabase/auth-ui-react
.
- Install API connector
npm i @supabase/supabase-js
.
- Write Postgres schemas in
supabase/migrations/xxx_original_ddl.sql
.