Requirements
- Node.js 22.12 or newer (required by Astro 7)
- npm (or pnpm/yarn/bun — the theme has no package-manager-specific behavior)
Setup
Clone the repository and install dependencies:
git clone https://github.com/your-username/astro-dev-theme my-sitecd my-sitenpm installStart the dev server:
npm run devThe site is now running at http://localhost:4321 with hot reload.
Available scripts
| Script | What it does |
|---|---|
npm run dev |
Start the development server |
npm run build |
Build the production site into dist/ |
npm run preview |
Preview the production build locally |
npm run check |
Type-check the project with astro check |
npm run lint |
Lint with ESLint |
npm run format |
Format with Prettier |
A note on search in development
Search is powered by Pagefind, which indexes the built site. In dev mode the index from your last npm run build is served, so run a build once before testing search locally:
npm run build && npm run devDeploying
The build output in dist/ is fully static — deploy it to any static host:
npm run buildNetlify, Vercel, and Cloudflare Pages work with zero configuration beyond setting the build command to npm run build and the output directory to dist. No server or environment variables are required.
GitHub Pages
The theme ships with a ready workflow at .github/workflows/deploy.yml. To use it:
- In your repository, go to Settings → Pages and set Source to GitHub Actions.
- Push to
main.
The workflow deploys to https://<username>.github.io/<repo-name>/ automatically — it detects the repository name and passes it as the base path, so every link, image, and the search index work under the subpath with no configuration. User/organization sites (a repo named <username>.github.io) and custom domains are also handled; see the comments in the workflow file.