NextFire main logoNextFire
Docs X
Introduction
Get Started
Clone repo
Run the app
Configuration
Firebase
Create firebase app
Authentication
Firestore
Storage
Functions
Global configuration
Public
Site config
Payments
Stripe
One time
Subscriptions
Webhooks
Usage
Project structure
Static pages
Public pages
Protected pages
Auth
Client auth
Server auth
Data fetching
Firestore client
Firestore admin
Functions
Storage
Content
Blog
Documentation
Components
Markdown
Cards
Diagrams
Filetree
Lists
Maths
Notes
Steps
Table
Tabs
Public
Deep
Deeper
Even deeper
  1. Project Structure
  2. Public Pages

Public Pages Structure

The public directory contains all pages that are accessible without authentication. These routes are available to anyone visiting your application, even if they are not logged in.

Your folder structure should look like this:

app/
└── (public)/ → Publicly accessible pages
├── (docs)/ → Documentation pages (e.g., API, guides)
├── (landing)/ → Marketing and landing pages
├── privacy/ → Privacy Policy (static legal page)
└── terms/ → Terms of Service (static legal page)

1

Purpose of the (public) Folder

The (public) folder is designed to host all routes that can be viewed by unauthenticated users. These typically include:

  • Marketing or landing pages (e.g., home, pricing, features)
  • Documentation pages for your SaaS or API
  • Legal pages like Privacy Policy and Terms of Service
  • Contact or About pages

Any user — whether logged in or not — can access these URLs directly.

2

Recommended Structure and Best Practices

  • Keep marketing and onboarding content under app/(public)/(landing)/ Example: app/(public)/(landing)/page.tsx
  • Place documentation under app/(public)/(docs)/
  • Store compliance pages under app/(public)/privacy/ and app/(public)/terms/
  • If you need nested sections (e.g., /docs/getting-started), organize them within (docs) as subfolders.
3

Linking to Public Pages

Since these routes are part of the Next.js app router, you can link to them using:

import Link from "next/link";

export default function Footer() {
  return (
    <footer>
      <Link href="/privacy">Privacy Policy</Link>
      <Link href="/terms">Terms of Service</Link>
      <Link href="/docs">Documentation</Link>
    </footer>
  );
}

This ensures your public legal and informational pages are always accessible from key areas like your site footer, landing page, or checkout flow.

4

4. Compliance Note

Stripe and most payment providers require that your Privacy Policy and Terms of Service be publicly accessible. Ensure they remain under the (public) directory so they can be reached without login barriers.


✅ Summary: All routes within app/(public)/ are open to everyone, making them ideal for marketing, onboarding, documentation, and compliance-related pages.

Static pagesProtected pages

On this page

Public Pages Structure

Content

FeedbackEdit page

© 2025 Ship IT.

Rubix Studios logo