Pivot Docs Live preview
Documentation

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 in src/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/
The live preview and demo pages are statically generated (SSG) by Astro at build time — plain pre-rendered HTML, CSS and JavaScript with no server-side rendering. That is why pages load instantly: the only thing that needs a live server is the PHP waitlist / demo mail handler. See Build and deployment for details.

Getting started

Install the tools, run one command and the template builds, opens in your browser and rebuilds whenever you save a file.

Requirements

ToolVersionNeeded for
Node.jschecked on Node 24Building and running the template
npmbundled with Node.jsInstalling packages
PHPwith mail() configuredOnly the waitlist and demo forms (public/api/*.php)

Install and run

bash
cd pivot-astro
npm install
npm run dev

npm 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

CommandWhat it does
npm run devStart the dev server with live reload
npm run buildType-check with astro check, then build the static site into dist/
npm run previewServe the finished dist/ folder locally
npm run formatFormat the project with Prettier (Astro + Tailwind class-sorting plugins)
npm run format:checkCheck formatting without writing, for CI
Edit files in 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.

text
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.json

Content (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.

ComponentUsed for
layout/Navbar.astro, MobileDrawer.astroFixed navigation with dropdown groups, and the mobile slide-in menu
layout/ThemeToggle.astroDark / light switch, persisted to localStorage
common/PageHero.astroThe hero block at the top of every non-home page
common/BlogCard.astro, ChangelogCard.astroBlog 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).

PageFileWhat it is
Homeindex.astroThe 12-section landing page
Blogblog/index.astro, blog/[...slug].astroListing and post pages from the blog MDX collection (6 posts)
Changelogchangelog/index.astroTimeline from the changelog MDX collection (4 entries)
Docsdocs/index.astro, docs/[...slug].astroSidebar docs from the docs MDX collection (5 pages)
404404.astroNot-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

Brand color--dark-primaryButtons, links
Page background--dark-page-bgPage background
Surface--dark-surfaceCards and panels
Body text--dark-textBody text
Error--dark-errorForm validation
Success--dark-successSuccess messages

Typography

UseFontWeights
Headings and body textSpartan (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

css
/* src/styles/tokens.css */
:root {
  --dark-primary: #f15822;      /* change this */
  --dark-primary-hover: color-mix(in srgb, var(--dark-primary), #000 10%);
}
Never hard-code colors in components. Use the Tailwind names such as 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.

css
: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.

If you add a class from a 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.

ModuleBehavior
form.tsLive field validation, submit handling, status messages
auth-modal.tsOpens and closes the native <dialog>, switches login/signup/forgot views
tabs.tsSwitches tab panels (hero preview, lead capture, auth modal)
drawer.ts, theme.ts, nav-spy.tsMobile 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

php
// public/api/waitlist.php
const WAITLIST_TO = 'hello@lettstartdesign.com';

// public/api/demo.php
const DEMO_TO = 'hello@lettstartdesign.com';
The host needs a working 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.

SourceControls
src/lib/site.tsSite name, tagline, description, Twitter handle, contact email/phone/address
Each page's frontmatterPage title, meta description, canonical path
astro.config.mjs (site, base)Canonical domain and the /themes/.../app/ base path used across the build
@astrojs/sitemapGenerates sitemap-index.xml at build time
public/robots.txtCrawl 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.

StepWhat happens
checkastro check type-checks the project before building
pagesComponents are rendered into complete static HTML pages
cssTailwind and the files imported by global.css are compiled into one hashed stylesheet per entry
jsThe small vanilla TypeScript modules in src/scripts are bundled; there is no client framework and no hydration
publicapi/*.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.

There is no adapter and no server runtime: 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

PackageVersionUsed for
astro^7.4.11Static site generator and bundler (Vite)
@astrojs/mdx^8.1.5MDX for blog, changelog and docs content
@astrojs/sitemap^3.7.4Sitemap generation
tailwindcss, @tailwindcss/vite^4.3.5Utility CSS, compiled at build time
zod^4.6.7Shared validation schema for every form
motion^14.12.0Animated Beam, Number Ticker
@fontsource/spartan, boxicons^4.5.8 / ^2.1.4Self-hosted font, icon set
No React, Vue or other UI framework is a dependency. Every component is native Astro.

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

bash
npm install some-library   # add it
npm update                 # update everything

Customisation

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

SectionTells the assistant
StackAstro, Tailwind versions, and that there is no React or client framework
CommandsThe exact install, dev, build and format commands, so it does not guess
Project structureWhere pages, components, features, data, schemas and styles live
Interactivity and formsThe vanilla TypeScript modules, and how waitlist/demo forms talk to PHP
Do NOTEditing 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.

ResourceUsed for
Astro 7Framework, fully static output
Tailwind CSS 4Styling, CSS-first theme tokens
Zod 4Shared form validation schema
Motion 14Animated Beam, Number Ticker
Fontsource, BoxiconsSpartan font, icon set

Need help? Email hello@lettstartdesign.com.

Changelog

VersionNotes
1.0.0Initial 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.