Free Astro tutorials for complete beginners.

Beginner's Guide to Astro

What Is Starlight? Astro's Documentation Theme, Explained

Starlight is the Astro team's free theme for documentation sites. Here's what you get, how to start one in five minutes, and how to add your first page, with screenshots.

Tested on Astro 7.4

Cover image for What Is Starlight? Astro's Documentation Theme, Explained
In this guide
  1. What you get
  2. How to start a Starlight site
  3. How to add a page
  4. How to change the colours
  5. How to put it online
  6. When to use Starlight, and when not to
  7. Where to go next
  8. Frequently asked questions

Starlight is a free theme from the Astro team for documentation sites. Help pages, guides, manuals, a handbook, anything people look things up in. You write pages in Markdown. Starlight gives them a sidebar, a search box, a table of contents, light and dark mode, and built-in support for sites in more than one language, including right-to-left ones like Arabic.

It’s one of the most-used Astro add-ons there is, at about 7 million downloads a week. And you don’t need to know much Astro to use it.

What you get

We made a Starlight site from scratch on November 8, 2026, using Starlight 0.42 on Astro 7.4.7. Here’s what it gave us with no setup.

The new Starlight site’s home page, with the heading Welcome to Starlight, a dark blue Example Guide button, a search box at the top, and Houston, Astro’s mascot, in a hard hat.

That’s the home page it starts with. Then we added one page of our own, a “Getting started” guide, and listed it in the sidebar:

A Starlight docs page called Getting started, with the sidebar on the left listing Guides and Reference, a purple Tip box and a yellow Caution box in the middle, and an On this page list on the right.

Without writing any code, that page has:

  • A sidebar on the left, with the current page highlighted.
  • A table of contents on the right, built from your headings.
  • Tip and caution boxes, from three colons and a word in your Markdown.
  • A search box at the top. Starlight builds the search index with Pagefind every time you build. On our test site it indexed all five pages in under a second.
  • Light and dark mode, with a switch in the top corner. It starts on “Auto” and follows the reader’s device.
  • A “next page” link at the bottom of each page, so readers can go through your docs in order.

How to start a Starlight site

You need Node.js and a terminal. If you don’t have those yet, do lesson 1 first.

Step 1: Make the project

npm create astro@latest -- --template starlight

The helper asks for a folder name and whether to install. Say yes. It also adds an AGENTS.md file, so AI tools understand your project.

Step 2: Start it

cd your-folder-name
npm run dev

Open the address it shows, usually localhost:4321. You’ll see the home page above.

Step 3: Find your pages

Your pages live in src/content/docs/. The starter has three:

File Becomes
src/content/docs/index.mdx The home page
src/content/docs/guides/example.md /guides/example/
src/content/docs/reference/example.md /reference/example/

Every page starts with a title and a description between two --- lines. That’s all Starlight needs.

How to add a page

Step 1: Make the file

Create src/content/docs/guides/getting-started.md:

---
title: Getting started
description: Install the app and make your first project.
---

Welcome! This page shows how to get going in three steps.

## Step 1: Install

Download the installer and run it.

:::tip
You only need to do this once.
:::

## Step 2: Make a project

Open the app and click **New project**.

:::caution
Pick a folder you can find again.
:::

The :::tip and :::caution lines make the coloured boxes. There’s also :::note and :::danger.

Step 2: Add it to the sidebar

Open astro.config.mjs. Find the sidebar list and add a line for your page:

sidebar: [
  {
    label: 'Guides',
    items: [
      { label: 'Getting started', slug: 'guides/getting-started' },
      { label: 'Example Guide', slug: 'guides/example' },
    ],
  },
],

The slug is the file’s path inside src/content/docs, without .md.

Save. Your page appears in the sidebar, with its table of contents on the right.

How to change the colours

Make src/styles/custom.css:

:root {
  --sl-color-accent-low: #e5edff;
  --sl-color-accent: #284282;
  --sl-color-accent-high: #17274d;
}

Then tell Starlight about it, inside starlight({ ... }) in astro.config.mjs:

customCss: ['./src/styles/custom.css'],

That’s how the button in our screenshot became navy. Starlight’s docs list every colour you can change.

How to put it online

Run npm run build. Starlight builds your pages and the search index into dist/. Then publish that folder like any Astro site. Free options are in lesson 7, or our Cloudflare and GitHub Pages guides.

When to use Starlight, and when not to

Use Starlight for Use something else for
Product docs and help centres A blog, try AstroPaper
Open-source project docs A business homepage, try AstroWind
Course notes, handbooks, wikis A shop or portfolio
Anything with a sidebar of pages A single landing page

Where to go next

Frequently asked questions

Is Starlight only for Astro's own docs?

No. It's for any documentation, about anything. Products, open-source projects, company handbooks, courses. Cloudflare, Biome and many others use it.

Do I need to know Astro to use Starlight?

Very little. You write pages in Markdown and list them in one config file. You can learn the rest of Astro later, if you ever need it.

Is it free?

Yes. It's open source under the MIT license, made by the Astro team. Host it free on Cloudflare, Netlify or GitHub Pages.

Can I use Starlight for a blog?

It's built for docs, so a blog isn't its strength. There's a community plugin for adding a blog to a Starlight site. If the blog is the main thing, use a blog theme instead.

Stuck on a step?

Check the common errors guide, look up a word in the glossary, or ask the friendly people in the official Astro and EmDash Discords. How to ask so people can help.

Keep reading

  1. 11 Best Free Astro Themes in 2026 (Checked for Astro 7)

    The best free themes from astro.build for blogs, portfolios, business sites and docs. We checked which ones already run on Astro 7, and which are behind.

    Themes, 9 minute read, November 8, 2026

  2. How to Install an Astro Theme

    Astro themes aren't installed like WordPress themes. Here's how to start a project from a theme and make it your own.

    Themes, 5 minute read, October 30, 2026

  3. How to Register a Domain Name and Connect It to Your Astro Site

    Buy a domain for about $11 a year, then point it at Cloudflare or Netlify. We did this for astrobeginner.com, and these are the exact steps.

    Tutorials, 8 minute read, November 8, 2026

Try "blog", "deploy" or "EmDash".