Back to Projects
anonymousms
Anonymous feedback platform: register, verify email, share /u/<username>, receive anonymous messages on a protected dashboard. One Next.js monolith in one Docker container.
FrameworkNext.js 16.1.1 (App Router), React 19, TypeScript
AuthNextAuth.js v4, Credentials, JWT sessions
DatabaseMongoDB Atlas + Mongoose
EmailResend + React Email templates
UITailwind v4, shadcn/ui, framer-motion, sonner
FormsReact Hook Form + Zod, Axios
DevOpsDocker, Compose, AWS EC2, Nginx, Cloudflare, Certbot
2 High-level architecture
Layered request path
3 Data model
4 API endpoints
| Method | Endpoint Β· purpose |
|---|---|
| POST | /api/sign-up create user, send OTP |
| POST | /api/verify-code validate OTP |
| GET/POST | /api/auth/[...nextauth] login, JWT |
| POST | /api/send-message anonymous send (rate-limited) |
| GET π | /api/get-messages |
| GET/POST π | /api/acceptmessage toggle accepting |
| DELETE π | /api/delete-message/[id] |
| GET | /api/public-profile accepting status |
| GET | /api/suggest-message 4 random ideas |
| GET | /api/check-username-unique |
π = requires a NextAuth session
5 Authentication flow
6 Workflows
Each diagram is a sequence: solid arrows are requests, dashed arrows are responses, and the glowing dot replays the order.
A Β· Registration and email verification
B Β· Login
C Β· Dashboard and public profile setup
D Β· Sending an anonymous message
E Β· Receiving and managing messages
F Β· Message suggestions
7 DevOps
Production request path
Docker multi-stage build
Compose runs one service web on host port 3000 with restart: unless-stopped and env_file: .env. Atlas allows only EC2_PUBLIC_IP/32.
Deploy and operate
# deploy / update git pull docker compose up -d --build # inspect docker compose ps docker compose logs -f web # nginx + ssl sudo nginx -t && sudo systemctl reload nginx sudo certbot renew --dry-run
8 Security design
| Aspect | Implementation |
|---|---|
| Passwords | bcrypt, salt 10 |
| Sessions | NextAuth JWT, signed cookie |
| Route protection | Middleware plus getServerSession |
| Rate limiting | RateLimit collection per sender email |
| Anonymity | Sender email never stored on a message |
| Email verification | 6-digit OTP, 1 hour; login blocked until verified |
| CORS | Same-origin calls, not configured |