Running Supamode
Learn how to run the Supamode project on your local machine.
To run the project - there are some commands you need to run.
- Start the development servers (web application + API)
- Start Supabase (ensure Docker is running)
1. Start the development servers
This command will run the dev
command across all applications in the monorepo:
- SPA: It will run the Vite server which serves the React Router application. It runs at port 5173.
- Hono API: In addition, it will run the Hono API, which is Supamode's backend. It runs at port 3000.
pnpm dev
Once the front-end application is running at http://localhost:5173
, open the address with your browser and you will see the sign in page. Before signin in, please start the Supabase container (see step 2 below).
To get started right away, use the credentials below:
- Email:
root@supamode.com
- Password:
testingpassword
Vite is configured to proxy all /api
requests to the Hono API server, so you can make API calls from the React application without any additional configuration.
2. Start Supabase
Before starting Supabase, make sure Docker is up and running.
Run the following command to start Supabase (or use your IDE to run the command in the package.json)
pnpm run supabase:web:start
In order to run Supamode alongside your own application, Supamode uses the following ports:
- Supabase API:
http://localhost:54331
- Supabase Postgres DB:
http://localhost:54332
- Supabase Studio:
http://localhost:54333
- InBucket:
http://localhost:54334
3. Seeding the database with test data
To get a feel for the application, you can seed the database with test data and get started right away.
From Supabase Studio's SQL Editor, run the following command to seed the database with test data:
call supamode.install_demo_schema();
Start with the demo schema
If you want to use the credentials below, you need to start with the demo schema - as the data is only seeded after running the command above.
This command will seed the database with test data that you can use just to play around with the application before you start customizing the schema with your own data.
After installing the demo schema, you can sign in using the credentials below for the root
role, an account with all permissions.
- Email:
root@supamode.com
- Password:
testingpassword
Alternatively, you can also use other roles with fewer permissions:
Admin role:
- Email:
admin@supamode.com
- Password:
testingpassword
Member role:
- Email:
member@supamode.com
- Password:
testingpassword
Read-only role:
- Email:
readonly@supamode.com
- Password:
testingpassword
Using your own data
To use your own data while running Supamode locally, you need to add the migrations from your own project. To do so, place them in the apps/app/supabase/seeds
directory - which is ideal for local development.
In addition, add a new migration to sync the data from your own Supabase project to the Supamode project:
select supamode.sync_managed_tables('public');-- Or add other schemas to the listselect supamode.sync_managed_tables('custom_schema');-- Or use specific tablesselect supamode.sync_managed_tables('public', 'users');select supamode.sync_managed_tables('public', 'posts');select supamode.sync_managed_tables('public', 'comments');-- Or use specific tables in a specific schemaselect supamode.sync_managed_tables('custom_schema', 'users');select supamode.sync_managed_tables('custom_schema', 'posts');select supamode.sync_managed_tables('custom_schema', 'comments');
Add this migration to the apps/app/supabase/seeds
as well, making sure it runs after your data's migration. You can do so by using a later timestamp than the one of your data's migration.
Using custom schemas
The demo data only grants permissions to the public
schema. If you want to use custom schemas, you need to add the permissions to the custom_schema
schema as well.
4. Running the project with your own data
Now that you have your own data in your Supabase project, you can run the project with your own data by resetting the database.
pnpm run supabase:web:reset
This command will reset the database and run the migrations from the apps/app/supabase/seeds
directory.