This project is a Real-time Event Monitoring and Notification SaaS designed to provide instant notifications for critical events directly to Discord. It leverages a modern tech stack to ensure efficient event tracking, real-time notifications, and robust user management.
- Real-time Notifications: Alerts for critical events via Discord.
- User Management: Authentication and quota management using Clerk.
- Event Tracking: Log and monitor events like sales and user sign-ups.
- Dashboard and Insights: Real-time analytics on tracked events.
- API Integration: RESTful API for event logging and management.
- Caching: Enhanced performance with Upstash Redis.
- Serverless Architecture: Uses Neon for PostgreSQL and Cloudflare Workers for backend operations.
- Data Validation: Ensured with TypeScript and Zod.
- Responsive UI: Built with Next.js, React, and Tailwind CSS.
-
Frontend: Next.js, React, Tailwind CSS, Framer Motion, Lucide React, React Hook Form, Radix UI.
-
Backend: Prisma, Neon, Upstash Redis, Hono, SuperJSON, Zod.
-
Authentication: Clerk.
-
API: Discord.js, NextResponse.
-
DevOps: Wrangler.
-
Database: @neondatabase/serverless, @prisma/adapter-neon.
-
Caching: @upstash/redis.
-
Utilities: clsx, date-fns, class-variance-authority.
-
Clone the repository:
git clone https://github.com/your-username/your-repo-name.git cd your-repo-name -
Install dependencies:
npm install
-
Set up environment variables:
- Copy
.env.example
.env
and fill in the required values.
-
Generate Prisma client:
npx prisma generate
-
Run the development server:
npm run dev
- POST /api/v1/events: Log a new event.
{ "category": "sale", "fields": { "plan": "PRO", "email": "[email protected]", "amount": 49.00 } }
const quotaLimit =
user.plan === "FREE"
? FREE_QUOTA.maxEventsPerMonth
: PAID_QUOTA.maxEventsPerMonth
if (quota && quota.count >= quotaLimit) {
return NextResponse.json(
{
message: `You have reached your monthly limit of ${quotaLimit} events. Please upgrade your plan to create more events.`,
},
{ status: 429 }
)
}
const discord = new DiscordClient(process.env.DISCORD_BOT_TOKEN)
const dmChannel = await discord.createDM(user.discordId)
await discord.sendEmbed(dmChannel.id, {
title: "hello world",
})
return NextResponse.json({ message: "Event logged and notification sent." })Contributions are welcome! Please open an issue or submit a pull request for any changes.
This project is licensed under the MIT License. See the
LICENSE
file for details.
For any inquiries, please contact [email protected].
Star the repo if you find it useful!
This `README.md` file provides a comprehensive overview of your project, including key features, tech stack, installation instructions, usage examples, and contribution guidelines.
This `README.md` file provides a comprehensive overview of your project, including key features, tech stack, installation instructions, usage examples, and contribution guidelines.