Skip to content

Drop-In Stack Templates (stack-templates/)

Conditional, copy-ready starters for Next.js App Router, Playwright, Vercel security headers, and Render Blueprints.

api-docs-route.ts

View raw file on GitHub

// Interactive API Reference (Scalar) served at /api-docs for Next.js App Router.
// Goes to: <repo>/src/app/api-docs/route.ts  (paired with /api/openapi.json)
// Note: if your app enforces a strict CSP blocking CDN scripts, use
// `@scalar/api-reference-react` or `swagger-ui-react` instead.

const HTML = `<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>{{PROJECT_NAME}} — API Docs</title>
  </head>
  <body>
    <script
      id="api-reference"
      data-url="/api/openapi.json"
      data-configuration='{"theme":"default","darkMode":true,"layout":"modern"}'
    ></script>
    <script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
  </body>
</html>`;

export function GET() {
  return new Response(HTML, {
    status: 200,
    headers: {
      "Content-Type": "text/html; charset=utf-8",
      "Cache-Control": "public, max-age=300",
    },
  });
}

error.tsx

View raw file on GitHub

"use client";

import Link from "next/link";

interface ErrorPageProps {
  error: Error & { digest?: string };
  reset: () => void;
}

export default function ErrorPage({ error, reset }: ErrorPageProps) {
  return (
    <main className="mx-auto flex min-h-[70vh] max-w-xl flex-col items-center justify-center px-6 py-16 text-center">
      <p className="font-mono text-xs uppercase tracking-widest text-neutral-500 dark:text-neutral-400">
        500 · Application Error
      </p>
      <h1 className="mt-3 text-3xl font-semibold tracking-tight text-neutral-900 dark:text-neutral-100">
        Something went wrong
      </h1>
      <p className="mt-3 text-sm leading-6 text-neutral-600 dark:text-neutral-400">
        An unexpected error interrupted this view. You can retry safely or return to the homepage.
      </p>
      {error.digest ? (
        <p className="mt-2 font-mono text-xs text-neutral-500">Reference: {error.digest}</p>
      ) : null}
      <div className="mt-8 flex flex-wrap items-center justify-center gap-3">
        <button
          type="button"
          onClick={reset}
          className="inline-flex h-10 items-center justify-center rounded-md bg-neutral-900 px-4 text-sm font-medium text-white transition-colors hover:bg-neutral-800 focus-visible:outline-2 focus-visible:outline-offset-2 dark:bg-neutral-100 dark:text-neutral-900 dark:hover:bg-neutral-200"
        >
          Try Again
        </button>
        <Link
          href="/"
          className="inline-flex h-10 items-center justify-center rounded-md border border-neutral-300 px-4 text-sm font-medium text-neutral-700 transition-colors hover:bg-neutral-100 focus-visible:outline-2 focus-visible:outline-offset-2 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-900"
        >
          Back to Home
        </Link>
      </div>
    </main>
  );
}

health-route.ts

View raw file on GitHub

import { NextResponse } from "next/server";

export const dynamic = "force-dynamic";

const startedAt = Date.now();

type CheckResult = "ok" | "error";

async function runHealthChecks(): Promise<Record<string, CheckResult>> {
  const checks: Record<string, CheckResult> = {
    app: "ok",
  };

  // Optional: ping backing services (DB / Redis) with a strict 2s timeout.
  // Never include connection strings, credentials, or raw stack traces in responses.
  // try {
  //   await Promise.race([
  //     db.$queryRaw`SELECT 1`,
  //     new Promise((_, reject) => setTimeout(() => reject(new Error("timeout")), 2000)),
  //   ]);
  //   checks.database = "ok";
  // } catch {
  //   checks.database = "error";
  // }

  return checks;
}

export async function GET() {
  const checks = await runHealthChecks();
  const isHealthy = Object.values(checks).every((state) => state === "ok");

  return NextResponse.json(
    {
      status: isHealthy ? "ok" : "degraded",
      service: "{{REPO_NAME}}",
      uptimeSeconds: Math.floor((Date.now() - startedAt) / 1000),
      timestamp: new Date().toISOString(),
      checks,
    },
    {
      status: isHealthy ? 200 : 503,
      headers: {
        "Cache-Control": "no-store, max-age=0",
      },
    },
  );
}

