Getting Started with StudioCMS
Let’s get started
To start using StudioCMS, you’ll need:
- An Astro project
- A libSQL provider or self-hosted libSQL server
- The StudioCMS integration
Understanding Options for @astrojs/db
Using libSQL
With the latest version of @astrojs/db
(v0.14.0
), you can now link to any libSQL server from any platform that exposes the libSQL remote protocol of the server, or can be self-hosted.
To use libSQL with Astro Db, you will need to set the following environment variables:
ASTRO_DB_REMOTE_URL
- The connection URL to your libSQL serverASTRO_DB_APP_TOKEN
- The app token for your libSQL server
The commands for deploying and pushing changes to your database are the same when using libSQL as when connecting to an Astro Studio hosted database. However, both of your environment variables need to be set locally when running commands with the --remote
option like astro build
and astro db push
.
Using Astro Studio
Astro Studio Account RequiredCreating a new Astro project
To create a new Astro project, simply run the following command in your terminal:
After running the command, you’ll be prompted to answer a few questions about your project. Once completed, the CLI will create a new Astro project in the specified directory.
If all goes well, you should see a “Liftoff confirmed. Explore your project!” message followed by some recommended next steps.
cd
into your new project directory to begin using Astro. cd my-project
If you skipped the npm install step during the CLI wizard, then be sure to install your dependencies before continuing.
Adding the StudioCMS integration
To add the StudioCMS integration to your project, you’ll need to install the Astro StudioCMS package and it’s dependencies:
After installing the package, make sure that your astro.config.mjs
file is correctly importing and calling the integration:
Configure your package.json
scripts
Setup your package.json
scripts to include the --remote
flag for build, and optionally for dev. (You can also run the dev command as shown in the “Running your StudioCMS Project” section)
Running your StudioCMS project
Thanks to the power of Astro running StudioCMS is as easy as running the dev command for local preview, or building and deploying to your server, for the basics of how to use it locally without building here is what you need to do.
First time Setup (or during updates if the tables schema is updated)
To start your Astro project, run the following commands in your terminal:
After running the commands, you should see a message indicating that your project is running at localhost:4321
. When first setting up StudioCMS, you will prompted to finish configuring StudioCMS at http://localhost:4321/start
Running in Astro Development mode locally
To start your Astro project, run the following command in your terminal:
After running the command, you should see a message indicating that your project is running at localhost:4321
. Open your browser and navigate to http://localhost:4321
to see your Astro project in action.
Congratulations! 🥳 You now have StudioCMS installed in your Astro project.
Next steps
Now that you have StudioCMS installed, you can start building your project with StudioCMS.
Check out how to set environment variables in StudioCMS by heading to Environment Variables.
To learn more about the API and how to use StudioCMS, check out the StudioCMS Reference.
You can also learn more about themes and how to author them by using Astro Theme Provider.