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 is a full-stack anonymous messaging platform built with Next.js 16. Once you create an account, you receive a unique public profile at /u/[username] that you can share with anyone. Visitors can send you messages without signing up or revealing who they are — no login, no tracking, just honest feedback.

What AnonMessage Does

Registered users get a personal dashboard where they can view incoming anonymous messages, toggle whether they are accepting new messages, and copy their shareable profile link. On the sender side, anyone with the link can open the public /u/[username] page, compose a message, and submit it instantly — the entire flow requires zero authentication from the sender. To keep conversations engaging, AnonMessage integrates Google Gemini AI: the send-message page can surface three AI-generated question suggestions, giving senders an easy prompt to respond to if they are stuck.

Key Features

Anonymous Messaging

Anyone can send a message to a registered user’s public /u/[username] profile without creating an account or revealing their identity.

Authentication & OTP

Secure sign-up with email OTP verification (delivered via Brevo), CredentialsProvider-based sign-in, and JWT session management through NextAuth v4.

AI Message Suggestions

Google Gemini AI generates three open-ended question suggestions on the public send-message page, powered by the @google/genai SDK.

Dashboard Management

Authenticated users can view all received messages, delete individual messages, toggle their accepting-messages status, and copy their shareable link.

Tech Stack

AnonMessage is built on a modern, production-ready set of technologies:
  • Next.js 16 App Router — Server Components, file-based routing, and API Routes under src/app/api/
  • React 19 with TypeScript — Fully typed client and server components, React Hook Form for form state
  • MongoDB + Mongoose — Messages are stored as embedded subdocuments inside the User collection, eliminating extra joins
  • NextAuth v4 (CredentialsProvider, JWT strategy) — Email/password authentication with custom JWT and session callbacks that expose _id, username, isVerified, and isAcceptingMessages to the frontend
  • Google Gemini AI (@google/genai) — The GET /api/suggest-messages route calls ai.models.generateContent with the gemini-1.5-flash model (configurable via GEMINI_MODEL) to produce engagement prompts
  • Zod for schema validationsignUpSchema, signInSchema, messageSchema, and verifySchema enforce input constraints at the form and API boundary
  • Tailwind CSS + shadcn/ui — Utility-first styling with accessible, composable UI primitives
  • Brevo for transactional email — OTP verification emails are sent via the Brevo v3 SMTP API; the OTP document auto-expires after five minutes using a MongoDB TTL index

How the Anonymous Flow Works

  1. A registered user copies their profile link from the dashboard (e.g., https://yourapp.com/u/alice).
  2. They share the link anywhere — social media, a bio, a website.
  3. A visitor opens the link and lands on the public send-message page. No account is required.
  4. The visitor types a message (optionally using an AI-generated suggestion) and clicks Send.
  5. The message is stored as an embedded document in the recipient’s User record in MongoDB.
  6. The recipient sees the new message in their dashboard the next time they refresh or trigger a manual refresh.

The Dashboard

The dashboard at /dashboard is a protected route. Middleware redirects unauthenticated visitors to /sign-in. Only the account owner — verified via a NextAuth JWT session — can read, manage, or delete their messages. Senders never see the dashboard and their identity is never recorded.

Build docs developers (and LLMs) love