A community welfare platform facilitating sustainable scrap collection and redistribution to support welfare programs. Established in 2021 in Gorakhpur, Uttar Pradesh.
- Node.js 18+
- MongoDB (local or cloud)
- pnpm package manager
- Clone the repository
- Install dependencies:
pnpm install- Set up environment variables (see Environment Configuration)
- Run the development server:
pnpm devOpen http://localhost:3000 with your browser to see the result.
Create a .env file in the root directory with the following variables:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key
CLERK_SECRET_KEY=your_clerk_secret_key
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URL=/
NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL=/MONGODB_URI=mongodb://localhost:27017/your_database_nameCLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME=your_cloud_nameNEXT_PUBLIC_VAPID_PUBLIC_KEY=your_vapid_public_key
VAPID_PRIVATE_KEY=your_vapid_private_keyRESEND_API_KEY=your_resend_api_key
NOTIFICATION_EMAIL=[email protected]
NOTIFICATION_FROM_NAME=Your Organization NameNEXT_PUBLIC_BASE_URL=http://localhost:3000WHATSAPP_ACCESS_TOKEN=your_whatsapp_access_token
WHATSAPP_PHONE_NUMBER_ID=your_phone_number_idSMS_ENABLED=false
SMS_API_URL=your_sms_api_url
SMS_API_KEY=your_sms_api_key
SMS_SENDER_ID=YOUR_SENDER_ID- Email and Web Push: Required for core notification functionality
- WhatsApp and SMS: Optional services that enhance notification reach
- Missing optional services: Will log warnings but won't prevent app startup
- Missing required services: Will log errors and may affect functionality
The application includes automatic configuration validation at startup that will:
- Check all required environment variables
- Validate service connectivity where possible
- Log detailed status information for troubleshooting
- Continue operation with graceful degradation for optional services
The application includes analytics collection jobs that can be scheduled by administrators:
- Daily Analytics Collection: Collects notification statistics for the previous day
- Weekly Analytics Backfill: Backfills missing analytics data for the past 7 days
- Monthly Analytics Cleanup: Removes analytics data older than 365 days
Important: No jobs are scheduled automatically. Administrators must manually enable jobs through the admin interface at /admin/notifications or via the scheduler API.
Control application logging with these environment variables:
# Show detailed configuration logs (startup validation)
LOG_CONFIG=true
# Control general log verbosity
LOG_LEVEL=info # Options: debug, info, warn, error
VERBOSE_LOGS=true # Enable detailed service logs
# For production, use minimal logging:
LOG_LEVEL=error
VERBOSE_LOGS=falsepnpm dev # Start development server with Turbopack
pnpm build # Build for production
pnpm start # Start production server
pnpm lint # Run ESLint
pnpm type-check # Run TypeScript compiler check/app- Next.js App Router pages and API routes/components- Reusable React components/lib- Utility functions and service configurations/models- MongoDB/Mongoose data models/types- TypeScript type definitions/hooks- Custom React hooks/contexts- React context providers
- Set all required environment variables in your deployment platform
- Ensure MongoDB connection string is configured for production
- Configure Cloudinary for image storage
- Set up notification services (email, web push, optionally WhatsApp/SMS)
- Update
NEXT_PUBLIC_BASE_URLto your production domain
The application includes automatic database model initialization. For new deployments:
- Ensure MongoDB connection is established
- The application will automatically create required collections and indexes
- Run any migration scripts in
/scriptsif needed for data updates
- Email (Resend): Sign up at resend.com and get API key
- Web Push: Generate VAPID keys using web-push library
- WhatsApp Business: Set up Meta Business account and get API credentials
- SMS: Configure with your preferred SMS provider
- When sending notifications via email without a selected template, the system now uses a default branded HTML template that includes the site icon, organization name, and a friendly greeting using the recipient's name when available.
- Emails to any address containing the domain
khadimemillat.orgare automatically excluded from broadcast sends to avoid internal noise. These are recorded in the notification log as excluded. - Configure the branding via environment variables:
NEXT_PUBLIC_BASE_URLto build absolute URLs for the iconNOTIFICATION_FROM_NAMEandNOTIFICATION_EMAILto control the From header