indexnow-route.ts

View raw file on GitHub

// IndexNow ownership verification route for Bing, ChatGPT Search & Copilot.
// Goes to: <repo>/src/app/indexnow-key.txt/route.ts
// Set INDEXNOW_KEY in your host env vars (matches setup-toolkit/.env).

export const dynamic = "force-dynamic";

export function GET() {
  const key = process.env.INDEXNOW_KEY?.trim();
  if (!key) {
    return new Response("Not Found", { status: 404 });
  }

  return new Response(key, {
    status: 200,
    headers: {
      "Content-Type": "text/plain; charset=utf-8",
      "Cache-Control": "public, max-age=3600",
    },
  });
}

llms-route.ts

View raw file on GitHub

// Concise AI-search index served at /llms.txt (Next.js App Router).
// Goes to: <repo>/src/app/llms.txt/route.ts
// Keep routes and descriptions aligned with sitemap.ts.

const SITE_URL = (process.env.NEXT_PUBLIC_APP_URL ?? "{{LIVE_URL}}").replace(/\/$/, "");

const LLMS_TXT = `# {{PROJECT_NAME}}

> {{ONE_LINE_DESCRIPTION}}

## Key Pages

- [Home](${SITE_URL}/): Overview and interactive workspace for {{PROJECT_NAME}}.
- [API Docs](${SITE_URL}/api-docs): OpenAPI interactive API reference and live request tester.
- [Privacy Policy](${SITE_URL}/privacy): Data handling, third-party services, and contact details.
- [Terms of Use](${SITE_URL}/terms): Usage terms and open-source licensing.

## Source & Author

- [GitHub Repository](https://github.com/tanisheesh/{{REPO_NAME}}): Source code, architecture docs, and issue tracker.
- [Author — Tanish Poddar](https://tanisheesh.in): Portfolio and contact (hi@tanisheesh.in).
- [Sponsor](https://github.com/sponsors/tanisheesh): Support ongoing open-source maintenance.
`;

export function GET() {
  return new Response(LLMS_TXT, {
    status: 200,
    headers: {
      "Content-Type": "text/plain; charset=utf-8",
      "Cache-Control": "public, max-age=3600",
    },
  });
}

not-found.tsx

View raw file on GitHub

import type { Metadata } from "next";
import Link from "next/link";

export const metadata: Metadata = {
  title: "Page Not Found",
  description: "The requested page could not be found.",
  robots: { index: false, follow: true },
};

export default function NotFound() {
  return (
    <main className="mx-auto flex min-h-[70vh] max-w-xl flex-col items-center justify-center px-6 py-16 text-center">
      <p className="font-mono text-xs uppercase tracking-widest text-neutral-500 dark:text-neutral-400">
        404 · Not Found
      </p>
      <h1 className="mt-3 text-3xl font-semibold tracking-tight text-neutral-900 dark:text-neutral-100">
        This page does not exist
      </h1>
      <p className="mt-3 text-sm leading-6 text-neutral-600 dark:text-neutral-400">
        The link may be outdated or the route may have moved. Head back to the main workspace to
        continue.
      </p>
      <div className="mt-8 flex flex-wrap items-center justify-center gap-3">
        <Link
          href="/"
          className="inline-flex h-10 items-center justify-center rounded-md bg-neutral-900 px-4 text-sm font-medium text-white transition-colors hover:bg-neutral-800 focus-visible:outline-2 focus-visible:outline-offset-2 dark:bg-neutral-100 dark:text-neutral-900 dark:hover:bg-neutral-200"
        >
          Back to Home
        </Link>
        <a
          href="/api/health"
          className="inline-flex h-10 items-center justify-center rounded-md border border-neutral-300 px-4 text-sm font-medium text-neutral-700 transition-colors hover:bg-neutral-100 focus-visible:outline-2 focus-visible:outline-offset-2 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-900"
        >
          System Status
        </a>
      </div>
    </main>
  );
}

openapi-route.ts

View raw file on GitHub

import { NextResponse } from "next/server";

export const dynamic = "force-dynamic";

