A full-stack anonymous feedback messaging platform built with Next.js, TypeScript, MongoDB, NextAuth, OpenAI, and Resend.
Users can create accounts, share their public profile links, receive anonymous messages, manage messages, and use AI-powered suggestions to generate conversation starters.
Live Application: https://feedback-ai-nextjs-ruby.vercel.app/
- User registration
- Email verification using OTP
- Secure password hashing with bcrypt
- Login using username or email
- JWT-based authentication with NextAuth
- Generate a public profile link
- Receive anonymous messages
- View received messages
- Delete messages
- Control whether users can send messages
- AI-generated anonymous question suggestions
- Powered by OpenAI API
- Verification emails
- OTP-based account verification
- Resend email service integration
- Responsive design
- Tailwind CSS styling
- Shadcn UI components
- Toast notifications
- Form validation
- Next.js 16
- React 19
- TypeScript
- Tailwind CSS
- Shadcn UI
- React Hook Form
- Zod Validation
- Axios
- Next.js App Router API Routes
- MongoDB
- Mongoose
- NextAuth.js
- bcryptjs
- OpenAI API
- Resend Email API
mstrymessage
β
βββ src
β β
β βββ app
β β βββ api
β β β βββ auth
β β β βββ register
β β β βββ verify-code
β β β βββ send-message
β β β βββ delete-message
β β β βββ get-messages
β β β βββ accept-messages
β β β βββ suggest-messages
β β β
β β βββ dashboard
β β βββ sign-in
β β βββ sign-up
β β βββ verify
β β
β βββ components
β β βββ ui
β β βββ Navbar.tsx
β β βββ MessageCard.tsx
β β
β βββ context
β β βββ AuthProvider.tsx
β β
β βββ helpers
β β βββ sendVerificationEmail.ts
β β
β βββ lib
β β βββ dbConnect.ts
β β βββ resend.ts
β β
β βββ model
β β βββ User.ts
β β
β βββ schemas
β β βββ signUpSchema.ts
β β βββ signInSchema.ts
β β βββ messageSchema.ts
β β βββ verifySchema.ts
β β
β βββ types
β βββ ApiResponse.ts
β
βββ .env.local
βββ package.json
βββ tsconfig.json
βββ README.md
Clone the repository:
git clone <your-repository-url>Move into project folder:
cd mstrymessageInstall dependencies:
npm installCreate a file:
.env.local
Add:
NEXTAUTH_URL=http://localhost:3000
MONGODB_URI=your_mongodb_connection_string
NEXTAUTH_SECRET=your_nextauth_secret
RESEND_API_KEY=your_resend_api_key
OPENAI_API_KEY=your_openai_api_keyThis project uses MongoDB.
You can use:
- MongoDB Local
- MongoDB Atlas
Example local connection:
MONGODB_URI=mongodb://localhost:27017/mstrymessageThe application automatically creates the required collections.
Start development:
npm run devOpen:
http://localhost:3000
Create production build:
npm run buildStart production server:
npm start-
User enters:
- Username
- Password
-
Password is hashed using bcrypt.
-
Verification OTP is generated.
-
OTP is sent using Resend.
User enters OTP.
The server checks:
- Verification code
- Expiry time
After successful verification:
isVerified = true
Users can login using:
- Username
NextAuth creates a JWT session.
POST /api/register
Creates a new user.
POST /api/verify-code
Verifies OTP.
POST /api/auth/[...nextauth]
Handles authentication.
POST /api/send-message
Body:
{
"username": "example",
"content": "Your message"
}GET /api/get-messages
Returns authenticated user's messages.
DELETE /api/delete-message/:messageid
Deletes a message.
POST /api/accept-messages
Updates whether the user accepts messages.
POST /api/suggest-messages
Generates anonymous question suggestions using OpenAI.
The application uses:
OpenAI Responses API
to generate:
- Friendly questions
- Anonymous conversation starters
- Feedback prompts
Email service:
Resend
Features:
- OTP generation
- Verification emails
- Account activation
Implemented:
- Password hashing
- JWT authentication
- Protected API routes
- Input validation using Zod
- MongoDB validation
- Environment variables
Recommended before production:
- Add API rate limiting
- Add CAPTCHA for signup
- Rotate exposed API keys
- Enable HTTPS
Recommended platforms:
- Vercel (Frontend + API)
- MongoDB Atlas (Database)
- Resend (Email)
Before deployment:
Update:
NEXTAUTH_URL=https://your-domain.comPossible upgrades:
- Real-time messaging
- User profile customization
- Message reactions
- Image attachments
- Admin dashboard
- Analytics
- Push notifications
Satyam Kumar
This project is licensed under the MIT License.