# Project-specific rules for Cursor AI
[project]
name = "dfda"
framework = "next.js"
version = "15.0"
router = "app"
style = "tailwind"
typescript = true
package_manager = "pnpm"
# AI Object Generation Example
import { getModel } from '@/lib/utils/modelUtils';
import { z } from 'zod'
import { generateObject } from 'ai'
const TestSchema = z.object({
name: z.string().describe("A name for the item"),
description: z.string().describe("A detailed description"),
tags: z.array(z.string()).describe("Related tags"),
rating: z.number().min(0).max(5).describe("Rating from 0-5")
});
const result = await generateObject({
model: getModel(),
schema: TestSchema,
prompt: `Generate information about a random product.`,
});
# Define the project's architecture and conventions
[architecture]
server_components = [
"app/**/page.tsx",
"app/**/layout.tsx",
"app/**/template.tsx"
]
client_components = [
"components/**/*.tsx",
"app/**/components/*.tsx"
]
hooks = ["lib/hooks/**/*.ts"]
utils = ["lib/**/*.ts"]
config = ["config/**/*.ts"]
types = ["types/**/*.ts"]
# Component and Authentication Guidelines
[components]
server = """
IMPORTANT: Server Components (pages)
- Never add 'use client' to page.tsx files
- No hooks or browser APIs
- Fetch data server-side when possible
- Import client components as needed
Auth Usage:
import { getServerSession } from "next-auth/next"
import { authOptions } from "@/lib/auth"
const session = await getServerSession(authOptions)
if(!session?.user) {
return redirect('/signin?callbackUrl=/my-page')
}
"""
client = """
When to use client components:
- Uses hooks (useState, useEffect, etc.)
- Needs browser APIs
- Has user interactions
- Uses client-side libraries
Location: app/my-feature/components/InteractiveComponent.tsx
Auth Usage:
import { useSession } from 'next-auth/react'
const { data: session } = useSession()
"""
# Next.js App Router conventions
[next]
routing = """
- Use app directory for all routes
- page.tsx files are automatically server components
- loading.tsx for loading states
- error.tsx for error handling
- layout.tsx for shared layouts
"""
data_fetching = """
- Use server components for data fetching when possible
- Leverage React Server Components for better performance
- Use route handlers (route.ts) for API endpoints
"""
# Type Safety and Database
[code_quality]
types = """
- Use TypeScript strict mode
- Import Prisma types directly from @prisma/client
- Create interfaces for component props
- Avoid 'any' type
- Always prefer schema.prisma types over creating new ones
Example:
import { Post, User } from '@prisma/client'
"""
best_practices = """
✅ DO:
- Keep pages as server components
- Create separate client components for interactivity
- Use self-documenting names
- Choose simple implementations
- Use proper auth imports based on component type
❌ DON'T:
- Mix client and server code in same component
- Create new types when Prisma types exist
- Use cryptic or abbreviated names
"""
# Performance guidelines
performance = """
- Keep pages as server components when possible
- Use client components only when necessary
- Implement proper code splitting
- Use React Suspense boundaries wisely
"""
# File patterns to ignore
[ignore]
patterns = [
"node_modules",
".next",
"build",
"dist",
"public/assets",
".git"
]
# Testing guidelines
[testing]
jest = """
- Always set @jest-environment node at the top of test files
- Write tests that can safely run against production
- Use real implementations instead of mocks where possible
Example header:
/**
* @jest-environment node
*/
"""css
dockerfile
golang
html
javascript
jest
mdx
mermaid
+10 more
First Time Repository
A modest proposal to upgrade fda.gov to accelerate clinical research
TypeScript
Languages:
CSS: 7.7KB
Dockerfile: 1.6KB
HTML: 58.7KB
JavaScript: 51.1KB
MDX: 18.1KB
Mermaid: 0.7KB
PLpgSQL: 1.9KB
PowerShell: 5.7KB
Shell: 1.1KB
TypeScript: 2428.7KB
Created: 12/13/2024
Updated: 1/20/2025
All Repositories (1)
A modest proposal to upgrade fda.gov to accelerate clinical research