Skip to content

A mystery message web application that allows users to receive anonymous feedback through a secure and personalized link.

Notifications You must be signed in to change notification settings

swayamyadav05/SecretDrop

Repository files navigation

πŸ•΅οΈ SecretDrop - Anonymous Message Platform

Next.js TypeScript MongoDB NextAuth Tailwind

SecretDrop is a modern, anonymous messaging platform built with Next.js 15 that allows users to receive honest feedback and messages without revealing the sender's identity. Perfect for creating a safe space for anonymous communication, feedback collection, and honest conversations.

Why ?

Honest feedback is rare because people hold back when their names are attached β€” fear of awkwardness, backlash, or consequences. Many β€œanonymous” tools promise secrecy but leak metadata, allow deanonymization, or turn into noisy, hostile forums. I built SecretDrop to be radically simple and reliable: a shareable public link that only delivers messages β€” no sender details, no unmasking, no guessing. The recipient can share their public link on there bio, profile, etc. and can get the honest feedbacks from people. The recipient’s can control toggle: turn message receiving on or off. If your profile is open, senders can send anonymous notes; if it’s closed, they can’t.

To help senders phrase useful feedback (without revealing who they are), the public message page includes optional AI-powered suggestions and conversation starters. This helps people write clearer, kinder, or more constructive messages while keeping their identity completely hidden β€” SecretDrop never exposes sender metadata. Combined with secure account practices (OTP email verification, hashed passwords, session tokens), SecretDrop gives creators, teachers, teams, and anyone who wants candid input a quiet, dependable channel for unfiltered feedback.

✨ Features

πŸ” Authentication & Security

  • Secure User Authentication with NextAuth.js and JWT
  • Email Verification system with OTP codes
  • Password Hashing using bcryptjs
  • Username Uniqueness validation
  • Session Management with secure tokens

πŸ’¬ Anonymous Messaging

  • Anonymous Message Sending - Users can send messages without revealing identity
  • Message Management - Mark messages as read/unread
  • Message Deletion - Users can delete received messages
  • Real-time Message Status - Track message delivery and read status

πŸ€– AI-Powered Features

  • AI Message Suggestions using Google Gemini AI
  • Smart Conversation Starters to encourage meaningful communication
  • Dynamic Content Generation for better user engagement

πŸ‘€ User Experience

  • Public Profile Pages - Shareable links for receiving anonymous messages
  • Dashboard with message overview and management
  • Message Acceptance Toggle - Control when can receive messages
  • Responsive Design - Works seamlessly on all devices

🎨 Modern UI/UX

  • Beautiful Animations with custom CSS animations
  • Gradient Themes and modern design patterns
  • Component-based UI using Radix UI and shadcn/ui
  • Form Validation with Zod schemas
  • Toast Notifications for user feedback

βš™οΈ Configuration & Customization

  • Environment-based Configuration - Easy setup with .env.example template
  • Customizable Email Branding - Personalize sender name and subject lines
  • Flexible App Branding - White-label ready with configurable app name
  • Production-ready Deployment - Optimized for Vercel with proper environment handling

πŸ› οΈ Tech Stack

Frontend

  • Next.js 15 - React framework with App Router
  • React 19 - Latest React with modern features
  • TypeScript - Type-safe development
  • Tailwind CSS 4 - Utility-first CSS framework
  • shadcn/ui - Modern component library
  • Radix UI - Accessible component primitives

Backend

  • Next.js API Routes - Serverless API endpoints
  • MongoDB - NoSQL database with Mongoose ODM
  • NextAuth.js - Authentication library
  • Zod - Schema validation

AI & Communication

  • Google Gemini AI - AI-powered message suggestions
  • Resend - Email delivery service
  • React Email - Email template system

Developer Tools

  • ESLint - Code linting
  • TypeScript - Static type checking
  • Turbopack - Fast bundler for development

πŸš€ Getting Started

