From git clone to production. Everything here is editable in Sanity.
Quick start
Clone Astrokit with its Git history, install, and run. You do not need a Sanity account, an API key or a free afternoon.
Terminal
git clone https://github.com/szsoma/astrokit.git my-site
cd my-site
git remote rename origin astrokit
corepack enable
pnpm install --frozen-lockfile
pnpm dev
Open http://localhost:4321 for the demo home page and /styleguide for every block with every fixture.
Why keep the history and rename the remote? It is how you merge future Astrokit updates. GitHub's template button throws that history away, so skip it.
Project settings
Run the init wizard to set your site name, canonical URL, integrations, consent and form provider. Current values are the defaults, so press Enter to keep them.
Terminal
pnpm astrokit init
Nothing is written until you confirm.
It edits astrokit.config.ts and creates .env.local with empty placeholders.
It never asks for passwords or API keys. Paste secrets into .env.local yourself.
Check your setup any time with pnpm astrokit doctor (or --offline to skip network checks).
Connect Sanity
Run init again and choose an existing Sanity project or let the CLI create one. Then start the Studio.
Terminal
pnpm studio
Open http://localhost:3333 and sign in.
Publish Site settings and a page with the slug home.
In sanity.io/manage, add your local and production URLs to the CORS origins.
Create a Viewer token and store it as SANITY_API_READ_TOKEN for draft preview.
To go back to demo content, set ASTROKIT_DATA=fixtures.
Pages and sections
A page is a title, a slug, SEO fields and an ordered list of sections. The page with the slug home is served at /. A slug like product/documentation becomes a nested URL.
Sections are blocks that editors can add from the page builder: hero, auto tabs, carousel, FAQ, documentation and more. Reorder them freely.
Navigation and footer
Links live in Site settings. They point at pages or external URLs and update with the next publish.
Write documentation
This very page is a Documentation section. Each article has a title, an optional anchor, an optional sidebar group and rich text.
Add an article, give it a group, write the body.
Use the Code block item for terminal snippets.
Articles with the same group stay together in the sidebar.
Need a new docs page? Create a page, add a Documentation section and you are done.
Add your own block
Blocks are folders in src/blocks. The generator creates all five files and regenerates the Sanity types.
Terminal
pnpm astrokit new block feature-card --section # editors can add it to pages
pnpm astrokit new block price-tag --nested # building block inside sections
block.ts names and describes the block.
FeatureCard.astro is the component. Take data props, not slots.
fixtures.ts keeps /styleguide working with no CMS.
schema.ts and query.ts define the Studio fields and the GROQ projection.
Run pnpm check afterwards. If the query and the component props drift apart, the type checker says so.
Forms
Create a form under Forms in the Studio: fields, button label, success message and destination. Then add a Form section to a page.
Email through Resend: RESEND_API_KEY, FORMS_TO_EMAIL, FORMS_FROM_EMAIL.
HubSpot: HUBSPOT_PORTAL_ID plus the form GUID in the Studio.
Webhook: FORMS_WEBHOOK_URL or a URL on the form.
Turn on Cloudflare Turnstile for production, otherwise each submission can send an email and nothing rate-limits it.
SEO and redirects
Titles, canonical URLs, Open Graph and Twitter tags come built in. The sitemap and JSON-LD (Organization, WebSite, breadcrumbs) switch off with seo: { enabled: false }.
Set a logo, default social image and profiles in Site settings.
Manage redirects under Redirects: old path, new path or URL, permanent or temporary.
Redirects go live with the next deploy, and publishing triggers the deploy hook.
Motion
Animations are off until you enable them in astrokit.config.ts.
Add data-motion="fade-up" to an element or data-motion="stagger" to a parent. Visitors who prefer reduced motion get none of it.
Project scripts can import motion from virtual:astrokit/motion for GSAP and ScrollTrigger.
Theme and fonts
Brand colours and radii go in src/styles/astrokit-theme.css, never in base.css. Fonts are registered in astro.config.mjs.
Every block takes its values from tokens, so one edit rebrands the whole site.
Analytics and consent
Paste public IDs into astrokit.config.ts to enable GTM, GA4, Clarity, Meta Pixel, LinkedIn Insight and Sentry. Empty IDs load nothing.
The built-in cookie banner covers necessary, functional, analytics and marketing categories and sets Google Consent Mode v2 defaults. Cookiebot is supported as an alternative.
Publish a real privacy page at the path set in consent.policyUrl.
Deploy to Vercel
Use one repository and two Vercel projects.
Production: ASTROKIT_DATA=sanity and ASTROKIT_MODE=production. Add your form variables.
Add a Deploy Hook and a Sanity webhook for page, siteSettings, redirect and form changes, with drafts off.
Preview: ASTROKIT_MODE=preview plus the read token, protected for all deployments.
Open /studio on the preview project and use Presentation to edit drafts side by side with the page.
Updating Astrokit
Commit your own changes first, then merge the starter's latest work.
Terminal
git fetch astrokit
git merge astrokit/main
Resolve conflicts while keeping your content, config and uploads.
Commands
Terminal
pnpm dev # dev server
pnpm build # production build
pnpm check # types + formatting
pnpm test # unit tests
pnpm test:e2e # browser tests
pnpm studio # Sanity Studio
pnpm typegen # regenerate Sanity types
pnpm astrokit doctor