This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Resonex is an AI-powered newsletter automation platform built for the Convex + Resend Hackathon. It's a full-stack web application that enables users to create, manage, and track email campaigns with AI-generated content and A/B testing capabilities.
# Full development mode (frontend + backend)
npm run dev
# Frontend only (Next.js with Turbopack)
npm run dev:frontend
# Backend only (Convex)
npm run dev:backend
# Production build
npm run build
# Production server
npm run start
# Code linting
npm run lint- Run
npm run devto start both frontend and backend - Frontend runs on http://localhost:3000
- Convex backend automatically syncs and provides real-time updates
- Use
npm run lintbefore committing changes
- Frontend: Next.js 15 (App Router), React 19, TypeScript, TailwindCSS v4
- Backend: Convex (real-time database + functions), OpenAI API, Resend
- UI: shadcn/ui components with Radix UI, Lucide React icons
- Authentication: Clerk
- Visualization: React Flow, Recharts
- Background Jobs: @convex-dev/workpool
- Main routes:
/dashboard(authenticated area),/(landing page) - Dashboard structure: Nested routes under
/dashboard/including campaigns, activity, logs, settings - Authentication:
/sign-in/routes with Clerk integration
/ui/: shadcn/ui base components (buttons, cards, dialogs, etc.)/icons/: Lucide React icon components/nodes/: React Flow nodes for visual campaign creation/emails/: Email template components- Core components: CampaignCard, Sidebar, Header, MetricDashboard
schema.ts: Database schema definition (DO NOT MODIFY without understanding implications)campaigns.ts: Campaign management functionsabEmails.ts: A/B testing email logicevents.ts: Event tracking and webhooksllmCall.ts: OpenAI integration for AI content generationhttp.ts: HTTP router for webhooks (Resend integration)
Main tables: campaigns, users, abEmails, abEmailResend, emailAnalytics, reactFlowCanvas
- User Interaction → React components in
/app/or/components/ - API Calls → Convex functions in
/convex/(queries, mutations, actions) - AI Processing → OpenAI API via
llmCall.ts - Email Delivery → Resend API with tracking via
http.ts - Event Tracking → Webhooks from Resend back to Convex
- Real-time Updates → Convex real-time data sync to frontend
- Use shadcn/ui components as base building blocks
- Follow the existing component structure in
/components/ - Implement new icons in
/components/icons/using Lucide React - Use TypeScript interfaces for component props
- All database operations go through Convex functions
- Use TypeScript types from
schema.tsfor type safety - Implement background jobs using
@convex-dev/workpool - Follow the existing function patterns in
/convex/
- Use TailwindCSS v4 with CSS variables for theming
- Follow the neutral color scheme established in the project
- Use
utils.tsforclsxandtailwind-mergeutilities
- Primary state management through Convex real-time queries
- React state for local UI state
- Use custom hooks in
/hooks/for complex logic
- Convex schema changes require careful consideration
- Use
convex devfor backend development - Real-time updates are automatic - no manual polling needed
- OpenAI API calls are centralized in
llmCall.ts - AI-generated content is used for email subject lines and body content
- Implement new AI features by extending the existing patterns
- Resend is used for email delivery
- Webhooks track email events (delivered, opened, clicked)
- A/B testing is implemented through
abEmails.ts
- Clerk handles all authentication
- User data is synchronized between Clerk and Convex
- Protect dashboard routes using Clerk middleware
- No specific test framework is configured
- Use
npm run lintfor code quality checks - TypeScript provides compile-time type checking
- Follow existing code patterns for consistency