Prerequisites

  • Node.js 18+ installed
  • MongoDB database (local or cloud)
  • Email service account (Resend)
  • Google AI API key (for suggestions feature)

Installation

  1. Clone the repository
git clone https://github.com/swayamyadav05/SecretDrop.git
cd SecretDrop
  1. Install dependencies
npm install
  1. Set up environment variables Copy the example file and configure your values:

    cp .env.example .env.local

    Or create a .env.local file manually with the following configuration:

# Database
MONGODB_URI=mongodb://localhost:27017/secretdrop
# or for MongoDB Atlas:
# MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/secretdrop

# NextAuth Configuration
NEXTAUTH_SECRET=your-secret-key-here
NEXTAUTH_URL=http://localhost:3000

# Email Service (Resend)
RESEND_API_KEY=your-resend-api-key

# Email Configuration (Optional - will use defaults if not set)
EMAIL_FROM="SecretDrop <noreply@your-domain.com>"
EMAIL_SUBJECT="SecretDrop Verification Code"

# AI Service (Google Gemini)
GOOGLE_GENERATIVE_AI_API_KEY=your-google-ai-api-key

# Application Branding (Optional)
APP_NAME="SecretDrop"
  1. Run the development server
npm run dev
  1. Open your browser Navigate to http://localhost:3000

πŸ“ Project Structure

mystery-message/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                    # Next.js App Router
β”‚   β”‚   β”œβ”€β”€ (app)/             # Main app routes
β”‚   β”‚   β”‚   β”œβ”€β”€ dashboard/     # User dashboard
β”‚   β”‚   β”‚   └── page.tsx       # Landing page
β”‚   β”‚   β”œβ”€β”€ (auth)/            # Authentication routes
β”‚   β”‚   β”‚   β”œβ”€β”€ sign-in/       # Login page
β”‚   β”‚   β”‚   β”œβ”€β”€ sign-up/       # Registration page
β”‚   β”‚   β”‚   └── verify/        # Email verification
β”‚   β”‚   β”œβ”€β”€ api/               # API routes
β”‚   β”‚   β”‚   β”œβ”€β”€ auth/          # NextAuth configuration
β”‚   β”‚   β”‚   β”œβ”€β”€ send-message/  # Message sending
β”‚   β”‚   β”‚   β”œβ”€β”€ get-messages/  # Message retrieval
β”‚   β”‚   β”‚   β”œβ”€β”€ suggest-messages/ # AI suggestions
β”‚   β”‚   β”‚   └── ...            # Other API endpoints
β”‚   β”‚   └── u/[username]/      # Public profile pages
β”‚   β”œβ”€β”€ components/            # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ ui/               # shadcn/ui components
β”‚   β”‚   β”œβ”€β”€ MessageCard.tsx   # Message display component
β”‚   β”‚   β”œβ”€β”€ Navbar.tsx        # Navigation component
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ lib/                  # Utility libraries
β”‚   β”‚   β”œβ”€β”€ dbConnect.ts      # Database connection
β”‚   β”‚   β”œβ”€β”€ resend.ts         # Email service
β”‚   β”‚   └── utils.ts          # Helper functions
β”‚   β”œβ”€β”€ model/                # Database models
β”‚   β”‚   └── User.ts           # User and Message schemas
β”‚   β”œβ”€β”€ schemas/              # Zod validation schemas
β”‚   β”œβ”€β”€ types/                # TypeScript type definitions
β”‚   └── helpers/              # Helper functions
β”œβ”€β”€ emails/                   # Email templates
β”œβ”€β”€ public/                   # Static assets
β”œβ”€β”€ .env.example              # Environment variables template
└── vercel.json               # Vercel deployment configuration

πŸ”§ Configuration

Database Setup

  1. MongoDB Local: Install MongoDB locally and use mongodb://localhost:27017/secretdrop
  2. MongoDB Atlas: Create a cluster and use the connection string
  3. Models: User model includes username, email, password, verification, and messages

