A full-stack web application for planning and managing personalized pranks. Built with Next.js and Express.js, featuring a modern UI, secure authentication, comprehensive prank planning wizard, and admin dashboard.
- Prank Planning Wizard - Multi-step form to create personalized prank plans with comprehensive target information
- Prank Management - View, manage, and track all your prank submissions
- User Dashboard - Personalized home page with quick access to features
- Profile Management - View and manage your account information
- Admin Dashboard - Comprehensive admin panel for managing users and pranks
- User management (view, delete users)
- Prank management (view details, delete pranks)
- Statistics dashboard (user counts, prank counts, recent activity)
- Pagination support for large datasets
- Planner Information: Name, phone, email
- Target Information:
- Name, age, phone (required), email
- Relationship, gender, location
- Personality types (multi-select)
- Prank Details: Type selection, additional information
- Form Persistence: Auto-saves progress to local storage
- Validation: Real-time form validation with error messages
- β User Registration with email validation
- β Secure Login with JWT tokens
- β Password Reset via email
- β Google OAuth integration
- β Protected routes and API endpoints
- β Admin role-based access control
- β Password strength indicator
- β Session management with MongoDB store
- β Rate limiting on API endpoints
- β Input sanitization and validation
- β Security headers (Helmet)
- β CORS configuration
- β Environment variable validation
- Modern, responsive design with Tailwind CSS v4
- Dark theme with glassmorphism effects
- Smooth animations and transitions (GSAP)
- Interactive 3D background (Three.js Ballpit component)
- Mobile-first responsive layout
- Mobile Optimizations:
- Prevents unwanted zoom on input focus
- Minimum 16px font size for inputs
- Touch-friendly interface
- Accessible components (ARIA labels, keyboard navigation)
- Toast notifications for user feedback
- Loading states and error handling
- Error boundaries for graceful error handling
- Custom favicon with brand logo
- TypeScript for type safety
- Error boundaries and centralized error handling
- Structured logging
- Environment variable validation
- Docker support with multi-stage builds
- CI/CD with GitHub Actions
- SEO optimized (sitemap, robots.txt, metadata, structured data)
- Performance optimizations (code splitting, lazy loading, image optimization)
- Health check endpoints for monitoring
- Keep-alive workflow for free tier hosting
- Framework: Next.js 16 (App Router)
- UI Library: React 19
- Language: TypeScript
- Styling: Tailwind CSS v4
- State Management: React Context API
- HTTP Client: Axios
- Animations: GSAP, Three.js (Ballpit component)
- Form Management: Local storage persistence
- Framework: Express.js
- Language: TypeScript
- Database: MongoDB with Mongoose
- Authentication: JWT, Passport.js (Google OAuth)
- Security: Helmet, CORS, bcrypt, express-rate-limit
- Email: Nodemailer, SendGrid support
- Session: express-session with MongoDB store (connect-mongo)
- Validation: Custom validators with express-validator patterns
- Frontend Hosting: Netlify
- Backend Hosting: Render
- Containerization: Docker & Docker Compose
- CI/CD: GitHub Actions
- Automated linting (ESLint)
- Type checking
- Build verification
- Security audits
- Keep-alive workflow for backend
- Node.js 20.9.0 or higher
- npm 9.0.0 or higher
- MongoDB (local or MongoDB Atlas)
git clone <your-repo-url>
cd BaseProject_Nextjs_LoginSignup-main# Backend
cd backend
npm install
# Frontend
cd ../frontend
npm installBackend - Create backend/.env:
Option 1 - Automated setup (Recommended):
cd backend
npm run setup:env
# Then edit the created .env file with your valuesOption 2 - Manual setup:
cd backend
cp env.example .env # On Windows: copy env.example .envRequired Backend Variables:
# Database (REQUIRED)
MONGODB_URI=mongodb://localhost:27017/prank-wizard
# Or for MongoDB Atlas: mongodb+srv://user:pass@cluster.mongodb.net/prank-wizard
# JWT & Session (REQUIRED)
JWT_SECRET=your-secret-key-min-32-characters # Generate: openssl rand -base64 32
SESSION_SECRET=your-session-secret-min-32-characters # Generate: openssl rand -base64 32
# Frontend URL (REQUIRED)
FRONTEND_URL=http://localhost:3000
# Server Configuration (OPTIONAL)
PORT=5000
NODE_ENV=development
JWT_EXPIRES_IN=7d
# Google OAuth (OPTIONAL)
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
GOOGLE_CALLBACK_URL=http://localhost:5000/api/auth/google/callback
# Email Configuration (OPTIONAL - for password reset)
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your-email@gmail.com
EMAIL_PASS=your-app-password
EMAIL_FROM=noreply@yourapp.com
# SendGrid (OPTIONAL - alternative to SMTP)
SENDGRID_API_KEY=your-sendgrid-api-key
# Admin Configuration (OPTIONAL)
# Comma-separated list of admin emails
# Defaults to: gauravkhandelwal205@gmail.com,ananykoranne0@gmail.com
ADMIN_EMAILS=gauravkhandelwal205@gmail.com,ananykoranne0@gmail.comFrontend - Create frontend/.env.local:
# API Configuration (REQUIRED)
NEXT_PUBLIC_API_URL=http://localhost:5000
# Site URL (REQUIRED)
NEXT_PUBLIC_SITE_URL=http://localhost:3000
# Discord Invite Link (OPTIONAL - for success page)
NEXT_PUBLIC_DISCORD_INVITE_LINK=https://discord.gg/your-invite-link# Terminal 1 - Backend
cd backend
npm run dev
# Terminal 2 - Frontend
cd frontend
npm run devVisit http://localhost:3000 to see the application.
βββ frontend/ # Next.js frontend application
β βββ app/ # Next.js App Router pages
β β βββ page.tsx # Landing page with Ballpit animation
β β βββ layout.tsx # Root layout with metadata & fonts
β β βββ login/ # Login page
β β βββ signup/ # Signup page
β β βββ home/ # Protected dashboard
β β βββ profile/ # User profile
β β βββ admin/ # Admin dashboard (protected)
β β βββ prank-wizard/ # Prank planning wizard
β β β βββ page.tsx # Multi-step form
β β β βββ success/ # Success page with Discord link
β β βββ pranks/ # Prank management pages
β β β βββ page.tsx # List all pranks
β β β βββ [id]/ # Individual prank details
β β βββ forgot-password/ # Password reset request
β β βββ reset-password/ # Password reset form
β β βββ auth/ # OAuth callback
β β βββ favicon.ico # Brand favicon
β β βββ sitemap.ts # Dynamic sitemap
β β βββ robots.ts # Robots.txt generator
β βββ components/ # Reusable React components
β β βββ ui/ # UI components (Button, Input, etc.)
β β βββ PrankWizard/ # Wizard-specific components
β β β βββ ProgressBar.tsx
β β β βββ MultiSelectPills.tsx
β β β βββ RadioButtonGroup.tsx
β β β βββ Mascot.tsx
β β βββ Navbar.tsx # Navigation component
β β βββ Ballpit.tsx # Three.js interactive background
β β βββ ErrorBoundary.tsx # Error boundary component
β β βββ ToastProvider.tsx # Toast notification system
β β βββ ProtectedRoute.tsx # Route protection
β β βββ AdminRoute.tsx # Admin-only route protection
β βββ contexts/ # React contexts
β β βββ AuthContext.tsx # Authentication state management
β βββ lib/ # Utilities & API clients
β β βββ api-client.ts # Base API client
β β βββ auth-api.ts # Authentication API
β β βββ prank-api.ts # Prank API
β β βββ admin-api.ts # Admin API
β β βββ constants/ # Constants and defaults
β β β βββ form.ts # Form data structure
β β β βββ prank.ts # Prank types and personalities
β β βββ utils/ # Utility functions
β βββ types/ # TypeScript type definitions
β
βββ backend/ # Express.js backend API
β βββ src/
β βββ index.ts # Main entry point
β βββ models/ # Mongoose models
β β βββ User.ts # User model
β β βββ Prank.ts # Prank model
β βββ routes/ # API routes
β β βββ index.ts # Route aggregator
β β βββ auth.ts # Authentication routes
β β βββ pranks.ts # Prank routes
β β βββ admin.ts # Admin routes
β βββ services/ # Business logic services
β β βββ authService.ts
β β βββ prankService.ts
β β βββ tokenService.ts
β β βββ emailService.ts
β βββ middleware/ # Express middleware
β β βββ auth.ts # Authentication middleware
β β βββ admin.ts # Admin authorization
β β βββ errorHandler.ts # Error handling
β β βββ rateLimiter.ts # Rate limiting
β β βββ sanitize.ts # Input sanitization
β β βββ requestId.ts # Request ID tracking
β β βββ monitoring.ts # Request monitoring
β β βββ notFound.ts # 404 handler
β βββ config/ # Configuration
β β βββ index.ts # Environment config
β β βββ database.ts # MongoDB connection
β β βββ passport.ts # Passport.js setup
β βββ validators/ # Input validation
β β βββ authValidator.ts
β β βββ prankValidator.ts
β βββ types/ # TypeScript types
β β βββ errors.ts
β β βββ prank.ts
β βββ utils/ # Utilities
β βββ logger.ts
β βββ env-validator.ts
β
βββ .github/
β βββ workflows/
β βββ ci.yml # CI/CD pipeline
β βββ keep-alive.yml # Backend keep-alive
βββ docs/ # Documentation
βββ docker-compose.yml # Docker Compose configuration
βββ Dockerfile # Multi-stage Docker build
βββ netlify.toml # Netlify deployment config
βββ render.yaml # Render deployment config
- Setup Guide - Detailed setup instructions
- Quick Deploy - Fast deployment checklist
- Deployment Guide - Complete Netlify + Render deployment
- Production Deployment - Production deployment best practices
- Project Structure - Detailed project organization
- Production Checklist - Pre-deployment checklist
- Auth Setup - Authentication configuration
- Google OAuth - Google OAuth setup
- Email Services - Email configuration
POST /api/auth/register- Register new userPOST /api/auth/login- User loginPOST /api/auth/forgot-password- Request password resetPOST /api/auth/reset-password- Reset password with tokenGET /api/auth/me- Get current user (protected)GET /api/auth/google- Google OAuth initiationGET /api/auth/google/callback- Google OAuth callbackPOST /api/auth/logout- Logout user
POST /api/pranks- Create new prank plan (protected)GET /api/pranks- Get all user's pranks (protected)GET /api/pranks/:id- Get prank details (protected)
GET /api/admin/stats- Get dashboard statisticsGET /api/admin/users- Get all users (paginated)GET /api/admin/users/:id- Get user by IDDELETE /api/admin/users/:id- Delete userGET /api/admin/pranks- Get all pranks (paginated)GET /api/admin/pranks/:id- Get prank by IDDELETE /api/admin/pranks/:id- Delete prank
GET /health- Health check endpoint (always returns 200)
- Landing Page (
/) β Marketing page with hero section and interactive Ballpit background - Sign Up (
/signup) β Create new account - Login (
/login) β Authenticate user - Home (
/home) β Protected dashboard - Prank Wizard (
/prank-wizard) β Multi-step prank planning form- Step 1: Your Information
- Step 2: Target's Information (name, age, phone, email, relationship, gender, location)
- Step 3: Personality & Prank Type
- Step 4: Additional Details
- Success Page (
/prank-wizard/success) β Confirmation with Discord invite link - My Pranks (
/pranks) β View all prank submissions - Prank Details (
/pranks/:id) β View detailed prank information - Profile (
/profile) β User profile and settings - Admin Dashboard (
/admin) β Admin-only management panel
# Build and start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down# Backend only
docker build -t prank-wizard-backend --target backend-prod .
docker run -p 5000:5000 --env-file backend/.env prank-wizard-backend
# Frontend only
docker build -t prank-wizard-frontend --target frontend-prod .
docker run -p 3000:3000 --env-file frontend/.env.local prank-wizard-frontendSee DEPLOYMENT_NETLIFY_RENDER.md for complete instructions.
Quick Steps:
- Deploy backend to Render (see
render.yaml) - Deploy frontend to Netlify (see
netlify.toml) - Configure environment variables in both platforms
- Set up MongoDB Atlas
- Update CORS settings in backend
- Configure GitHub Actions secrets for keep-alive workflow
# Backend tests
cd backend
npm test
# Frontend tests
cd frontend
npm test
# Run all tests
npm test --workspacesnpm run dev # Start development server with hot reload
npm run build # Build for production
npm start # Start production server
npm run lint # Run ESLint
npm run lint:fix # Fix linting issues automatically
npm test # Run tests
npm run type-check # TypeScript type checking
npm run setup:env # Generate .env file from templatenpm run dev # Start development server
npm run build # Build for production
npm start # Start production server
npm run lint # Run ESLint
npm run lint:fix # Fix linting issues automatically
npm test # Run tests
npm run type-check # TypeScript type checking- JWT-based authentication with secure token storage
- Password hashing with bcrypt (10 rounds)
- Rate limiting on API endpoints (prevents brute force)
- Input sanitization (XSS prevention)
- CORS configuration (production-ready)
- Security headers (Helmet)
- XSS protection
- CSRF protection via SameSite cookies
- SQL injection prevention (NoSQL injection protection)
- Environment variable validation
- Admin role-based access control
- Request ID tracking for debugging
- Error message sanitization in production
- Next.js Image Optimization
- Code splitting and lazy loading
- Font optimization (reduced weights, preload critical fonts)
- Compression middleware
- MongoDB connection pooling
- Caching strategies
- CDN-ready static assets
- Deferred loading of non-critical components (Ballpit)
- Webpack optimizations
- Package import optimizations (axios, three, gsap)
- Production source maps disabled for smaller bundles
The project includes a comprehensive GitHub Actions workflow:
- Linting: ESLint for both frontend and backend
- Type Checking: TypeScript compilation checks
- Build Verification: Ensures production builds succeed
- Security Audit: npm audit for dependency vulnerabilities
- CI Pipeline (
.github/workflows/ci.yml): Runs on push/PR to main/develop - Keep-Alive (
.github/workflows/keep-alive.yml): Pings backend every 14 minutes to prevent free tier spin-down
- Backend build requires:
MONGODB_URI,JWT_SECRET,FRONTEND_URL,SESSION_SECRET,ADMIN_EMAILS - Frontend build requires:
NEXT_PUBLIC_API_URL,NEXT_PUBLIC_DISCORD_INVITE_LINK
- Fixed unwanted zoom on input focus
- Enforced minimum 16px font size for all inputs
- Disabled user scaling in viewport meta tag
- Touch-friendly interface
- Admin dashboard with statistics
- User management (view, delete)
- Prank management (view details, delete)
- Pagination for large datasets
- Modal for detailed prank information
- Brand favicon in browser tab
- Discord invite link on success page
- Form data persistence in local storage
- Enhanced error messages
- Improved loading states
- Optimized font loading
- Reduced bundle sizes
- Improved Lighthouse scores
- Better code splitting
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE file for details.
- Next.js team for the amazing framework
- Express.js for the robust backend framework
- MongoDB for the flexible database
- All open-source contributors
For issues, questions, or contributions, please open an issue on GitHub.
Built with β€οΈ using Next.js, Express.js, and TypeScript