> ## Documentation Index
> Fetch the complete documentation index at: https://getfloo.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy a Next.js app with sign-in from Cursor

> Have Cursor deploy your Next.js app to floo behind invite-only sign-in. floo hosts the sign-in page and sends the signed-in user's email, id, name, and role to your app as request headers.

Cursor writes the floo config, pushes it, and connects your GitHub repository. floo serves the app at `https://<app>-dev.getfloo.app` and redirects anyone not signed in to a hosted sign-in page. Your app writes no auth code.

Requires a Next.js App Router project in a GitHub repository with a `Dockerfile` that serves on `0.0.0.0:$PORT`. The [Next.js guide](https://getfloo.com/docs/build/nextjs.md#1-add-a-dockerfile) has a standalone-output Dockerfile to copy, and `floo init` offers to write one when none exists. No GitHub account? See [Start without GitHub](#start-without-github).

## Set up your agent

Install the CLI and sign in from Cursor's terminal:

```bash theme={null}
curl -fsSL https://getfloo.com/install.sh | bash
floo auth login
```

Add this line to `AGENTS.md` at the repository root:

```text theme={null}
For floo work, read https://getfloo.com/docs/guides/agent-setup.
```

## Agent prompt

Paste into Cursor's agent. Replace `my-nextjs-app` with your app name.

```text theme={null}
Deploy this Next.js app to floo behind App sign-in. App name: my-nextjs-app.
1. Confirm the floo org with `floo orgs list`. If the org has no plan, have me run `floo billing upgrade`.
2. Run `floo init my-nextjs-app`. In floo.app.toml, set port 3000 on [services.web] and set access_mode = "accounts" under [app].
3. Read the signed-in user from the x-floo-user-email, x-floo-user-id, x-floo-user-name, and x-floo-user-role request headers with headers() from next/headers. Do not add a login page, session store, or auth library.
4. Run `floo preflight --json` and fix every error.
5. Commit and push to the default branch.
6. Have me open https://github.com/apps/getfloo/installations/new, choose the repository's owner, and select this repository. Wait for me to confirm.
7. Run `floo apps github setup --no-browser` and give me the printed link. Wait for me to confirm GitHub access.
8. Run `floo apps github connect <owner>/<repo> --no-browser`.
9. Run `floo deploys status --app my-nextjs-app --json` until the deploy is live, then report the URL.
```

## floo.app.toml

What the prompt produces:

```toml floo.app.toml theme={null}
[app]
name = "my-nextjs-app"
access_mode = "accounts"

[services.web]
type = "web"
path = "."
port = 3000
ingress = "public"
dev_command = "npm run dev"
```

`access_mode = "accounts"` puts floo's gateway in front of every request. Only people with an app membership get in; you get an admin membership when `connect` creates the app.

Read the user in a Server Component:

```tsx app/page.tsx theme={null}
import { headers } from "next/headers";

export default async function Home() {
  const h = await headers();
  return <h1>Hello {h.get("x-floo-user-name") ?? h.get("x-floo-user-email")}</h1>;
}
```

Sign out with a `POST` to `/__floo/logout`. `GET /__floo/me` returns the user as JSON for client components. See [App sign-in](https://getfloo.com/docs/guides/app-auth.md#reading-the-user-in-your-app).

## CLI commands

The same deploy by hand. Replace `owner/my-nextjs-app` with your repository.

```bash theme={null}
floo init my-nextjs-app
floo preflight
git add . && git commit -m "chore: deploy to floo with sign-in"
git push origin main
floo apps github setup
floo apps github connect owner/my-nextjs-app
floo deploys watch --app my-nextjs-app
```

`floo apps github setup` needs the floo GitHub App installed on the repository's owner first. See [Quickstart steps 2 and 3](https://getfloo.com/docs/introduction.md#2-give-floo-access-to-your-github-repository).

Invite the people who should get in:

```bash theme={null}
floo apps invite teammate@example.com --role member --app my-nextjs-app
```

## Verify

```bash theme={null}
floo deploys status --app my-nextjs-app --json
floo apps members --app my-nextjs-app
```

Open `https://my-nextjs-app-dev.getfloo.app` in a private window. floo's sign-in page loads first; after you sign in, the page shows your name. `apps members` lists you as `admin` and each accepted invitee.

To test signed-in pages locally, run `floo dev --app my-nextjs-app --fixture-user you@example.com`. It injects the same headers the gateway adds.

## Start without GitHub

`floo projects create` makes a Next.js app with App sign-in and managed Postgres in a floo-hosted repository, deploys it, and returns its URL:

```bash theme={null}
floo projects create my-nextjs-app
floo projects clone my-nextjs-app
```

Open the cloned folder in Cursor and build from there. Every push deploys to dev; `floo releases promote --app my-nextjs-app` publishes to prod. See [projects](https://getfloo.com/docs/cli/projects.md).

## Next steps

> **[Build a Next.js app](https://getfloo.com/docs/build/nextjs.md)**
>
> Dockerfile, `NEXT_PUBLIC_*` build variables, Postgres with Prisma, and a custom domain.

> **[App sign-in](https://getfloo.com/docs/guides/app-auth.md)**
>
> Identity headers, app roles, sign-out, and per-environment access modes.

> **[App API keys](https://getfloo.com/docs/guides/app-api-keys.md)**
>
> Let a program call selected routes while the UI stays behind sign-in.

> **[Environments](https://getfloo.com/docs/guides/environments.md)**
>
> Dev and prod URLs, and how a GitHub release publishes to prod.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.