A Next.js application that provides role-based notification functionality integrated with Whop API. Users can create roles, subscribe to them, and receive notifications when those roles are pinged.
- Admin Interface: Create and manage roles with custom names, descriptions, and colors
- Role Subscription: Users can subscribe/unsubscribe to roles with a single click
- Real-time Updates: Instant updates when roles are created or subscriptions change
- Role-based Pings: Admins can send notifications to all subscribers of a specific role
- Instant Delivery: Notifications are sent immediately to all subscribed users
- Notification History: Track all sent notifications with timestamps
- Whop Integration: Seamless authentication using Whop API
- User Profiles: Display user avatars, names, and subscription status
- Admin Permissions: Role-based access control for admin functions
- Material-UI Design: Beautiful, responsive interface using MUI components
- Real-time Feedback: Success/error messages with snackbar notifications
- Intuitive Navigation: Easy-to-use interface for all user types
- Frontend: Next.js 15, React, TypeScript
- UI Framework: Material-UI (MUI)
- Backend: Next.js API routes
- Database: MongoDB with Mongoose
- Authentication: Whop SDK integration
- Styling: Tailwind CSS + MUI
npm installCreate a .env.local file in the root directory with the following variables:
# Whop API Credentials
WHOP_API_KEY=your_whop_api_key
NEXT_PUBLIC_WHOP_APP_ID=your_app_id
NEXT_PUBLIC_WHOP_AGENT_USER_ID=your_agent_user_id
NEXT_PUBLIC_WHOP_COMPANY_ID=your_company_id
# Database Configuration
MONGO_URI=your_mongodb_connection_string
MONGO_DB=reaction_bot_db
# App Configuration
NEXT_PUBLIC_APP_URL=http://localhost:3000npm run devNavigate to http://localhost:3000
{
companyId: string;
userId: string;
username: string;
name: string;
avatarUrl?: string;
subscribedRoles: string[];
isAdmin: boolean;
createdAt: Date;
updatedAt: Date;
}{
companyId: string;
name: string;
description?: string;
color?: string;
subscribers: string[];
createdAt: Date;
updatedAt: Date;
}{
companyId: string;
roleName: string;
message: string;
sentBy: string;
sentTo: string[];
createdAt: Date;
}GET /api/auth/verify- Verify user token with Whop
GET /api/roles- Get all roles (admin only)POST /api/roles- Create new role (admin only)
POST /api/subscribe- Subscribe/unsubscribe to a role
POST /api/notify- Send notification to role subscribers (admin only)
- Create Roles: Click "Create New Role" button to add new roles like @flips, @green, @yellow
- Send Notifications: Click "Notify" button on any role card to send messages to all subscribers
- Manage Users: View user subscription status and manage role assignments
- Subscribe to Roles: Click "Subscribe" button on role cards to join notification lists
- View Subscriptions: See all your subscribed roles in the "Your Subscribed Roles" section
- Unsubscribe: Click on subscribed role chips to unsubscribe
To create roles like @flips, @green, @yellow:
- Login as admin
- Click "Create New Role"
- Enter role name (e.g., "flips")
- Add description (optional)
- Choose color
- Click "Create Role"
- Admin creates a role (e.g., @flips)
- Users subscribe to the role by clicking "Subscribe"
- Admin clicks "Notify" on the role card
- Admin types a message and sends it
- All subscribers receive the notification instantly
-
Build the application:
npm run build
-
Deploy to your preferred platform (Vercel, Netlify, etc.)
-
Ensure environment variables are set in production
- Create Test Roles: Create roles like @flips, @green, @yellow
- Subscribe Users: Have users subscribe to different roles
- Send Notifications: Use admin account to ping roles and verify notifications
- Verify Delivery: Check that subscribed users receive notifications
The application includes comprehensive error handling for:
- Authentication failures
- Database connection issues
- Invalid role names
- Missing permissions
- Network errors
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.