Email Configuration

  1. Sign up for Resend
  2. Get your API key
  3. Configure the sender domain
  4. Add API key to environment variables
  5. Customize email appearance (Optional)

Note: You can use any display name with your verified domain. The domain must be verified in Resend, but the display name and email prefix can be customized.

AI Configuration

  1. Get Google AI API key from Google AI Studio
  2. Add to environment variables
  3. Configure in src/app/api/suggest-messages/route.ts

πŸ“– API Documentation

Authentication Endpoints

  • POST /api/sign-up - User registration
  • POST /api/verify-code - Email verification
  • POST /api/auth/signin - User login
  • GET /api/check-username-unique - Username availability

Message Endpoints

  • POST /api/send-message - Send anonymous message
  • GET /api/get-messages - Retrieve user messages
  • DELETE /api/delete-message/[id] - Delete message
  • PATCH /api/messages/[id]/read - Mark message as read

Feature Endpoints

  • POST /api/suggest-messages - Get AI message suggestions
  • POST /api/accept-message - Toggle message acceptance
  • GET /api/accept-message - Get acceptance status

🎨 UI Components

Core Components

  • MessageCard - Display individual messages with actions
  • ShareLinkCard - Share profile link component
  • Navbar - Navigation with authentication state
  • Brand - Logo and branding component

Form Components

  • Input - Styled input fields with validation
  • Textarea - Multi-line text input
  • Button - Various button styles and states
  • InputOTP - One-time password input

πŸ” Security Features

Authentication

  • JWT-based session management
  • Secure password hashing with bcryptjs
  • Email verification requirement
  • Protected API routes

Data Protection

  • Input validation with Zod schemas
  • SQL injection prevention with Mongoose
  • XSS protection with proper sanitization
  • CSRF protection with NextAuth

Rate Limiting

  • API endpoint protection (configurable)
  • Message sending limits
  • Account creation limits

πŸš€ Deployment

Vercel (Recommended)

  1. Connect your GitHub repository to Vercel
  2. Add environment variables in Vercel dashboard
  3. Deploy automatically on push

Docker Deployment

FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]

Environment Variables for Production

# Core Configuration
MONGODB_URI=your-production-mongodb-uri
NEXTAUTH_SECRET=your-production-secret
NEXTAUTH_URL=https://your-domain.com

# Email Service
RESEND_API_KEY=your-resend-api-key
EMAIL_FROM="SecretDrop <noreply@your-domain.com>"
EMAIL_SUBJECT="SecretDrop Verification Code"

# AI Service
GOOGLE_GENERATIVE_AI_API_KEY=your-google-ai-api-key

# Branding (Optional)
APP_NAME="SecretDrop"

πŸ’‘ Pro Tips for Production:

  • Use a strong, unique NEXTAUTH_SECRET (32+ characters)
  • Set EMAIL_FROM to match your verified domain in Resend
  • Customize EMAIL_SUBJECT for better user experience
  • Consider different APP_NAME for white-labeling

πŸ§ͺ Testing

Development Testing

# Run development server
npm run dev

# Lint code
npm run lint

# Type checking
npx tsc --noEmit

API Testing

Use tools like Postman or Thunder Client to test API endpoints:

  • Authentication flows
  • Message operations
  • AI suggestions
  • User management

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature-name
  5. Submit a pull request

Development Guidelines

  • Follow TypeScript best practices
  • Use Zod for all data validation
  • Implement proper error handling
  • Add comments for complex logic
  • Maintain responsive design

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Next.js Team for the amazing framework
  • shadcn for the beautiful UI components
  • Vercel for hosting and deployment
  • Resend for email delivery service
  • Google for AI capabilities

πŸ“ž Support

  • Documentation: Check this README
  • Issues: Create an issue on GitHub for bugs or feature requests
  • Email: Contact the maintainer for support

Built with ❀️ using Next.js and modern web technologies

⭐ Star this repository if you found it helpful!

About

A mystery message web application that allows users to receive anonymous feedback through a secure and personalized link.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •