# Deployment

import { Callout } from "fumadocs-ui/components/callout";
import { Accordion, Accordions } from "fumadocs-ui/components/accordion";
import { Step, Steps } from "fumadocs-ui/components/steps";
import { Tabs, Tab } from "fumadocs-ui/components/tabs";
import {
  Badge,
  Card,
  CardContent,
  CardHeader,
  CardTitle,
} from "@pycolors/ui";
import {
  ArrowRight,
  ArrowUpRight,
  CheckCircle,
  Cloud,
  CreditCard,
  Database,
  Layers3,
  LockKeyhole,
  Rocket,
  ShieldCheck,
  XCircle,
} from "lucide-react";
import { PreferAvoid } from '@/components/docs/prefer-avoid';
import { DocsLinks } from "@/components/docs/docs-links";
import { DocsFeatureGrid } from "@/components/docs/docs-feature-grid";
import { DocsConceptTabs } from "@/components/docs/docs-concept-tabs";

<div className="flex flex-wrap items-center gap-2">
  <Badge variant="outline">
    Starter
  </Badge>

  <Badge>
    Deployment
  </Badge>
</div>

## Overview

Running locally is step one. Deploying early is step two.

Starter Free is intentionally simple to deploy because it does not require a database, auth secrets, Stripe keys, or backend services yet.

The goal is to get a credible SaaS surface online quickly so you can:

* test production builds
* share a live demo
* validate product direction
* prepare the path to real users

<Callout title="Deployment principle">
  Deploy early. Wire progressively. Do not wait for the backend to exist before validating the product surface.
</Callout>

### What you’ll do

<DocsFeatureGrid
  columns={3}
  tone="platform"
  items={[
  {
    title: 'Validate locally',
    description:
      'Build and run the app locally before deploying to production.',
    icon: ShieldCheck,
  },
  {
    title: 'Deploy to Vercel',
    description:
      'Push the starter to your repository and import the project into Vercel.',
    icon: Cloud,
  },
  {
    title: 'Verify routes',
    description:
      'Confirm the main SaaS surfaces and navigation flows work in production.',
    icon: Rocket,
  },
]}
/>

### Mental model

> Starter Free deploys as a frontend-first product surface.
> Production wiring comes later.

| Today               | Later                      |
| ------------------- | -------------------------- |
| mocked auth         | real session provider      |
| mocked billing      | Stripe Checkout and Portal |
| static invoices     | synced invoice history     |
| mock data           | database-backed records    |
| local UX validation | production user flows      |

<Callout type="info" title="No secrets required yet">
  Starter Free can deploy without `AUTH_SECRET`, `DATABASE_URL`, `STRIPE_SECRET_KEY`, or `STRIPE_WEBHOOK_SECRET` because those systems are intentionally mocked.
</Callout>

### Steps

<Steps>
  <Step>
    ### Validate the production build locally

    Run the production build before deploying.

    ```bash title="terminal"
    pnpm build
    pnpm start
    ```

    Then open:

    ```txt title="browser"
    http://localhost:3000
    ```

    If the app builds and starts locally, you have already caught the most common deployment issue.
  </Step>

  <Step>
    ### Push to your repository

    Create or connect your GitHub repository.

    ```bash title="terminal"
    git remote remove origin
    git remote add origin https://github.com/YOUR_USERNAME/YOUR_REPO.git
    git push -u origin main
    ```

    Use your own repository name and organization.
  </Step>

  <Step>
    ### Import on Vercel

    On Vercel:

    1. create a new project
    2. import your repository
    3. keep the detected Next.js settings
    4. deploy

    Starter Free does not require environment variables at this stage.
  </Step>

  <Step>
    ### Verify production routes

    After deployment, open the main routes:

    ```txt title="production routes"
    /login
    /register
    /dashboard
    /projects
    /admin
    /billing
    /settings
    ```

    You should be able to navigate the full mocked SaaS surface.
  </Step>
</Steps>

### Future environment variables

You do not need these variables for Starter Free, but they become relevant when the product moves toward real users.

```bash title=".env.local"
AUTH_SECRET=
DATABASE_URL=
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=
```

