Introduction
Supabase is an open-source backend-as-a-service platform that provides developers with a suite of tools to build scalable and secure applications. It offers features like a PostgreSQL database, authentication, storage, and real-time subscriptions, making it a powerful alternative to Firebase. In this guide, we will walk you through setting up Supabase using Docker, configuring the environment, and getting started with its dashboard.
Features of Supabase
- PostgreSQL Database: A fully managed PostgreSQL database with support for extensions.
- Authentication: Built-in user management and authentication.
- Storage: File storage with an API for managing files.
- Real-time: Real-time database updates using WebSockets.
- Edge Functions: Serverless functions for custom business logic.
Prerequisites
Before you begin, ensure you have the following installed on your system:
- Docker and Docker Compose
- Git
Step-by-Step Guide
1. Clone the Supabase Repository
1
2
| # Get the code
git clone --depth 1 https://github.com/supabase/supabase
|
2. Create a New Project Directory
1
2
3
4
5
6
7
| # Make your new supabase project directory
mkdir supabase-project
# Tree should look like this
# .
# ├── supabase
# └── supabase-project
|
3. Copy Configuration Files
1
2
3
4
5
| # Copy the compose files over to your project
cp -rf supabase/docker/* supabase-project
# Copy the fake env vars
cp supabase/docker/.env.example supabase-project/.env
|
4. Navigate to Your Project Directory
1
2
| # Switch to your project directory
cd supabase-project
|
5. Pull the Latest Docker Images
1
2
| # Pull the latest images
docker compose pull
|
6. Start the Services
1
2
| # Start the services (in detached mode)
docker compose up -d
|
7. Verify Running Services
After all the services have started, you can see them running in the background:
Configuring the Dashboard
The Supabase Dashboard is protected with basic authentication. Follow these steps to configure it:
- Open the
./docker/.env
file in your project directory.
- Update the following values:
1
2
| DASHBOARD_USERNAME: The default username for the Dashboard
DASHBOARD_PASSWORD: The default password for the Dashboard
|
- To enable all dashboard features outside of localhost, update the following value:
1
| SUPABASE_PUBLIC_URL: The URL or IP used to access the dashboard
|
- Restart the services for the changes to take effect:
1
2
3
4
5
| # Stop and remove the containers
docker compose down
# Recreate and start the containers
docker compose up -d
|
Be aware that restarting services will result in downtime. Simply restarting the services does not apply configuration changes.
Conclusion
You now have a fully functional Supabase setup running on Docker. With its powerful features, you can start building and scaling your applications effortlessly. For more information, visit the official Supabase documentation.