Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/dev0302/nextjs-project-1/llms.txt

Use this file to discover all available pages before exploring further.

AnonMessage reads its configuration exclusively from environment variables so that secrets are never hard-coded in source files. During local development these values live in .env.local at the project root; in production they are set through your hosting provider’s environment configuration (e.g., Vercel project settings).
Never commit .env.local to version control. The file is listed in .gitignore by default. Committing it would expose your database credentials, NextAuth secret, and API keys publicly. If you accidentally expose a secret, rotate it immediately in the relevant provider’s dashboard.

Database

DATABASE_URL
string
required
MongoDB connection string. AnonMessage uses Mongoose to connect to your cluster. For MongoDB Atlas the format is:
mongodb+srv://<username>:<password>@<cluster>.mongodb.net/anonmessage
The database name at the end of the URI (anonmessage above) will be created automatically by Mongoose on first write. The application calls dbConnect() at the top of every API route and guards against multiple connections in the Next.js hot-reload environment.

NextAuth

NEXTAUTH_URL must match the exact canonical URL of your deployment — including the protocol and port — for NextAuth’s session callbacks, CSRF protection, and redirect handling to work correctly. For local development use http://localhost:3000; for production set it to your full domain, e.g. https://anonmessage.example.com.
NEXTAUTH_SECRET
string
required
A random, high-entropy string used by NextAuth to sign and encrypt JWT tokens and CSRF cookies. Must be at least 32 characters long. Generate a suitable value with:
openssl rand -base64 32
Changing this value in production will immediately invalidate all existing sessions, logging out every user.
NEXTAUTH_URL
string
required
The canonical base URL of your application. NextAuth uses this for constructing callback URLs and validating redirect targets.
  • Local development: http://localhost:3000
  • Production: https://yourdomain.com

Email (Brevo)

AnonMessage sends OTP verification emails through the Brevo (formerly Sendinblue) transactional email API. You will need a free Brevo account with at least one verified sender domain or email address.
SENDER_EMAIL
string
required
The email address that OTP verification emails are sent from. This address must be verified in your Brevo account under Senders & IPs → Senders. Unverified addresses will cause the Brevo API to reject the request with a 401 error.Example: noreply@yourdomain.com
BREVO_API_KEY
string
required
Your Brevo API key, used to authenticate requests to the Brevo v3 SMTP API (https://api.brevo.com/v3/smtp/email). Find or create one at app.brevo.com → SMTP & API → API Keys.The key begins with xkeysib- and should be treated as a secret.

Google Gemini AI

AnonMessage uses the @google/genai SDK to call Google’s Gemini models from the GET /api/suggest-messages route. The API generates three open-ended question suggestions for the anonymous sender on the /u/[username] page.
GOOGLE_API_KEY
string
required
API key for the Google AI Generative Language API. Obtain one for free at Google AI Studio under Get API Key. The key is passed directly to the GoogleGenAI client:
const ai = new GoogleGenAI({ apiKey: process.env.GOOGLE_API_KEY });
GEMINI_MODEL
string
The Gemini model name to use for generating message suggestions. Defaults to gemini-1.5-flash if this variable is not set. You can switch to a different model (e.g., gemini-1.5-pro) by setting this variable, without changing any source code.Default: gemini-1.5-flash

Complete .env.local Example

The following block contains every variable AnonMessage reads. Copy it to .env.local in the project root and replace the placeholder values before running the development server.
.env.local
# ── Database ──────────────────────────────────────────────────────────────────
DATABASE_URL=mongodb+srv://username:password@cluster0.abcde.mongodb.net/anonmessage

# ── NextAuth ──────────────────────────────────────────────────────────────────
# Generate with: openssl rand -base64 32
NEXTAUTH_SECRET=replace-with-a-random-32-character-string
NEXTAUTH_URL=http://localhost:3000

# ── Email — Brevo ─────────────────────────────────────────────────────────────
SENDER_EMAIL=noreply@yourdomain.com
BREVO_API_KEY=xkeysib-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx

# ── Google Gemini AI ──────────────────────────────────────────────────────────
GOOGLE_API_KEY=AIzaSyXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
GEMINI_MODEL=gemini-1.5-flash

Build docs developers (and LLMs) love