const OPENAPI_SPEC = {
  openapi: "3.1.0",
  info: {
    title: "{{PROJECT_NAME}} API",
    version: "1.0.0",
    description: "{{ONE_LINE_DESCRIPTION}}",
    contact: {
      name: "Tanish Poddar",
      url: "https://tanisheesh.in",
    },
  },
  servers: [
    {
      url: "/",
      description: "Current deployment",
    },
  ],
  components: {
    securitySchemes: {
      BearerAuth: {
        type: "http",
        scheme: "bearer",
        bearerFormat: "JWT",
      },
    },
  },
  tags: [
    { name: "Health", description: "Runtime liveness and dependency health checks" },
    // Add project-specific tags here
  ],
  paths: {
    "/api/health": {
      get: {
        tags: ["Health"],
        summary: "Service health status",
        description: "Returns liveness status, uptime, and backing dependency checks.",
        responses: {
          "200": {
            description: "All systems functional",
            content: {
              "application/json": {
                schema: {
                  type: "object",
                  properties: {
                    status: { type: "string", enum: ["ok"] },
                    service: { type: "string" },
                    uptimeSeconds: { type: "integer" },
                    timestamp: { type: "string", format: "date-time" },
                    checks: {
                      type: "object",
                      additionalProperties: { type: "string", enum: ["ok", "error"] },
                    },
                  },
                  required: ["status", "service", "uptimeSeconds", "timestamp", "checks"],
                },
              },
            },
          },
          "503": {
            description: "One or more backing dependencies are degraded",
          },
        },
      },
    },
    // Document every project API route here with request schemas, auth requirements, and error codes.
  },
} as const;

export function GET() {
  return NextResponse.json(OPENAPI_SPEC, {
    headers: {
      "Cache-Control": "public, max-age=300",
    },
  });
}

playwright.config.ts

View raw file on GitHub

import { defineConfig, devices } from "@playwright/test";

const port = process.env.PORT ?? "3000";
const baseURL = process.env.BASE_URL ?? `http://127.0.0.1:${port}`;

export default defineConfig({
  testDir: "./tests/e2e",
  fullyParallel: true,
  forbidOnly: Boolean(process.env.CI),
  retries: process.env.CI ? 2 : 0,
  workers: process.env.CI ? 2 : undefined,
  reporter: process.env.CI ? [["github"], ["html", { open: "never" }]] : "list",
  use: {
    baseURL,
    trace: "on-first-retry",
    screenshot: "only-on-failure",
  },
  projects: [
    {
      name: "desktop-chromium",
      use: {
        ...devices["Desktop Chrome"],
        viewport: { width: 1280, height: 800 },
      },
    },
    {
      name: "mobile-chromium",
      use: {
        ...devices["Pixel 7"],
        viewport: { width: 375, height: 812 },
      },
    },
  ],
  webServer: process.env.BASE_URL
    ? undefined
    : {
        command: "{{e.g. npm run start -- -p 3000 / bun run start}}",
        url: baseURL,
        reuseExistingServer: !process.env.CI,
        timeout: 120_000,
      },
});

privacy-page.tsx

View raw file on GitHub

import type { Metadata } from "next";

export const metadata: Metadata = {
  title: "Privacy Policy",
  description: "How {{PROJECT_NAME}} handles user data, third-party services, and privacy requests.",
  alternates: { canonical: "/privacy" },
};

export default function PrivacyPage() {
  return (
    <main className="mx-auto max-w-3xl px-6 py-12 text-sm leading-7 text-neutral-700 dark:text-neutral-300">
      <h1 className="text-3xl font-semibold tracking-tight text-neutral-900 dark:text-neutral-100">
        Privacy Policy
      </h1>
      <p className="mt-2 text-xs text-neutral-500 dark:text-neutral-400">
        Last updated: {{YYYY-MM-DD}} · Applies to {{PROJECT_NAME}} ({{LIVE_URL}})
      </p>

      <section className="mt-8 space-y-3">
        <h2 className="text-lg font-semibold text-neutral-900 dark:text-neutral-100">
          1. Information We Process
        </h2>
        <p>
          {{PROJECT_NAME}} is built with data minimization in mind.{" "}
          {/* Replace with the exact truth for this repo:
              - Stateless demo: "Inputs submitted in the browser are processed transiently and are not stored permanently."
              - Auth/DB app: "When you sign in, we store your account identifier and workspace records solely to provide the service." */}
          {{DATA_COLLECTION_SUMMARY}}
        </p>
      </section>

      <section className="mt-8 space-y-3">
        <h2 className="text-lg font-semibold text-neutral-900 dark:text-neutral-100">
          2. Hosting & Third-Party Processors
        </h2>
        <p>
          Infrastructure logs (such as IP address, user agent, and request timestamps) may be
          processed temporarily by our hosting and API providers ({{HOSTING_AND_API_PROVIDERS}})
          strictly for security, rate limiting, and reliability. We do not sell personal data or
          run third-party ad trackers.
        </p>
      </section>

      <section className="mt-8 space-y-3">
        <h2 className="text-lg font-semibold text-neutral-900 dark:text-neutral-100">
          3. Cookies & Local Storage
        </h2>
        <p>
          {{COOKIES_AND_LOCAL_STORAGE_SUMMARY}}
        </p>
      </section>

      <section className="mt-8 space-y-3">
        <h2 className="text-lg font-semibold text-neutral-900 dark:text-neutral-100">
          4. Data Retention & Contact
        </h2>
        <p>
          To request access, correction, or deletion of any data associated with your use of{" "}
          {{PROJECT_NAME}}, email{" "}
          <a
            href="mailto:hi@tanisheesh.in"
            className="font-medium text-neutral-900 underline underline-offset-4 dark:text-neutral-100"
          >
            hi@tanisheesh.in
          </a>
          .
        </p>
      </section>
    </main>
  );
}

render.yaml

View raw file on GitHub

# ╔══════════════════════════════════════════════════════════════════════╗
# ║  TANISH'S SETUP TOOLKIT · tanisheesh.in                              ║
# ║  Render Blueprint starter. Goes to: <repo>/render.yaml (if used)     ║
# ╚══════════════════════════════════════════════════════════════════════╝

services:
  - type: web
    name: "{{REPO_NAME}}"
    runtime: "{{python|node|docker}}"
    region: singapore
    plan: free
    autoDeploy: true
    healthCheckPath: "{{/api/health}}"
    buildCommand: "{{e.g. pip install -r requirements.txt}}"
    startCommand: "{{e.g. uvicorn app.main:app --host 0.0.0.0 --port $PORT}}"
    envVars:
      - key: "{{ENV_VAR_NAME}}"
        sync: false

# ──────────────────────────────────────────────────────────────────────────
#  Tanish Poddar
#  Website   https://tanisheesh.in
#  LinkedIn  https://linkedin.com/in/tanisheesh
#  GitHub    https://github.com/tanisheesh
#  Email     hi@tanisheesh.in
# ──────────────────────────────────────────────────────────────────────────

robots.ts

View raw file on GitHub

import type { MetadataRoute } from "next";

const SITE_URL = (process.env.NEXT_PUBLIC_APP_URL ?? "{{LIVE_URL}}").replace(/\/$/, "");

export default function robots(): MetadataRoute.Robots {
  const disallowed = ["/api/", "/admin/", "/dashboard/", "/sign-in", "/sign-up"];

  return {
    rules: [
      {
        userAgent: "*",
        allow: "/",
        disallow: disallowed,
      },
      {
        userAgent: [
          "GPTBot",
          "OAI-SearchBot",
          "ChatGPT-User",
          "ClaudeBot",
          "PerplexityBot",
          "Google-Extended",
        ],
        allow: "/",
        disallow: disallowed,
      },
    ],
    sitemap: `${SITE_URL}/sitemap.xml`,
    host: SITE_URL,
  };
}

site-footer.tsx

View raw file on GitHub

"use client";

import { useEffect, useState } from "react";

type HealthState = "checking" | "ok" | "degraded";

export interface SiteFooterProps {
  /** Health check URL polled on mount (defaults to "/api/health"). */
  healthEndpoint?: string;
  /** Optional interactive API docs URL (e.g. "/api-docs" or "/docs"). */
  apiDocsHref?: string;
  /** Privacy Policy route (defaults to "/privacy"; pass null to omit). */
  privacyHref?: string | null;
  /** Terms of Use route (defaults to "/terms"; pass null to omit). */
  termsHref?: string | null;
  /** GitHub Sponsors URL (defaults to Tanish's Sponsors profile; pass null on Client Websites). */
  sponsorHref?: string | null;
  /** Buy Me a Coffee URL for non-GitHub visitors (defaults to Tanish's page; pass null on Client Websites). */
  coffeeHref?: string | null;
  /** Optional extra Tailwind classes for layout integration. */
  className?: string;
}