<DocsConceptTabs
  items={[
  {
    value: 'Auth',
    title: 'Auth variables',
    icon: LockKeyhole,
    description: (
      <>
        <p>
          Authentication variables become necessary once sessions, providers, and protected access are real.
        </p>

        <div className="mt-4 flex flex-wrap gap-2">
          <Badge variant="outline">AUTH_SECRET</Badge>
          <Badge variant="outline">OAuth providers</Badge>
          <Badge variant="outline">Session security</Badge>
          <Badge variant="outline">Password reset</Badge>
        </div>
      </>
    ),
  },
  {
    value: 'Database',
    title: 'Database variables',
    icon: Database,
    description: (
      <>
        <p>
          Database configuration becomes required when mocked data transitions into persisted product state.
        </p>

        <div className="mt-4 flex flex-wrap gap-2">
          <Badge variant="outline">DATABASE_URL</Badge>
          <Badge variant="outline">Prisma</Badge>
          <Badge variant="outline">Persistence</Badge>
          <Badge variant="outline">Production data</Badge>
        </div>
      </>
    ),
  },
  {
    value: 'Stripe',
    title: 'Stripe variables',
    icon: CreditCard,
    description: (
      <>
        <p>
          Stripe variables power real billing flows, webhook validation, and subscription synchronization.
        </p>

        <div className="mt-4 flex flex-wrap gap-2">
          <Badge variant="outline">STRIPE_SECRET_KEY</Badge>
          <Badge variant="outline">Webhook secret</Badge>
          <Badge variant="outline">Checkout</Badge>
          <Badge variant="outline">Billing workflows</Badge>
        </div>
      </>
    ),
  },
]}
/>

## Production checklist

Before sharing the deployment, confirm that:

* `pnpm build` succeeds locally
* the deployed app loads without runtime errors
* auth pages are reachable
* dashboard pages are reachable
* project routes work
* admin, billing, and settings pages render
* no required environment variable is missing
* navigation works on desktop and mobile
* mocked billing and auth are clearly understood as non-production wiring

<Callout title="Good deployment signal">
  If all routes load and the product surface feels coherent, the deployment is ready for demos, validation, and product iteration.
</Callout>

## Decision guide

Deploy Starter Free when:

* you want to share a demo
* you need feedback from users or clients
* you want to validate UX before backend work
* you want a production URL for your product story
* you want to catch build issues early

Move to Starter Pro when:

* real users need accounts
* routes must be protected
* Stripe must charge customers
* billing state must unlock features
* backend data must replace mock data
* deployment must support production operations

<PreferAvoid
  prefer={[
  'deploy early to validate the product surface',
  'run `pnpm build` before pushing',
  'verify core routes after deployment',
  'add secrets only when systems become real',
  'upgrade when backend wiring becomes the blocker',
]}
  avoid={[
  'waiting for backend wiring before deploying',
  'skipping production builds locally',
  'adding unused environment variables too early',
  'assuming mocked billing is production billing',
  'sharing a demo before checking all core routes',
]}
/>

## Troubleshooting

<Accordions type="single">
  <Accordion title="The build fails on Vercel but works locally">
    Reproduce the production build locally first.

    ```bash title="terminal"
    rm -rf .next
    pnpm install
    pnpm build
    ```

    Then check Node.js version, lockfile state, and package manager configuration.
  </Accordion>

  <Accordion title="A page fails because an environment variable is missing">
    Starter Free should not require production secrets. If a page fails because of a secret, confirm you did not add real auth, database, or Stripe code before configuring its environment.
  </Accordion>

  <Accordion title="The deployment shows an old version">
    Confirm the latest commit was pushed to the branch connected to Vercel. Then redeploy from the Vercel dashboard if needed.
  </Accordion>
</Accordions>

## Next steps

<DocsLinks
  variant="grid"
  items={[
  {
    title: 'Upgrade to Starter Pro',
    href: '/docs/starter/upgrade',
    description:
      'Know when Starter Free stops being enough and Starter Pro becomes the faster path to launch.',
    icon: ArrowUpRight,
    badge: 'Pro',
    tone: 'primary',
  },
  {
    title: 'Starter Pro',
    href: '/docs/starter-pro',
    description:
      'Move from mocked UX to production-shaped auth, billing, backend, and secure delivery foundations.',
    icon: Layers3,
    tone: 'platform',
  },
]}
/>

<Callout title="Free to deploy. Pro to launch.">
  Starter Free gives you a live SaaS surface. Starter Pro gives you the production wiring behind it. → <a href="/pricing" className="font-medium underline underline-offset-4">Upgrade to Starter Pro</a>
</Callout>