Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
33c1db1
fixing build error
Jackson57279 Nov 16, 2025
eb6e646
internal server error fix hopefully
Jackson57279 Nov 16, 2025
9a616f0
changes
Jackson57279 Nov 16, 2025
c64c46f
hopefully fixes this
Jackson57279 Nov 16, 2025
f4a1c6b
changes
Jackson57279 Nov 16, 2025
3532501
Fix code tab display, download functionality, and AI agent page.tsx e…
Jackson57279 Nov 16, 2025
e6294d5
images fixin
Jackson57279 Nov 16, 2025
a035096
Fix fragment display issue - capitalize Fragment and Attachment prope…
Jackson57279 Nov 16, 2025
01ce4a6
moving files
Jackson57279 Nov 18, 2025
27dcc86
fix:polar.sh 500 error
Jackson57279 Nov 18, 2025
3b29023
refactor: update model selection and usage checks
Jackson57279 Nov 18, 2025
8a2507d
feat: validate Polar product ID format
Jackson57279 Nov 18, 2025
43ae59b
feat: enhance Polar product ID validation
Jackson57279 Nov 18, 2025
0653e9f
feat: implement environment-based product ID validation and error han…
Jackson57279 Nov 18, 2025
ce5a108
feat: allow sandbox IDs in production for testing purposes
Jackson57279 Nov 18, 2025
f7598cf
feat: refactor Polar client initialization for explicit environment h…
Jackson57279 Nov 18, 2025
1b9fd42
feat: update POLAR_ACCESS_TOKEN validation for production environments
Jackson57279 Nov 18, 2025
8ed76f3
feat: update dependencies and enhance subscription access checks
Jackson57279 Nov 18, 2025
329e4bd
feat: enhance hasProAccess function and usage checks
Jackson57279 Nov 18, 2025
912e54a
feat: temporarily remove Pro plan restrictions for Gemini model
Jackson57279 Nov 19, 2025
a08c44a
feat: refactor authentication and error handling in project queries
Jackson57279 Nov 19, 2025
8c8aa50
fix: remove unsupported frequency_penalty parameter for Gemini model
Jackson57279 Nov 19, 2025
6025978
feat: Update code viewer to use `useRef` for targeted highlighting an…
Jackson57279 Nov 19, 2025
ef47869
linking stack auth with polar
Jackson57279 Nov 21, 2025
5af1f2c
fix: fixed the build error, removed penatly
Jackson57279 Nov 21, 2025
c3d4661
fix: remove organizationId from Polar customer create call
Jackson57279 Nov 21, 2025
29bbd8a
new model
Jackson57279 Nov 28, 2025
ad49902
changes
Jackson57279 Nov 28, 2025
6f8b646
refactor: use `useUser` from `@stackframe/stack` for authentication s…
Jackson57279 Nov 28, 2025
44eef80
AI
Jackson57279 Nov 29, 2025
b879a62
dih
Jackson57279 Nov 29, 2025
6473344
feat: Initialize Next.js application with Stackframe, Convex, GitHub/…
Jackson57279 Nov 29, 2025
b16ea25
fix: resolve Convex 'Called by client' error in createWithMessageAndA…
Jackson57279 Nov 29, 2025
35b3249
docs: add Convex action-to-mutation communication pattern guide
Jackson57279 Nov 29, 2025
af5c6b3
Merge branch 'master' of https://github.com/otdoges/zapdev
Jackson57279 Nov 29, 2025
c0b392f
fix: Fix Inngest AgentKit 'Error making AI request' by correcting mod…
Jackson57279 Nov 29, 2025
fbe2b56
changes
Jackson57279 Nov 30, 2025
4a0f1a1
delete prisma
Jackson57279 Nov 30, 2025
7e5aac0
feat: Implement GitHub and Figma import APIs with OAuth and integrate…
Jackson57279 Nov 30, 2025
a9c1cf6
Fix E2B build validation error handling to capture actual build outpu…
Jackson57279 Nov 30, 2025
a43befb
Changes
Jackson57279 Nov 30, 2025
0800322
changes
Jackson57279 Nov 30, 2025
02baa1e
changes
Jackson57279 Nov 30, 2025
a442e84
fixing
Jackson57279 Nov 30, 2025
75fa81a
changes
Jackson57279 Nov 30, 2025
98ad4f2
fixing
Jackson57279 Nov 30, 2025
18b1fdd
fixing
Jackson57279 Nov 30, 2025
efa799a
Add Polar webhook debug logging
Jackson57279 Nov 30, 2025
ca9801e
Add rewrite rule for Polar webhook without trailing slash
Jackson57279 Nov 30, 2025
54e5eb3
Disable trailingSlash to prevent 307 redirects on webhook endpoint
Jackson57279 Nov 30, 2025
a045f84
fixing webhook errors
Jackson57279 Dec 1, 2025
4944248
feat(seo): implement comprehensive AI agent and search optimization (…
tembo[bot] Dec 1, 2025
a49a3aa
changes
Jackson57279 Dec 1, 2025
5826b41
changes
Jackson57279 Dec 2, 2025
0921410
Removing inngest
Jackson57279 Dec 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .cursor/rules/rules.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,16 @@
alwaysApply: true
---

Stop making so many .md files if so do it in the @explaninations folder please.
# General Rules

## Documentation
- Stop making so many .md files - if needed, put them in the `/explanations/` folder, not root.
- Exceptions: CLAUDE.md, AGENTS.md, README.md stay in root.

## Package Management
- **Always use `bun`** - never npm, yarn, or pnpm.

## Code Quality
- Strict TypeScript - avoid `any` types.
- Use proper error handling with Sentry integration.
- Follow accessibility and responsive design best practices.
324 changes: 324 additions & 0 deletions .cursor/rules/zapdev_rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,324 @@
---
description: ZapDev project-wide coding guidelines and patterns
globs: src/**/*.ts,src/**/*.tsx,convex/**/*.ts
alwaysApply: true
---

# ZapDev Project Rules

## Overview
ZapDev is an AI-powered development platform that enables users to create web applications through conversational AI interactions. Claude AI generates production-ready code across multiple frameworks in isolated E2B sandboxes with real-time previews.

## Technology Stack
- **Frontend**: Next.js 15 (Turbopack), React 19, TypeScript 5.9, Tailwind CSS v4, Shadcn/ui, React Query
- **Backend**: Convex (real-time database), tRPC (type-safe APIs), Stack Auth (authentication)
- **AI & Execution**: Vercel AI Gateway, Inngest 3.44 (job orchestration), E2B Code Interpreter (sandboxes)
- **Monitoring**: Sentry, OpenTelemetry

## Package Management
**ALWAYS use `bun`** for all package management. Never use npm, yarn, or pnpm.

```bash
bun install # Install dependencies
bun add <package> # Add new package
bun remove <package> # Remove package
bun run dev # Start dev server
bun run build # Build for production
bun run lint # Run ESLint
bun run test # Run tests
```

## Project Structure

```
src/
├── app/ # Next.js App Router
│ ├── api/ # API routes (tRPC, Inngest webhooks, Convex)
│ ├── (home)/ # Home page
│ ├── dashboard/ # User projects dashboard
│ ├── projects/ # Project workspace + editor
│ └── layout.tsx # Root layout with providers
├── inngest/ # Background job orchestration
│ ├── functions.ts # Main agent functions & orchestration
│ └── functions/ # Individual function modules
├── prompts/ # AI system prompts per framework
├── trpc/ # Type-safe API client & server
├── components/ # React components (ui/, file-explorer, editor)
├── modules/ # Feature-specific business logic
├── lib/ # Utilities (frameworks-config, firecrawl)
└── hooks/ # Custom React hooks
convex/
├── schema.ts # Database tables
├── projects.ts, messages.ts, usage.ts
└── helpers.ts, auth.config.ts
```

## TypeScript Guidelines

### Strict Mode
- Avoid `any` type - use proper typing
- Use `unknown` instead of `any` when type is uncertain
- Define interfaces/types for all data structures

```typescript
// ❌ Bad
const data: any = await fetchData();

// ✅ Good
interface ProjectData {
id: string;
name: string;
framework: Framework;
}
const data: ProjectData = await fetchData();
```

### Type Safety with tRPC
```typescript
// Use tRPC hooks for type-safe API calls
import { trpc } from "@/trpc/client";

// Query
const { data, isLoading } = trpc.projects.getById.useQuery({ id: projectId });

// Mutation
const createProject = trpc.projects.create.useMutation({
onSuccess: (data) => {
// data is fully typed
},
});
```

## React Patterns

### Component Structure
```typescript
// Use functional components with TypeScript
interface ButtonProps {
variant?: "primary" | "secondary";
onClick: () => void;
children: React.ReactNode;
}

export function Button({ variant = "primary", onClick, children }: ButtonProps) {
return (
<button className={cn("btn", variant)} onClick={onClick}>
{children}
</button>
);
}
```

### Hooks Best Practices
```typescript
// Custom hooks should start with "use"
export function useProject(projectId: string) {
const { data, isLoading } = trpc.projects.getById.useQuery({ id: projectId });
return { project: data, isLoading };
}

// Use React Query for server state
// Use useState/useReducer for local state only
```

### Server Components vs Client Components
```typescript
// Default to Server Components (no "use client" directive)
// Only add "use client" when needed:
// - Event handlers (onClick, onChange, etc.)
// - Browser APIs (localStorage, window)
// - React hooks (useState, useEffect, etc.)
// - Third-party client libraries

// ❌ Unnecessary "use client"
"use client";
export function StaticContent() {
return <div>Hello</div>;
}

// ✅ Correct usage
"use client";
export function InteractiveButton() {
const [count, setCount] = useState(0);
return <button onClick={() => setCount(c => c + 1)}>{count}</button>;
}
```

## Convex Database Patterns

### Always Use Authentication
```typescript
import { requireAuth } from "./helpers";

export const getProject = query({
args: { id: v.id("projects") },
handler: async (ctx, args) => {
const userId = await requireAuth(ctx);
const project = await ctx.db.get(args.id);

// Always verify ownership
if (!project || project.userId !== userId) {
throw new Error("Unauthorized");
}

return project;
},
});
```

### Use Indexes for Queries
```typescript
// ❌ Full table scan
const projects = await ctx.db.query("projects").collect();

// ✅ Use index
const projects = await ctx.db
.query("projects")
.withIndex("by_userId", (q) => q.eq("userId", userId))
.collect();
```

### Mutations Pattern
```typescript
export const createProject = mutation({
args: {
name: v.string(),
framework: v.string(),
},
handler: async (ctx, args) => {
const userId = await requireAuth(ctx);

return await ctx.db.insert("projects", {
userId,
name: args.name,
framework: args.framework as Framework,
createdAt: Date.now(),
updatedAt: Date.now(),
});
},
});
```

## Error Handling

### Use Sentry for Production Errors
```typescript
import * as Sentry from "@sentry/nextjs";

try {
await riskyOperation();
} catch (error) {
Sentry.captureException(error);
throw error; // Re-throw for proper handling
}
```

### API Error Responses
```typescript
// Use consistent error format
throw new TRPCError({
code: "NOT_FOUND",
message: "Project not found",
});

throw new TRPCError({
code: "UNAUTHORIZED",
message: "You must be logged in",
});

throw new TRPCError({
code: "FORBIDDEN",
message: "You don't have access to this resource",
});
```

## Security Guidelines

### Input Validation
```typescript
// Always validate user inputs with Zod
import { z } from "zod";

const ProjectSchema = z.object({
name: z.string().min(1).max(100),
framework: z.enum(["nextjs", "react", "vue", "angular", "svelte"]),
});
```

### Sanitize File Paths
```typescript
// Prevent directory traversal
function sanitizePath(path: string): string {
return path.replace(/\.\./g, "").replace(/^\/+/, "");
}
```

### Environment Variables
```typescript
// ❌ Never expose secrets client-side
const apiKey = process.env.API_SECRET_KEY;

// ✅ Use NEXT_PUBLIC_ prefix only for public values
const publicUrl = process.env.NEXT_PUBLIC_APP_URL;
```

## Supported Frameworks

When working with AI code generation, these frameworks are supported:
- **Next.js 15** (default) — Full-stack React, SSR, Shadcn/ui, Tailwind
- **Angular 19** — Enterprise apps, Material Design, Tailwind
- **React 18** — SPA with Vite, Chakra UI, Tailwind
- **Vue 3** — Progressive apps, Vuetify, Tailwind
- **SvelteKit** — High-performance, DaisyUI, Tailwind

## Documentation

**Put all .md documentation files in `/explanations/` folder**, not in the root directory.

Exceptions: CLAUDE.md, AGENTS.md, README.md stay in root.

## Testing

```typescript
// Test files go in /tests/ directory
// Use patterns: **/__tests__/**/*.ts, **/?(*.)+(spec|test).ts

describe("Project CRUD", () => {
it("should create a project", async () => {
const result = await createProject({ name: "Test", framework: "nextjs" });
expect(result).toBeDefined();
expect(result.name).toBe("Test");
});
});
```

## Git Workflow

```bash
# Check status before any git operations
git status

# Never use interactive mode
# ❌ git rebase -i
# ❌ git add -p

# Don't push without explicit request
# Check diff before committing
git diff
```

## Common Commands Reference

```bash
# Development (run in separate terminals)
bun run dev # Next.js dev server
bun run convex:dev # Convex backend

# Building
bun run build # Production build
bun run lint # ESLint check
bun run test # Jest tests

# Convex
bun run convex:deploy # Deploy to production
```
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ next-env.d.ts
.npm

# Database exports and migrations
/neon-thing/
/neon-thing/
.env*.local
Loading