const STATUS_META: Record<HealthState, { dotClass: string; label: string }> = {
  checking: {
    dotClass: "bg-neutral-400",
    label: "Checking status...",
  },
  ok: {
    dotClass: "bg-emerald-500",
    label: "All Systems Functional",
  },
  degraded: {
    dotClass: "bg-amber-500",
    label: "System Degraded",
  },
};

export function SiteFooter({
  healthEndpoint = "/api/health",
  apiDocsHref,
  privacyHref = "/privacy",
  termsHref = "/terms",
  sponsorHref = "https://github.com/sponsors/tanisheesh",
  coffeeHref = "https://buymeacoffee.com/tanisheesh",
  className = "",
}: SiteFooterProps) {
  const [health, setHealth] = useState<HealthState>("checking");
  const currentYear = new Date().getFullYear();

  useEffect(() => {
    const controller = new AbortController();
    const timeoutId = setTimeout(() => controller.abort(), 5000);

    async function checkHealth() {
      try {
        const res = await fetch(healthEndpoint, {
          cache: "no-store",
          signal: controller.signal,
        });
        if (!res.ok) {
          setHealth("degraded");
          return;
        }
        const data: unknown = await res.json();
        const status =
          typeof data === "object" && data !== null && "status" in data
            ? (data as { status?: unknown }).status
            : undefined;
        setHealth(status === "ok" || status === "healthy" ? "ok" : "degraded");
      } catch {
        if (!controller.signal.aborted) {
          setHealth("degraded");
        }
      } finally {
        clearTimeout(timeoutId);
      }
    }

    void checkHealth();

    return () => {
      clearTimeout(timeoutId);
      controller.abort();
    };
  }, [healthEndpoint]);

  const { dotClass, label } = STATUS_META[health];
  const linkClass =
    "transition-colors hover:text-neutral-900 focus-visible:outline-2 focus-visible:outline-offset-2 dark:hover:text-neutral-100";

  return (
    <footer
      className={`border-t border-neutral-200 dark:border-neutral-800 py-6 px-4 text-xs text-neutral-600 dark:text-neutral-400 ${className}`.trim()}
    >
      <div className="mx-auto flex max-w-6xl flex-col items-center justify-between gap-3 sm:flex-row">
        <p className="text-center sm:text-left">
          © <span suppressHydrationWarning>{currentYear}</span> |{" "}
          <a
            href="https://tanisheesh.in"
            target="_blank"
            rel="noopener noreferrer"
            className="font-medium text-neutral-900 underline-offset-4 transition-colors hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 dark:text-neutral-100"
          >
            Tanish Poddar
          </a>{" "}
          — crafted with{" "}
          <span aria-hidden="true" className="text-red-500">
            ❤
          </span>
        </p>

        <nav
          aria-label="Footer links and system status"
          className="flex flex-wrap items-center justify-center gap-x-3 gap-y-2"
        >
          <a
            href={healthEndpoint}
            target="_blank"
            rel="noopener noreferrer"
            aria-live="polite"
            className={`inline-flex items-center gap-2 ${linkClass}`}
          >
            <span
              aria-hidden="true"
              className={`inline-block h-2 w-2 rounded-full ${dotClass}`}
            />
            <span>{label}</span>
          </a>

          {apiDocsHref ? (
            <>
              <span aria-hidden="true" className="text-neutral-400 dark:text-neutral-600">
                ·
              </span>
              <a href={apiDocsHref} className={linkClass}>
                API Docs
              </a>
            </>
          ) : null}

          {privacyHref ? (
            <>
              <span aria-hidden="true" className="text-neutral-400 dark:text-neutral-600">
                ·
              </span>
              <a href={privacyHref} className={linkClass}>
                Privacy
              </a>
            </>
          ) : null}

          {termsHref ? (
            <>
              <span aria-hidden="true" className="text-neutral-400 dark:text-neutral-600">
                ·
              </span>
              <a href={termsHref} className={linkClass}>
                Terms
              </a>
            </>
          ) : null}

          {sponsorHref ? (
            <>
              <span aria-hidden="true" className="text-neutral-400 dark:text-neutral-600">
                ·
              </span>
              <a
                href={sponsorHref}
                target="_blank"
                rel="noopener noreferrer"
                className={`inline-flex items-center gap-1 ${linkClass}`}
              >
                <span aria-hidden="true" className="text-pink-500">
                  ♥
                </span>
                <span>Sponsor</span>
              </a>
            </>
          ) : null}

          {coffeeHref ? (
            <>
              <span aria-hidden="true" className="text-neutral-400 dark:text-neutral-600">
                ·
              </span>
              <a
                href={coffeeHref}
                target="_blank"
                rel="noopener noreferrer"
                className={linkClass}
              >
                Buy Me a Coffee
              </a>
            </>
          ) : null}
        </nav>
      </div>
    </footer>
  );
}

