Skip to content

Instantly share code, notes, and snippets.

@omundy
Last active October 16, 2025 14:21
Show Gist options
  • Save omundy/70f9eac08ec5d87caf3ee91998883885 to your computer and use it in GitHub Desktop.
Save omundy/70f9eac08ec5d87caf3ee91998883885 to your computer and use it in GitHub Desktop.
Astro Starlight Basics

Starlight Basics

Create new starlight project in a folder called "starlight"

npm create astro@latest -- --template starlight
  1. Starlight looks for .md or .mdx files in the src/content/docs/ directory. Each file is exposed as a route based on its file name.
  2. Images can be added to src/assets/ and embedded in Markdown with a relative link.
  3. Static assets, like favicons, can be placed in the public/ directory.

πŸš€ Project Structure

Inside of your Astro + Starlight project, you'll see the following folders and files:

.
β”œβ”€β”€ public/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ content/
β”‚   β”‚   └── docs/
β”‚   └── content.config.ts
β”œβ”€β”€ astro.config.mjs
β”œβ”€β”€ package.json
└── tsconfig.json

🧞 Commands

All commands are run from the root of the project, from a terminal:

Command Action
npm install Installs dependencies
npm run dev Starts local dev server at localhost:4321
npm run build Build your production site to ./dist/
npm run preview Preview your build locally, before deploying
npm run astro ... Run CLI commands like astro add, astro check
npm run astro -- --help Get help using the Astro CLI

πŸ‘€ Want to learn more?

Check out Starlight’s docs, read the Astro documentation, or jump into the Astro Discord server.

Github Pages

  1. Create a new file in your project at .github/workflows/deploy.yml and paste in the YAML from: https://docs.astro.build/en/guides/deploy/github/
  2. In Settings > Pages set Source to Github Actions
  3. Push to the server!

More Articles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment