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.

This guide walks you through cloning the repository, installing dependencies, wiring up your environment variables, and creating your first account — all in about five minutes. You will need Node.js 18+, a MongoDB Atlas cluster (or any MongoDB connection string), a Brevo account for transactional email, and a Google AI Studio API key for the Gemini suggestions feature.
1

Clone the repository

Clone the project from GitHub and move into the project directory:
git clone https://github.com/dev0302/nextjs-project-1.git && cd nextjs-project-1
2

Install dependencies

Install all Node.js dependencies using your preferred package manager:
npm install
3

Configure environment variables

Create a .env.local file in the project root and populate it with the required values. See the Environment Variables reference for a full description of every variable.
.env.local
# Database
DATABASE_URL=mongodb+srv://user:pass@cluster.mongodb.net/anonmessage

# NextAuth
NEXTAUTH_SECRET=your-random-32-character-secret-here
NEXTAUTH_URL=http://localhost:3000

# Email — Brevo
SENDER_EMAIL=you@yourdomain.com
BREVO_API_KEY=xkeysib-...

# Google Gemini AI
GOOGLE_API_KEY=AIza...
GEMINI_MODEL=gemini-1.5-flash
The minimum required variables are DATABASE_URL, NEXTAUTH_SECRET, NEXTAUTH_URL, SENDER_EMAIL, BREVO_API_KEY, and GOOGLE_API_KEY. GEMINI_MODEL is optional and defaults to gemini-1.5-flash if omitted.
4

Run the development server

Start the Next.js development server:
npm run dev
Open http://localhost:3000 in your browser. The app uses Next.js 16’s App Router, so all pages and API routes under src/app/ are available immediately with hot-reload enabled.
5

Create your first account

Follow the sign-up flow to register and verify your account:
  1. Navigate to http://localhost:3000/sign-up.
  2. Enter a username (2–20 characters, letters/numbers/underscores only), your email address, and a password. The username field performs a live uniqueness check as you type.
  3. Click Send OTP. AnonMessage calls POST /api/send-otp, which generates a 6-digit code, stores it in MongoDB with a 5-minute TTL, and sends it to your email via Brevo.
  4. You are redirected to http://localhost:3000/verify-otp. Enter the 6-digit code from your inbox and click Create Account.
  5. On success you are redirected to /sign-in. Sign in with your email and password to land on your Dashboard at http://localhost:3000/dashboard.
  6. Copy your shareable link from the dashboard and open it in a private browser window to send yourself an anonymous test message at /u/[your-username].
Need a free MongoDB database? Create a free-tier cluster at MongoDB Atlas — it provides 512 MB of storage at no cost, which is more than enough to run AnonMessage in development and for small production deployments. After creating a cluster, whitelist your IP address and copy the connection string into DATABASE_URL.

Build docs developers (and LLMs) love