sitemap.ts

View raw file on GitHub

import type { MetadataRoute } from "next";

const SITE_URL = (process.env.NEXT_PUBLIC_APP_URL ?? "{{LIVE_URL}}").replace(/\/$/, "");

// Use real last-modified dates for static routes (never stamp `new Date()` on unchanged pages).
const STATIC_ROUTES: Array<{
  path: string;
  lastModified: string;
  changeFrequency: MetadataRoute.Sitemap[number]["changeFrequency"];
  priority: number;
}> = [
  { path: "/", lastModified: "{{YYYY-MM-DD}}", changeFrequency: "weekly", priority: 1.0 },
  { path: "/privacy", lastModified: "{{YYYY-MM-DD}}", changeFrequency: "yearly", priority: 0.3 },
  { path: "/terms", lastModified: "{{YYYY-MM-DD}}", changeFrequency: "yearly", priority: 0.3 },
  // Add project-specific public routes here (or fetch dynamic slugs from your data source).
];

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
  return STATIC_ROUTES.map((route) => ({
    url: `${SITE_URL}${route.path === "/" ? "" : route.path}`,
    lastModified: new Date(route.lastModified),
    changeFrequency: route.changeFrequency,
    priority: route.priority,
  }));
}

smoke.spec.ts

View raw file on GitHub

import AxeBuilder from "@axe-core/playwright";
import { expect, test } from "@playwright/test";

const ROUTES = ["/"];

test.describe("smoke, layout, and accessibility", () => {
  for (const route of ROUTES) {
    test(`renders ${route} cleanly without errors or overflow`, async ({ page }) => {
      const consoleErrors: string[] = [];
      const pageErrors: string[] = [];
      const serverErrors: string[] = [];

      page.on("console", (msg) => {
        if (msg.type() === "error") {
          consoleErrors.push(msg.text());
        }
      });
      page.on("pageerror", (err) => {
        pageErrors.push(err.message);
      });
      page.on("response", (res) => {
        if (res.status() >= 500) {
          serverErrors.push(`${res.status()} ${res.url()}`);
        }
      });

      const response = await page.goto(route, { waitUntil: "networkidle" });
      expect(response).not.toBeNull();
      expect(response?.status()).toBeLessThan(400);

      const hasHorizontalOverflow = await page.evaluate(() => {
        return document.documentElement.scrollWidth > window.innerWidth;
      });
      expect(hasHorizontalOverflow).toBe(false);

      const a11y = await new AxeBuilder({ page })
        .withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"])
        .analyze();
      const severe = a11y.violations.filter(
        (v) => v.impact === "critical" || v.impact === "serious",
      );
      expect(severe).toEqual([]);

      expect(consoleErrors).toEqual([]);
      expect(pageErrors).toEqual([]);
      expect(serverErrors).toEqual([]);
    });
  }

  test("health endpoint returns 200 ok", async ({ request }) => {
    const res = await request.get("/api/health");
    expect(res.status()).toBe(200);
    const body = (await res.json()) as { status?: string };
    expect(["ok", "healthy"]).toContain(body.status);
  });

  test("robots.txt, sitemap.xml, and real HTTP 404 behave properly", async ({ request }) => {
    const robotsRes = await request.get("/robots.txt");
    expect(robotsRes.status()).toBe(200);
    expect(await robotsRes.text()).not.toMatch(/^Disallow:\s*\/\s*$/m);

    const sitemapRes = await request.get("/sitemap.xml");
    expect(sitemapRes.status()).toBe(200);

    const notFoundRes = await request.get("/definitely-not-a-page-404-check");
    expect(notFoundRes.status()).toBe(404);
  });

  // Portfolio sites: verify dynamic copyright footer, support links, and live health status.
  // Remove or adapt this test for Client Websites with custom client footers.
  test("footer renders dynamic year, author/support links, and live status", async ({ page }) => {
    await page.goto("/", { waitUntil: "networkidle" });
    const footer = page.locator("footer");
    await expect(footer).toBeVisible();
    await expect(footer).toContainText(String(new Date().getFullYear()));
    await expect(footer.locator('a[href^="https://tanisheesh.in"]')).toBeVisible();
    await expect(footer.locator('a[href^="https://github.com/sponsors/tanisheesh"]')).toBeVisible();
    await expect(footer.locator('a[href^="https://buymeacoffee.com/tanisheesh"]')).toBeVisible();
    await expect(footer).toContainText(/All Systems Functional/i);
  });
});

terms-page.tsx

View raw file on GitHub

import type { Metadata } from "next";

export const metadata: Metadata = {
  title: "Terms of Use",
  description: "Terms of use, acceptable use rules, and open-source licensing for {{PROJECT_NAME}}.",
  alternates: { canonical: "/terms" },
};

export default function TermsPage() {
  return (
    <main className="mx-auto max-w-3xl px-6 py-12 text-sm leading-7 text-neutral-700 dark:text-neutral-300">
      <h1 className="text-3xl font-semibold tracking-tight text-neutral-900 dark:text-neutral-100">
        Terms of Use
      </h1>
      <p className="mt-2 text-xs text-neutral-500 dark:text-neutral-400">
        Last updated: {{YYYY-MM-DD}} · Applies to {{PROJECT_NAME}} ({{LIVE_URL}})
      </p>

      <section className="mt-8 space-y-3">
        <h2 className="text-lg font-semibold text-neutral-900 dark:text-neutral-100">
          1. Use of Service
        </h2>
        <p>
          By accessing {{PROJECT_NAME}}, you agree to use the service lawfully and responsibly. Do
          not attempt to bypass rate limits, disrupt availability, or probe unauthorized endpoints.
        </p>
      </section>

      <section className="mt-8 space-y-3">
        <h2 className="text-lg font-semibold text-neutral-900 dark:text-neutral-100">
          2. Open-Source License
        </h2>
        <p>
          Source code for {{PROJECT_NAME}} is available at{" "}
          <a
            href="https://github.com/tanisheesh/{{REPO_NAME}}"
            target="_blank"
            rel="noopener noreferrer"
            className="font-medium text-neutral-900 underline underline-offset-4 dark:text-neutral-100"
          >
            github.com/tanisheesh/{{REPO_NAME}}
          </a>{" "}
          under the GNU General Public License (GPL-3.0) unless otherwise noted in the repository.
        </p>
      </section>

      <section className="mt-8 space-y-3">
        <h2 className="text-lg font-semibold text-neutral-900 dark:text-neutral-100">
          3. No Warranty
        </h2>
        <p>
          {{PROJECT_NAME}} is provided &ldquo;as is&rdquo; without warranties of any kind. Outputs
          are informational and should be independently verified before relying on them for
          critical decisions.
        </p>
      </section>

      <section className="mt-8 space-y-3">
        <h2 className="text-lg font-semibold text-neutral-900 dark:text-neutral-100">
          4. Contact
        </h2>
        <p>
          Questions regarding these terms can be sent to{" "}
          <a
            href="mailto:hi@tanisheesh.in"
            className="font-medium text-neutral-900 underline underline-offset-4 dark:text-neutral-100"
          >
            hi@tanisheesh.in
          </a>
          .
        </p>
      </section>
    </main>
  );
}

vercel.json

View raw file on GitHub

{
  "$schema": "https://openapi.vercel.sh/vercel.json",
  "headers": [
    {
      "source": "/(.*)",
      "headers": [
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-Frame-Options",
          "value": "DENY"
        },
        {
          "key": "Referrer-Policy",
          "value": "strict-origin-when-cross-origin"
        },
        {
          "key": "Permissions-Policy",
          "value": "camera=(), microphone=(), geolocation=()"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=63072000; includeSubDomains; preload"
        }
      ]
    }
  ]
}