Fastabase is a solution to self-host Supabase on AWS and use PlanetScale Postgres as the database provider.
Fastabase is built using several components:
- SST to orchestrate the deployment to AWS
- OpenNext to deploy Supabase Studio as a serverless component
- Supabase components like Storage, Auth, etc.
- Most of the Supabase components are deployed as Docker containers to ECS Fargate
- Entrypoint for Supabase API is an Application Load Balancer behind a CloudFront distribution
- Amazon SES SMTP servers are used for sending emails
- Supabase Studio is deployed using OpenNext
- Studio is protected by user/password auth via a CloudFront function
- Install Node.js 22 and pnpm
- PlanetScale:
- Go to Cluster configuration -> Extensions and enable
pg_stat_statements
andpg_cron
extensions. - Go to Cluster configuration -> Parameters and set
max_client_conn
to at least50
.
- Go to Cluster configuration -> Extensions and enable
-
Clone this repository and
cd
into it. -
Init Git submodules:
git submodule update --init
-
Create a
config.yaml
configuration file:cp config.yaml.example config.yaml
-
Fill in the values in
config.yaml
. -
Install the dependencies:
pnpm i
-
Set up the AWS credentials:
export AWS_PROFILE=<profile>
[!TIP] To learn how to set up the AWS credentials in your terminal, please refer to the AWS documentation.
-
Run the deployment:
pnpm run deploy
[!WARNING] SST deploys resources to a certain stage. This allows you to deploy multiple copies of your app in the same account.
By default, the stage name is set to the username on your local machine. You can specify a different stage name with
pnpm run deploy --stage <name>
.
To remove a deployed Fastabase instance, run:
pnpm run remove
Note
If you used a non-default stage name during deployment, you also need to provide it here with pnpm run remove --stage <name>
.
- Auth
- Storage
- PostgREST
- Imgproxy
- Pg-meta
- Logs
- Realtime
- Edge functions
- OpenAI API key
- External auth providers
- Custom domain
- Show real DB credentials in the Studio's "Connect" dialog (currently hardcoded to
localhost
in Supabase's codebase)
-
By default, Amazon SES is in sandbox mode, which means you can only send emails from and to verified email addresses. Make sure to exit the sandbox mode before sending emails to real users.
-
Logs and Realtime components currently do not support connecting to Postgres with SSL, so they are connecting to PlanetScale via Envoy that serves as an SSL proxy. Envoy is deployed as an ECS service. Once the SSL support is implemented in Logs and Realtime components, the Envoy service will be removed.