Most developers after deploying their database take their credentials over to a separate tool such as Outerbase, TablePlus, DBeaver, or another tool so they can begin visualizing the structure of their database schema.
Included as part of each StarbaseDB deployment we build in an HTTP accessible user interface for you and your team to collaboratively use to interact with your database. Together we will take a look at how we can enable & disable the user interface, update the login credentials, and discover what functionality is available via Outerbase Studio.
What’s Included
Having the ability to run queries or browse your table data is a superpower when it comes to understanding what’s inside your database.
To access your hosted user interface just append /studio
onto the URL of your database, such as https://starbasedb.YOUR-IDENTIFIER.workers.dev/studio.
When you first land on the page you will be presented with a username and password authentication prompt. Your credentials are included in your wrangler.toml
file as STUDIO_USER
and STUDIO_PASS
values.
If you do not have access to your /studio URL, you may need to verify that the STUDIO_USER
and STUDIO_PASS
variables are uncommented in your wrangler.toml file and then re-deploy your code.
After a successful login you will have an entire database interface to see a list of all your tables, create new tables and more. There are a lot of features built-in to the tool for you to explore, but below is a list of a couple noteworthy features that should help you get started:
-
View data in your tables
-
Execute raw SQL queries
-
Filter data down within a table
-
Update values in your data cells
-
Modify the schema of your database
Enable & Disable Studio
By default, if you used the hosted shell command to deploy your database instance then Outerbase Studio should be available to you. You can find your username and password credentials in the wrangler.toml
file that was cloned onto your machine when you executed the deploy command.
If you went through the manual deploy process yourself, by default the STUDIO_USER
and STUDIO_PASS
variables are commented out which disables the hosted user interface experience.
Enable Access
To enable access to the user interface, open up your wrangler.toml
file and locate near the bottom the STUDIO_USER
and STUDIO_PASS
variables. First, verify both lines are not commented out which you can confirm by ensuring the line does not start with a #
symbol.
You may change the user and pass values to be whatever strings you would like but it’s important to ensure that the combination is secure and nobody else will be able to access it.
Once you have made the desired changes you can re-deploy your StarbaseDB application code by running the following command:
npm run deploy
It’s worth noting here that none of your SQL data will be removed or altered during this process, only the application layer logic on your Cloudflare Worker will be updated.
Disable Access
When you no longer want the database user interface to be accessible via the internet you can easily turn it off. To do so open up your wrangler.toml
file on your machine from the cloned project and locate the STUDIO_USER
and STUDIO_PASS
variable definitions.
When those two values are commented out, the interface will no longer be accessible. Go ahead and prefix each line with a #
character to indicate those lines are commented out.
# STUDIO_USER = "admin"
# STUDIO_PASS = "123456"
Now with those changes in place we need to re-deploy our application code by running the following command:
npm run deploy
It’s worth noting here that none of your SQL data will be removed or altered during this process, only the application layer logic on your Cloudflare Worker will be updated.
Change Credentials
Changing your login credentials for your Outerbase Studio user interface is similar to the above steps. First you want to locate your wrangler.toml
file located at the root level of the starbasedb project that was cloned to your local machine.
Within that file, locate the STUDIO_USER
and STUDIO_PASS
variables. You may adjust their string values to be any combination you prefer, but it’s important to ensure that your credentials are safe and secure and cannot be compromised as leaking this information will give access to intruders if they are aware of your hosted database URL.
Now with those changes in place we need to re-deploy our application code by running the following command:
npm run deploy
It’s worth noting here that none of your SQL data will be removed or altered during this process, only the application layer logic on your Cloudflare Worker will be updated.