This is an opinionated Astro 5 starter with Svelte 5, Tailwind CSS v4, SCSS, and a complete baseline for SEO + PWA + linting.
This README is hybrid:
Create a new project from this template:
pnpm create astro@latest -- --template Rofisyahrul/astro-template
Then:
pnpm install
pnpm dev
>=18 (see package.json). This repo also ships an .nvmrc for a recommended Node LTS.http://localhost:4321 (unless PORT is set).@astrojs/node by default@astrojs/vercel/serverless when DEPLOYMENT_PLATFORM=vercel$state, $props) with Astro islands (client:*)src/lib/_document.astro)manifest.json and browserconfig.xml routes (prerendered)og.png route (generated with @vercel/og)astrojs-service-worker)All commands are run from the project root:
| Command | Action |
|---|---|
pnpm dev |
Start dev server (also runs astro sync) |
pnpm dev:no-toolbar |
Dev server without Astro Dev Toolbar |
pnpm sync-and-check |
astro sync && astro check |
pnpm build |
Production build (runs sync-and-check first) |
pnpm build:sw |
Build with service worker enabled |
pnpm build:vercel |
Build with Vercel adapter enabled |
pnpm preview |
Preview build |
pnpm lint |
Run all lint tasks |
pnpm lint:code |
ESLint |
pnpm lint:style |
Stylelint |
This starter is designed around a “route delegates to a colocated page module” pattern:
src/
pages/
index.astro # route entry (thin)
og.png.ts # OG image endpoint
manifest.json.ts # PWA manifest endpoint
browserconfig.xml.ts # Windows tile config endpoint
lib/
pages/
home/
home.astro # actual page UI
_script.server.ts # route-level server logic
components/ # page-local components (Svelte/Astro)
components/ # shared UI components
styles/ # global SCSS + tailwind entry
_document.astro # shared document wrapper (SEO + PWA tags)
_script.client.ts # global client-side behavior (transitions/progress)
middleware/
index.ts # middleware chain
The default src/pages/index.astro calls the page module’s server script and then renders the page module component.
You do not need to import global CSS/JS per-page. The template uses a custom integration that injects:
$lib/styles/index.scss$lib/styles/tailwind.css$lib/_script.client.tsThis template auto-defines public env vars used across SEO/PWA, with defaults derived from package.json and the default app icon:
APP_NAME, APP_NAME_SHORT, APP_DESC, APP_VERSIONOG_LOGO_BASE_64_SRCTo customize: update package.json (name, description, version) and/or override via environment (if you choose to add overrides).
GET /manifest.json (prerendered)GET /browserconfig.xml (prerendered)GET /og.png (generated at request time, accepts query params t and d)Service worker is enabled when:
SW_ENABLED=true, orDEPLOYMENT_PLATFORM=vercel (enabled by default for Vercel builds)Use pnpm build:sw to enable it locally for builds. Previewing SW builds is typically done with pnpm preview:sw (binds to port 9999 and host).
Middleware sets Astro.locals.isMobile (based on the request user-agent). The document wrapper uses this to apply mobile/desktop body classes.
For detailed “how to work in a downstream project built from this template” instructions (AI agents + humans), see AGENTS.md.