- **Runtime:** Cloudflare Workers (Platform: Bun/Node compat)
# Project Context: Twitter Bulk Scheduler (Serverless)
## Core Stack
- **Runtime:** Cloudflare Workers (Platform: Bun/Node compat)
- **Language:** TypeScript
- **Framework:** Hono (Lightweight web framework)
- **Database:** Neon (Serverless Postgres)
- **ORM:** Drizzle ORM
- **Scheduler:** Upstash QStash
## Critical Architecture Rules
1. **Database Driver:** You MUST use `@neondatabase/serverless` for all database connections.
- NEVER use the standard `postgres` or `pg` driver.
- NEVER use `drizzle-orm/postgres-js`.
- ALWAYS use `drizzle-orm/neon-http` for queries.
- REASON: We need HTTP connection pooling to handle QStash concurrency spikes.
2. **Transactions:**
- Avoid `db.transaction()` interactive blocks.
- Use `db.batch()` if multiple write operations are needed in one go.
- If interactive transactions are absolutely necessary, switch to `drizzle-orm/neon-serverless` (WebSocket), but prefer HTTP.
3. **Deployment:**
- Target: Cloudflare Workers.
- Region: `ap-south-1` (Mumbai) via Smart Placement.
- Config File: `wrangler.toml`.
4. **No Node.js Native APIs:**
- Do not use `fs` (File System) or native `child_process`.
- Use `fetch` for all network requests.
## Coding Style
- Use `const` over `let`.
- Use `async/await` for all DB/Network calls.
- Schema definitions in `src/db/schema.ts`.
- Environment variables accessed via `env` (Hono Context), not `process.env`.
- **File Naming:**
- ALWAYS use **kebab-case** for file names (e.g., `tweet-editor.tsx`, `user-profile.ts`).
- Component names inside the file should remain **PascalCase** (e.g., `export function TweetEditor()`).
## Package Management
- **Primary Tool:** Always use `bun` for package management and script execution.
- **Prohibited:** Do NOT use `npm`, `yarn`, or `pnpm`.
## UI Guidelines
- **Components:** Always use shadcn/ui components from `@repo/ui` (located in `packages/ui`).
- **Styling:** Use the color variables and utility classes defined in `packages/ui`.
- **Consistency:** Maintain visual consistency with the existing design system.
## Common Commands
- Run Dev: `bun run dev` (or `wrangler dev`)
- Generate Migrations: `bun run drizzle-kit generate`
- Deploy: `bun run deploy`Comprehensive .cursorrules file for Next.js 15 App Router projects with TypeScript, enforcing server components by default, proper use of "use client" directive, and App Router conventions.
Cursor rules for Python FastAPI projects enforcing async patterns, Pydantic v2 models, dependency injection, and proper error handling.
Rules for consistent React component development with TypeScript interfaces, proper hook patterns, and component composition.
Rules optimizing Cursor Agent mode behavior including multi-file editing context, session management, and autonomous task completion patterns.
Cursor rules for projects using Tailwind CSS with shadcn/ui component library, enforcing consistent utility class usage and component patterns.
Rules for Go backend services enforcing idiomatic Go patterns, proper error handling, and clean architecture conventions.