Pivot, step by step
Everything you need to set up, customise and ship the Pivot Astro Tailwind CSS SaaS template.
Introduction
Pivot is an Astro SaaS template and Astro landing page template built with Astro 7 and Tailwind CSS 4. It reuses the palette, Spartan font and spacing of the original Tailwind HTML template it was ported from, with a dark and a light theme. There is no React or other UI framework: every component is native Astro, and the few pieces that need interactivity are small vanilla TypeScript modules.
What is included
- Tailwind CSS 4, compiled at build time (no CDN script in the browser)
- Design tokens in one place:
--dark-*custom properties insrc/styles/tokens.css - Dark by default, with a light mode the visitor can switch to; their choice is remembered
- Landing page with 12 sections, plus an Astro blog template, changelog, docs and a 404 page — the blog, changelog and docs are MDX content collections with a typed schema
- Waitlist and demo forms validated live with Zod and posted to a PHP endpoint, plus a login/signup/forgot-password auth modal (backend not included)
- SEO: unique title, description and keywords per page, canonical URLs, Open Graph, JSON-LD schema, sitemap via
@astrojs/sitemap - Astro static build: every page pre-rendered to plain HTML, CSS and JavaScript in
dist/
Getting started
Install the tools, run one command and the template builds, opens in your browser and rebuilds whenever you save a file.
Requirements
| Tool | Version | Needed for |
|---|---|---|
| Node.js | checked on Node 24 | Building and running the template |
| npm | bundled with Node.js | Installing packages |
| PHP | with mail() configured | Only the waitlist and demo forms (public/api/*.php) |
Install and run
cd pivot-astro
npm install
npm run devcd pivot-astro
yarn
yarn devcd pivot-astro
pnpm install
pnpm devnpm run dev starts the Astro dev server at http://localhost:4321 with live reload; every change you save in src/ shows up in the browser.
Commands
| Command | What it does |
|---|---|
npm run dev | Start the dev server with live reload |
npm run build | Type-check with astro check, then build the static site into dist/ |
npm run preview | Serve the finished dist/ folder locally |
npm run format | Format the project with Prettier (Astro + Tailwind class-sorting plugins) |
npm run format:check | Check formatting without writing, for CI |
src/ and public/ only. Everything in dist/ is generated and is replaced on every build.Folder structure
Everything you edit lives in src/; the build writes the finished site to dist/. Here is where each piece sits.
pivot-astro/
├── src/
│ ├── pages/ ← index, blog, changelog, docs, 404 (.astro), file name becomes the URL
│ ├── components/
│ │ ├── ui/ ← Button, Badge, TextField, SelectField, Modal, Switch, Tabs …
│ │ ├── magicui/ ← bento-grid/, animated-beam/, marquee/, number-ticker/
│ │ ├── common/ ← PageHero, BlogCard, ChangelogCard, DocsSidebar, DocsPager …
│ │ ├── layout/ ← Navbar, NavLinks, ThemeToggle, MobileDrawer, Footer
│ │ └── sections/ ← one home-page section per file (HeroSection, StatsSection, …)
│ ├── features/ ← hero-preview/, features-bento/, integrations/, pricing/,
│ │ waitlist-form/, lead-capture/, auth/
│ ├── content/ ← MDX collections: blog/, changelog/, docs/
│ ├── data/ schemas/ types/ lib/ scripts/ styles/
├── public/
│ ├── api/ ← waitlist.php, demo.php, _lib.php — plain PHP, copied to dist/api
│ ├── favicon.svg
│ └── og-image.png
├── dist/ ← generated, upload this
├── static-files/ ← documentation and preview pages (this file)
├── astro.config.mjs, tsconfig.json
└── package.jsonContent (MDX + data)
Blog posts, changelog entries and docs pages are MDX files in src/content/blog/, changelog/ and docs/, typed by a zod schema in src/content.config.ts. Navigation and footer links are typed data in src/data/navigation.ts, read by the Astro components.
Components
Shared UI lives in src/components/ in four folders: ui/ for reusable form fields with no copy of their own, magicui/ for bento-grid, animated-beam, marquee and number-ticker, common/ for Astro pieces shared across pages, and layout/ for the navbar, drawer, theme toggle and footer. Change a component once and every page updates.
| Component | Used for |
|---|---|
layout/Navbar.astro, MobileDrawer.astro | Fixed navigation with dropdown groups, and the mobile slide-in menu |
layout/ThemeToggle.astro | Dark / light switch, persisted to localStorage |
common/PageHero.astro | The hero block at the top of every non-home page |
common/BlogCard.astro, ChangelogCard.astro | Blog and changelog listing cards |
magicui/bento-grid/, animated-beam/ | Features bento layout and the integrations animated beam |
magicui/marquee/, number-ticker/ | Logo marquee and the animated stats row |
features/waitlist-form/, lead-capture/ | The waitlist and demo request forms, native Astro, no client framework |
features/auth/ | Login, signup and forgot-password forms behind the auth modal |
Pages and components
Every page shares the same shell. Copy an existing page in src/pages/ to start a new one; the file name becomes the route (my-page.astro builds dist/my-page/index.html).
| Page | File | What it is |
|---|---|---|
| Home | index.astro | The 12-section landing page |
| Blog | blog/index.astro, blog/[...slug].astro | Listing and post pages from the blog MDX collection (6 posts) |
| Changelog | changelog/index.astro | Timeline from the changelog MDX collection (4 entries) |
| Docs | docs/index.astro, docs/[...slug].astro | Sidebar docs from the docs MDX collection (5 pages) |
| 404 | 404.astro | Not-found page |
Adding a page to the menu
Add an entry to src/data/navigation.ts (NAV for the header, FOOTER_COLUMNS for the footer); layout/Navbar.astro and MobileDrawer.astro both read from the same array.
Design tokens
All colors are CSS variables in src/styles/tokens.css. :root holds the dark values and :root[data-theme='light'] redefines the same variables for the light theme.
Colours
--dark-primaryButtons, links--dark-page-bgPage background--dark-surfaceCards and panels--dark-textBody text--dark-errorForm validation--dark-successSuccess messagesTypography
| Use | Font | Weights |
|---|---|---|
| Headings and body text | Spartan (self-hosted with Fontsource) | 400 / 500 / 700 / 900 |
Body text is 0.875rem / 1.6, and every font size uses rem, never px. One h1 scale (3.75rem, 2.75rem below 992px, 2.25rem below 576px, bold, line-height 1.25); h2 2rem, h3 1.75rem, h4 1.5rem, h5 1.25rem, h6 1.125rem. Do not set per-page h1 sizes.
Spacing
Sections have 120px vertical padding (80px below 768px). Cards use 30px padding and a 10px radius. Buttons are 50px pills. Badges are 0.75rem text with 4px 16px padding.
Change the brand colour
/* src/styles/tokens.css */
:root {
--dark-primary: #f15822; /* change this */
--dark-primary-hover: color-mix(in srgb, var(--dark-primary), #000 10%);
}text-primary, bg-surface, text-muted.Dark mode
Dark mode is attribute based, and dark is the default. A tiny inline script in <head> (layout/ThemeToggle.astro's companion script) sets data-theme="light" on <html> before the page paints, so there is no flash, if the visitor has chosen light before. The toggle saves the choice in localStorage under the key theme.
You never write dark: variants: the colour variables change instead, and light mode is the override.
:root { color-scheme: dark; --dark-page-bg: #06111d; }
:root[data-theme='light'] { color-scheme: light; --dark-page-bg: #f4f6fa; }Tailwind CSS
Tailwind 4 is compiled during the build through the @tailwindcss/vite plugin, so no Tailwind script runs in the browser. There is no tailwind.config file: the @theme inline block in tokens.css maps the CSS variables to Tailwind names (color-primary, color-surface, font-sans…).
Tailwind scans src/ for class names automatically.
src/scripts/*.ts file, write it as a complete string (for example classList.add('border-error')) so Tailwind can see it. Do not build class names by joining pieces.Components
Every component is a plain .astro file with no client framework. The small amount of interactivity the template needs lives in src/scripts, one module per behavior, each exporting an initX() function.
Interactivity modules
Each page loads these through one <script> tag in Navbar.astro; nothing else ships any JS.
| Module | Behavior |
|---|---|
form.ts | Live field validation, submit handling, status messages |
auth-modal.ts | Opens and closes the native <dialog>, switches login/signup/forgot views |
tabs.ts | Switches tab panels (hero preview, lead capture, auth modal) |
drawer.ts, theme.ts, nav-spy.ts | Mobile menu, theme toggle, active nav link on scroll |
Authentication
Open the modal from any element with data-auth-open="login" or "signup", or call openAuth(). The modal is a native <dialog>; the three forms validate live with Zod. No backend is wired up: connect Auth.js, Clerk, Supabase or your own API in src/features/auth. Passwords are never logged.
Forms (PHP)
The waitlist and demo forms post JSON to public/api/waitlist.php and demo.php. Both validate the same shape as the client with PHP's own checks, apply a same-origin check, treat a filled honeypot field as a silent success, and email the lead with PHP's mail() function.
On the client, each form is bound with bindApiForm() (src/scripts/form.ts), which validates every field live against the same Zod schema used elsewhere in the app (src/schemas) as the visitor types or blurs a field, not only on submit.
Set the recipient
// public/api/waitlist.php
const WAITLIST_TO = 'hello@lettstartdesign.com';
// public/api/demo.php
const DEMO_TO = 'hello@lettstartdesign.com';mail() setup. Most shared PHP hosts have one out of the box; it does not work with npm run dev on a host with no PHP.SEO
Each page sets its own title, description and canonical URL; site-wide defaults (name, tagline, description, social handle) come from src/lib/site.ts.
| Source | Controls |
|---|---|
src/lib/site.ts | Site name, tagline, description, Twitter handle, contact email/phone/address |
| Each page's frontmatter | Page title, meta description, canonical path |
astro.config.mjs (site, base) | Canonical domain and the /themes/.../app/ base path used across the build |
@astrojs/sitemap | Generates sitemap-index.xml at build time |
public/robots.txt | Crawl rules and the sitemap URL |
Change the site address
Set site and base in astro.config.mjs, update public/robots.txt's sitemap URL to match, and search src/ for the old domain.
Build and deployment
Astro builds src/ into dist/ as a fully static (SSG) site — every route becomes a directory with its own index.html (for example dist/about/index.html), ready for any Apache or static host.
| Step | What happens |
|---|---|
| check | astro check type-checks the project before building |
| pages | Components are rendered into complete static HTML pages |
| css | Tailwind and the files imported by global.css are compiled into one hashed stylesheet per entry |
| js | The small vanilla TypeScript modules in src/scripts are bundled; there is no client framework and no hydration |
| public | api/*.php, favicon.svg and og-image.png are copied as they are |
Deploy
Upload the contents of dist/ to your host. It is plain static HTML, CSS and JavaScript plus api/*.php, so it works in the web root or in a sub folder that matches the base you configured. For the waitlist and demo forms the host must run PHP.
astro.config.mjs sets output: "static", so every route is written to disk at build time.Dependencies
Every library the pages use comes from package.json and is imported in the source. Astro bundles it into dist/_astro/ when you build. Nothing is loaded from a CDN.
Libraries used by the pages
| Package | Version | Used for |
|---|---|---|
astro | ^7.4.11 | Static site generator and bundler (Vite) |
@astrojs/mdx | ^8.1.5 | MDX for blog, changelog and docs content |
@astrojs/sitemap | ^3.7.4 | Sitemap generation |
tailwindcss, @tailwindcss/vite | ^4.3.5 | Utility CSS, compiled at build time |
zod | ^4.6.7 | Shared validation schema for every form |
motion | ^14.12.0 | Animated Beam, Number Ticker |
@fontsource/spartan, boxicons | ^4.5.8 / ^2.1.4 | Self-hosted font, icon set |
Build tools
Listed under devDependencies: @astrojs/check and typescript (type checking), prettier with prettier-plugin-astro and prettier-plugin-tailwindcss (formatting). They run on your computer only.
Add or update a library
npm install some-library # add it
npm update # update everythingCustomisation
Make the template yours: colors, fonts, menu, and new landing sections.
Change the brand color
Edit --dark-primary in src/styles/tokens.css. Every component follows it.
Change the menu
Add a link to NAV in src/data/navigation.ts. The navbar, mobile drawer and active state use it.
Add a landing section
Create a component in src/components/sections and add it to src/pages/index.astro.
AI assistants
The project root contains CLAUDE.md and AGENTS.md: a short guide that coding assistants read before they touch your code, so they use the right commands and edit the right files.
AGENTS.md is the single source of truth for structure, commands and conventions; CLAUDE.md only adds Claude Code specific notes and imports AGENTS.md.What is inside
| Section | Tells the assistant |
|---|---|
| Stack | Astro, Tailwind versions, and that there is no React or client framework |
| Commands | The exact install, dev, build and format commands, so it does not guess |
| Project structure | Where pages, components, features, data, schemas and styles live |
| Interactivity and forms | The vanilla TypeScript modules, and how waitlist/demo forms talk to PHP |
| Do NOT | Editing dist/ or node_modules/ |
Troubleshooting
Quick answers to the problems people run into most often when setting up the template.
The page looks unstyled after I build
Open the built site through a server (npm run dev or npm run preview), not by double-clicking a file, and make sure npm install finished without errors. Tailwind is compiled during the build, so a failed build leaves no stylesheet.
Why didn't my waitlist or demo email arrive?
The host's PHP mail() function is not configured, or the recipient address in public/api/waitlist.php / demo.php is still the placeholder. Check your host's mail logs. It will not work with npm run dev alone.
My edits do not show up
Edit files in src/ and public/, never in dist/, which is rebuilt every time. With npm run dev the page reloads on save; if it does not, do a hard refresh.
How do I change the brand colour?
Change --dark-primary (and its light-mode override) at the top of src/styles/tokens.css. Buttons, links and focus rings all follow it.
Dark mode does not remember my choice
The choice is saved in localStorage. If the browser blocks storage (private mode, blocked cookies) the template stays on the default dark theme.
Credits and support
Pivot builds on a few small, well-maintained open-source tools. Here is what they do, who to ask for help, and what changed in each release.
| Resource | Used for |
|---|---|
| Astro 7 | Framework, fully static output |
| Tailwind CSS 4 | Styling, CSS-first theme tokens |
| Zod 4 | Shared form validation schema |
| Motion 14 | Animated Beam, Number Ticker |
| Fontsource, Boxicons | Spartan font, icon set |
Need help? Email hello@lettstartdesign.com.
Changelog
| Version | Notes |
|---|---|
| 1.0.0 | Initial release: landing page, blog, changelog, docs, PHP-powered forms, auth modal UI, dark and light theme, SEO and JSON-LD schema, fully native Astro components with zero React. |