A comprehensive Next.js-based voting platform with real-time vote management, automated launch cycles, and a powerful admin dashboard.
- Frontend: Next.js with TypeScript and Tailwind CSS
- Backend: Next.js API Routes with MongoDB and Redis
- Authentication: NextAuth.js with credential-based login
- Caching: Redis for real-time votes, MongoDB for persistence
- Automation: Single daily cron job for launch management
- Admin Panel: Comprehensive management interface
- Real-time Voting: Fast Redis-based vote storage
- Automated Launch Management: Daily cycle with atomic operations
- Admin Dashboard: Complete system monitoring and control
- Vote Flushing: Automatic transfer from Redis to MongoDB
- Cache Revalidation: Automatic cache updates after operations
- Manual Controls: Admin override capabilities
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx
. The page auto-updates as you edit the file.
This project uses next/font
to automatically optimize and load Geist, a new font family for Vercel.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
The system uses a single daily cron job for reliable launch management:
Schedule: Daily at 6 AM UTC (0 6 * * *
)
Endpoint: /api/cron/daily-launch-cycle
Operations:
- Flush previous day's votes from Redis to MongoDB
- Create new launch with scheduled apps
- Initialize Redis keys for new voting
- Trigger cache revalidation
- Comprehensive status reporting
Access the admin dashboard at /admin
with the following features:
- Dashboard: System overview and statistics
- Voting: Real-time vote monitoring and manual flush controls
- Launches: Launch history and management
- Apps: Application management with pagination
- Config: System health and environment status
MAIN_MONGODB_URI=your-mongodb-connection-string
MONGODB_DATABASE=basicutils
REDIS_URL=your-redis-connection-string
NEXTAUTH_SECRET=your-nextauth-secret
NEXTAUTH_URL=http://localhost:3000
ADMIN_PASSWORD=your-admin-password
CRON_SECRET=your-cron-secret
CORS_ORIGINS=your-allowed-origins
POST /api/vote
- Submit a voteGET /api/votes/{appId}
- Get vote count
GET /api/admin/launches
- List launchesPOST /api/admin/launches/{date}/flush
- Manual flushGET /api/admin/users
- List users
GET /api/cron/daily-launch-cycle
- Daily launch management
You can check out the Next.js GitHub repository for more information about the framework.
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.