Skip to content

Conversation

@danieltprice
Copy link
Collaborator

@danieltprice danieltprice commented Jan 24, 2026

Add documentation for the optional NEON_AUTH_COOKIE_SECRET environment variable that enables local session data caching in Next.js applications. This feature reduces Auth Server API calls by 95-99% with a 5-minute cache TTL.

Updated both Next.js quickstart guides:

  • Next.js with UI Components guide
  • Next.js with API methods guide

The session caching feature is opt-in, fully backward compatible, and recommended for production environments.

Related: neondatabase/neon-js#35

(This PR also adds some docs rules files)

@vercel
Copy link

vercel bot commented Jan 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
neon-next Ready Ready Preview, Comment Jan 31, 2026 4:01pm

Request Review

<Admonition type="tip" title="Optional: Enable session caching for better performance">
Add `NEON_AUTH_COOKIE_SECRET` to enable local session data caching, which reduces Auth Server API calls by 95-99%. Session data is cached with a 5-minute TTL and validated using signed cookies. The secret must be at least 32 characters long.

This feature is opt-in and fully backward compatible. Without this variable, the SDK will continue to validate sessions with the Auth Server on every request.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not opt-in, you must provide the NEON_AUTH_COOKIE_SECRET

```bash
NEON_AUTH_BASE_URL=https://ep-xxx.neonauth.us-east-1.aws.neon.tech/neondb/auth

# Optional: Enable session caching (recommended for production)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not optional

NEON_AUTH_BASE_URL=https://ep-xxx.neonauth.us-east-1.aws.neon.tech/neondb/auth

# Optional: Enable session caching (recommended for production)
NEON_AUTH_COOKIE_SECRET=your-secret-key-at-least-32-characters-long
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add how to generate this secret with openssl

openssl rand -base64 32

At some point we should have this secret into environment variables from neon console itself

<Admonition type="tip" title="Optional: Enable session caching for better performance">
Add `NEON_AUTH_COOKIE_SECRET` to enable local session data caching, which reduces Auth Server API calls by 95-99%. Session data is cached with a 5-minute TTL and validated using signed cookies. The secret must be at least 32 characters long.

This feature is opt-in and fully backward compatible. Without this variable, the SDK will continue to validate sessions with the Auth Server on every request.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

NEON_AUTH_BASE_URL=https://ep-xxx.neonauth.us-east-1.aws.neon.tech/neondb/auth

# Optional: Enable session caching (recommended for production)
NEON_AUTH_COOKIE_SECRET=your-secret-key-at-least-32-characters-long
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Add documentation for the optional NEON_AUTH_COOKIE_SECRET environment
variable that enables local session data caching in Next.js applications.
This feature reduces Auth Server API calls by 95-99% with a 5-minute cache TTL.

Updated both Next.js quickstart guides:
- Next.js with UI Components guide
- Next.js with API methods guide

The session caching feature is opt-in, fully backward compatible, and
recommended for production environments.

Related: neondatabase/neon-js#35
Enhanced the neon-js SDK documentation sync workflow rules based on
learnings from documenting PR #35 (session caching feature).

Key improvements:
- Added Documentation Scope Decision Tree to distinguish between client SDK,
  Next.js server-side, and framework-specific changes
- Added complete guidance for updating Next.js quickstart guides
- Expanded user-facing changes checklist to include server-side features
- Enhanced summary template to categorize changes by documentation type
- Updated execution checklist with scope determination and frontmatter updates

These changes ensure the workflow accurately handles both client-side SDK
API changes and framework-specific server-side features.
Organize Cursor configuration by moving the changelog generator rules
file into the .cursor/rules/ directory for better structure.
Created comprehensive rules for syncing documentation from the
neondatabase-labs/mcp-server-neon repository to the website docs.

Key features:
- Documentation scope decision tree (tools vs setup vs client-specific)
- Guidance for updating 3 reference docs and 7 client-specific guides
- Detailed update patterns for MCP tools list
- Security-first approach for powerful MCP capabilities
- Client-specific setup variations (Claude, Cursor, VS Code, etc.)
- Complete workflow from PR review to documentation updates

This enables systematic documentation updates when new MCP tools,
setup improvements, or client integrations are added to the server.
Made the mcp-tools.md shared component pattern explicit and prominent:
- Added important admonition about single source of truth
- Updated Important Notes section with shared component guidance
- Enhanced execution checklist with DO NOT duplicate warning
- Clarified example workflow to show automatic propagation

This ensures the tools list is only updated in one location and
automatically propagates to all guides via the <MCPTools /> component.
Added Step 6 to check and update the source repository's README when
syncing MCP server documentation.

Key additions:
- Guidance on when to update the source repo README
- Process for opening PRs to neondatabase-labs/mcp-server-neon
- README sync section in Important Notes
- Updated execution checklist with README verification
- Enhanced example workflows showing README checks
- Updated summary template to track README status

This ensures the source repo's README stays in sync with website docs,
providing consistent documentation for developers accessing the repo directly.
@danieltprice
Copy link
Collaborator Author

Thank you. These comments have all been addressed in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants