A modern, full-stack Secret Santa application built with Next.js 16, supporting multiple languages and automated email notifications.
π Live Demo
- π Bilingual Support: Full internationalization (English & Portuguese)
- π§ Email Verification: Passwordless authentication with verification codes
- π Smart Lottery: Automated Secret Santa assignment (no one draws themselves)
- π± Easy Invitations: Share via link, WhatsApp, or direct email
- π Owner Dashboard: Track participants and manage groups
- βοΈ Email Tracking: Monitor delivery status (optional)
- π Secure Sessions: Encrypted cookie-based authentication
- π¨ Modern UI: Beautiful interface with Shadcn UI + Tailwind CSS 4
- Node.js 18+ and npm
- MongoDB instance (local or cloud)
- Email provider account (AWS SES or Resend)
-
Clone and install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env.local
Edit
.env.localand fill in:MONGODB_URI: Your MongoDB connection stringSESSION_SECRET: Random 32+ character stringEMAIL_PROVIDER: Eithersesorresend(default:ses)- Email provider credentials (see Email Configuration below)
NEXT_PUBLIC_APP_URL: Your app URL
-
Run the development server:
npm run dev
-
Open your browser:
- English: http://localhost:3000/en
- Portuguese: http://localhost:3000/pt
- Visit the app and click "Get Started"
- Enter your name and email
- Verify your email with the code sent to you
- Create a new group with event details
- Share the invitation link with participants
- Click on the invitation link
- Enter your name and email
- Verify your email with the code
- Wait for the group owner to run the lottery
- As group owner, wait until all participants have joined
- Click "Run Lottery" (minimum 3 participants)
- Everyone receives their assignment via email
- Participants can view their recipient in the dashboard
- Framework: Next.js 16 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS 4 + Shadcn UI
- Database: MongoDB + Mongoose
- Authentication: iron-session (encrypted cookies)
- Email: AWS SES or Resend
- i18n: next-intl
- Form Validation: react-hook-form + Zod
santa/
βββ app/
β βββ [locale]/ # Localized routes
β β βββ get-started/ # Initial signup
β β βββ verify/ # Email verification
β β βββ dashboard/ # User dashboard
β β βββ join/ # Join group
β β βββ group/
β β βββ create/ # Create group
β β βββ [groupId]/
β β βββ dashboard/ # Group management
β βββ api/
β βββ admin-signup/ # Create admin user
β βββ verify/ # Verify email code
β βββ resend-code/ # Resend verification
β βββ group/
β β βββ create/ # Create new group
β β βββ join/ # Join existing group
β β βββ send-invitation/ # Email invitations
β βββ lottery/
β β βββ run/ # Execute lottery
β βββ webhooks/
β βββ ses-notifications/ # Email tracking
βββ lib/
β βββ db/ # Database models
β βββ email/ # Email utilities
β βββ utils/ # Helper functions
β βββ auth.ts # Authentication
β βββ session.ts # Session management
βββ components/ui/ # Shadcn UI components
βββ messages/ # i18n translations
βββ documentation/ # Project docs
Use MongoDB Atlas (cloud) or local instance:
# Local MongoDB
MONGODB_URI=mongodb://localhost:27017/secretsanta
# MongoDB Atlas
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/secretsantaThe app supports two email providers: AWS SES and Resend.
-
Set the email provider in
.env.local:EMAIL_PROVIDER=ses AWS_ACCESS_KEY_ID=your-aws-access-key-id AWS_SECRET_ACCESS_KEY=your-aws-secret-access-key AWS_REGION=us-east-1 AWS_SES_SENDER_EMAIL=noreply@yourdomain.com
-
Follow the AWS Setup Guide for account setup and email verification.
Note: SES starts in sandbox mode (can only send to verified emails). Request production access to send to any email address.
-
Create a Resend account and get your API key
-
Configure in
.env.local:EMAIL_PROVIDER=resend RESEND_API_KEY=re_your_api_key_here RESEND_SENDER_EMAIL=noreply@yourdomain.com
Generate a secure random string:
# macOS/Linux
openssl rand -base64 32
# Or use any random string generatorAWS SES users can enable delivery status tracking by following AWS Setup Guide Part 2. This requires setting up SNS/SQS and adding AWS_SES_NOTIFICATION_QUEUE_URL to .env.local.
- Push your code to GitHub
- Import project in Vercel
- Add environment variables in Vercel dashboard
- Deploy!
Required for all deployments:
MONGODB_URISESSION_SECRETEMAIL_PROVIDER(eithersesorresend)NEXT_PUBLIC_APP_URL
If using AWS SES (EMAIL_PROVIDER=ses):
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_REGIONAWS_SES_SENDER_EMAILAWS_SES_NOTIFICATION_QUEUE_URL(optional, for delivery tracking)WEBHOOK_SECRET(optional, for SES notifications)
If using Resend (EMAIL_PROVIDER=resend):
RESEND_API_KEYRESEND_SENDER_EMAIL
The app can be deployed to any platform supporting Next.js:
- Railway
- Render
- AWS Amplify
- Digital Ocean App Platform
- Sign up as admin user
- Verify email with code
- Create a Secret Santa group
- Copy invitation link
- Join group as another participant (incognito/different browser)
- Verify participant email
- Add at least 3 participants total
- Run lottery as owner
- Check email for assignment
- View assignment in dashboard
- Test resend code functionality
- Test email invitation sending
- Test WhatsApp share link
- Check
EMAIL_PROVIDERis set correctly in.env.local - Verify sender email/domain is verified with your provider
- AWS SES: Check if in sandbox mode (can only send to verified emails)
- Resend: Verify API key is active
- Check application logs for error messages
- Verify MongoDB URI is correct
- Check network access (MongoDB Atlas: whitelist IP)
- Ensure database user has proper permissions
- Verify SESSION_SECRET is set
- Check cookies are enabled in browser
- Try clearing browser cache/cookies
This application has been designed with security best practices in mind. However, please review and follow these guidelines when deploying:
CRITICAL - Must Do:
- Never commit secrets: Ensure
.envis in.gitignoreand use.env.examplefor documentation - Rotate credentials: If this is a fork/clone, generate new credentials for:
SESSION_SECRET(useopenssl rand -base64 32)- MongoDB credentials
- AWS access keys
WEBHOOK_SECRET(if using SQS notifications)
- Check git history: Verify no secrets were accidentally committed
git log --all --full-history -- .env
RECOMMENDED:
- Configure allowed origins: Update
NEXT_PUBLIC_APP_URLin production for CORS - Enable security monitoring: Use GitHub Dependabot for automatic security updates
- Review AWS permissions: Use minimal IAM permissions (SES send only, SQS receive only)
- Use HTTPS: Always deploy with SSL/TLS certificates
- Encrypted sessions: Uses iron-session for tamper-proof authentication
- Input validation: All API endpoints validate input with Zod schemas
- No passwords: Passwordless authentication reduces attack surface
- Security headers: X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy
- CORS protection: API routes restricted to configured origin
- Webhook authentication: Required Bearer token for webhook endpoints
- Rate limiting: Built-in request throttling on sensitive endpoints
Found a security issue? Please see SECURITY.md for responsible disclosure guidelines.
- MongoDB: Use connection string with authentication, restrict network access
- AWS SES: Keep in sandbox mode for testing, request production access only when needed
- Session Secret: Use cryptographically random string, never reuse across environments
- Environment Variables: Never log or expose in error messages
- Dependencies: Regularly update packages to patch known vulnerabilities
Contributions are welcome! Please read our Contributing Guidelines and Code of Conduct before submitting PRs.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests:
npm run check - Commit your changes (
git commit -m 'Add amazing feature') - Push to your branch (
git push origin feature/amazing-feature) - Open a Pull Request
For more details, see CONTRIBUTING.md.
- Bug Reports: Use the bug report template
- Feature Requests: Use the feature request template
- Security Issues: See SECURITY.md for responsible disclosure
If this app made your Secret Santa easier, consider supporting its development:
Your support helps cover hosting costs and keeps this project maintained and free for everyone.
MIT License - see the LICENSE file for details.
Built with β€οΈ using Next.js, TypeScript, and modern web technologies.
