Source: https://seerepo.com/docs/nextjs
Markdown source: https://seerepo.com/docs/nextjs.md
Description: What SeeRepo reads in a Next.js app: pages, route handlers, server actions and webhooks, drawn as parts of your map.

# SeeRepo with Next.js

SeeRepo recognizes a Next.js app from the `next` package in its `package.json`. It works with the App Router and the Pages Router, and with monorepos: each package is read with its own framework.

## What SeeRepo reads

**App Router**

- Every `page` file is a **screen**.
- Every `route` file is an **action**. Routes under `api/cron/` are things that **run on their own**.
- Webhooks are **API** doors for machines: SeeRepo spots them by their path, or by the signature check inside them (Stripe's `constructEvent`, Svix, Shopify's HMAC). So are `.well-known`, an `api/mcp` route, the sitemap, `robots` and Open Graph images.
- A file that starts with `'use server'` is an **action**: your server actions.
- `middleware` and `instrumentation` are doors too, and `layout`, `loading` and `error` files are special files of the router.

**Pages Router**

- Files under `pages/` are **screens**, and `pages/api/` are **actions**.
- `_app` and `_document` are doors.

**Who comes in**

A screen that requires a session is for **Signed-in people**; one that doesn't is for **Visitors**. Webhooks come from **Machines**.

## An example from our test bank

`vercel/nextjs-subscription-payments`, a Next.js App Router starter with Supabase and Stripe, read at a fixed commit:

- 4 screens, 4 actions and 1 API door (`app/api/webhooks/route.ts`, Stripe's webhook)
- 5 data models from its Supabase migration: customers, prices, products, subscriptions and users
- Services found with their proof: Supabase (8 files) and Stripe (7 files)
- 3 screens for visitors and 1 that requires a session (`app/account/page.tsx`)

## Good to know

- Data models are read from Prisma, Supabase migrations and Mongoose. **Drizzle models aren't read yet**: in our bank, `nextjs/saas-starter` uses Drizzle and its map shows no data models.
- Services come from three signals: the packages you import, the names of your environment variables and the URLs in your code.
- See also [Supabase](/docs/supabase), [Prisma](/docs/prisma) and [Mongoose](/docs/mongoose).
