Enigma is a full-stack web application that allows users to receive anonymous messages through a public profile link. Built using Next.js 14 (App Router), MongoDB, and NextAuth, it provides a secure and elegant way to interact with others without revealing identity.
- ✅ User authentication via NextAuth.js (Credentials Provider)
- 📨 Send anonymous messages through a
/u/[username]public page - 📬 View received messages on a private
/dashboard - 🚫 Toggle "Accepting Messages" setting
- 🔁 Live message refresh on dashboard
- ✅ Server-side session and secure JWT handling
- 🧪 Validated forms using Zod + React Hook Form
- 🔔 Toast feedback system using shadcn/ui
| Layer | Tech |
|---|---|
| Framework | Next.js 14 (App Router) |
| Backend | API Routes (Server Actions) |
| Database | MongoDB with Mongoose |
| Authentication | next-auth (JWT-based sessions) |
| UI/Styling | Tailwind CSS + shadcn/ui |
| Forms | React Hook Form + Zod |
| Notifications | use-toast hook |
git clone https://github.com/yourusername/enigma.git
cd enigmanpm install
# or
yarn installCreate a .env.local file and add the following:
MONGODB_URI=<your-mongodb-connection-uri>
NEXTAUTH_SECRET=<your-nextauth-secret>
RESEND_API_KEY=<your-resendAPI-key>
NEXTAUTH_URL=http://localhost:3000npm run devsrc/
├── app/
│ ├── api/ # API routes
│ ├── (app)/ # Authenticated user dashboard
│ └── u/[username]/ # Public anonymous message form
| └── (auth) # sign-in/sign-up pages for routing
├── components/ # UI components
├── lib/ # DB connection helpers
├── model/ # Mongoose models
├── hooks/ # Custom hooks (e.g., use-toast)
├── schemas/ # Zod schemas for validation
├── helper/ # verification email srtucture using resend
├── context/ # Authprovider using next-auth
└── types/ # API response