A comprehensive backend for a club website built with Next.js App Router, MongoDB, and NextAuth.
- Authentication: Google OAuth with NextAuth
- Blog System: Create, read, update, delete blog posts with Markdown support
- Project Showcase: Manage and display club projects
- Event Management: Create events with RSVP functionality and ticket generation
- Gallery: Upload and organize event photos
- Podcast Management: Embed YouTube videos
- Admin Panel: Role-based access control for content management
- Framework: Next.js 15 with App Router
- Database: MongoDB with Mongoose ODM
- Authentication: NextAuth with Google Provider
- Validation: Zod for schema validation
- File Upload: Cloudinary integration ready
- PDF Generation: PDFKit for ticket generation
- QR Codes: QRCode library for ticket verification
- Node.js 18+
- MongoDB database
- Google OAuth credentials
- Cloudinary account (optional)
-
Clone the repository
-
Install dependencies: ```bash npm install ```
-
Set up environment variables in `.env.local`: ```env MONGODB_URI=your_mongodb_connection_string NEXTAUTH_URL=http://localhost:3000 NEXTAUTH_SECRET=your_nextauth_secret GOOGLE_CLIENT_ID=your_google_client_id GOOGLE_CLIENT_SECRET=your_google_client_secret ADMIN_EMAILS=[email protected],[email protected] ```
-
Run the development server: ```bash npm run dev ```
- `GET /api/blogs` - Get published blogs
- `GET /api/blogs/[id]` - Get specific blog
- `GET /api/projects` - Get all projects
- `GET /api/events` - Get all events
- `GET /api/gallery` - Get gallery items
- `GET /api/podcasts` - Get podcast episodes
- `POST /api/rsvp` - Create RSVP for event
- `GET /api/rsvp` - Get user's RSVPs
- `GET /api/rsvp/[id]/ticket` - Download ticket PDF
- `POST /api/blogs` - Create blog post
- `PUT /api/blogs/[id]` - Update blog post
- `DELETE /api/blogs/[id]` - Delete blog post
- `POST /api/projects` - Create project
- `POST /api/events` - Create event
- `POST /api/gallery` - Create gallery
- `POST /api/podcasts` - Create podcast
- `GET /api/admin/stats` - Get admin dashboard stats
- `GET /api/admin/events/[id]/rsvps` - Get event RSVPs
- Email, name, image, role (admin/user)
- Google OAuth integration
- Title, slug, content (Markdown), excerpt
- Author reference, published status, tags
- Title, description, tech stack
- GitHub/live URLs, featured status
- Title, description, date, venue
- RSVP functionality, max attendees
- Event and user references
- Status (attending/not_attending/maybe)
- Unique ticket ID
- Event name, date, images with captions
- Admin-managed photo collections
- YouTube URL integration
- Auto-extracted video ID and thumbnail
- Google OAuth via NextAuth
- Role-based access (admin/user)
- Admin emails configured via environment variables
- Protected routes with middleware
- Session-based authentication
- Markdown content support
- SEO-friendly slugs
- Draft/published states
- Tag system
- RSVP system with status tracking
- PDF ticket generation with QR codes
- RSVP deadline enforcement
- Admin RSVP management
- Cloudinary integration prepared
- Image validation and processing
- Gallery photo management
- Comprehensive statistics
- Content management interface
- User RSVP tracking
- Role-based permissions
- Environment variable protection
- Input validation with Zod
- Role-based route protection
- Session-based authentication
- CORS and security headers
Ready for deployment on Vercel, Netlify, or any Node.js hosting platform. Ensure all environment variables are configured in your deployment environment.