|
| 1 | +# Tech Stack |
| 2 | +- You are building a Next.js application. |
| 3 | +- Use TypeScript. |
| 4 | +- Use Next.js App Router (app directory). |
| 5 | +- Always put source code in the appropriate directories. |
| 6 | +- Put pages into app/ directory (using App Router) |
| 7 | +- Put components into components/ directory |
| 8 | +- Put reusable UI components into components/ui/ directory |
| 9 | +- Put custom hooks into src/hooks/ directory |
| 10 | +- Put utility functions into src/utils/ or lib/ directory |
| 11 | +- The main page is app/page.tsx |
| 12 | +- UPDATE the main page to include the new components. OTHERWISE, the user can NOT see any components! |
| 13 | +- ALWAYS try to use the shadcn/ui library. |
| 14 | +- Tailwind CSS: always use Tailwind CSS for styling components. Utilize Tailwind classes extensively for layout, spacing, colors, and other design aspects. |
| 15 | + |
| 16 | +## Project Structure |
| 17 | +- `app/`: Next.js App Router directory |
| 18 | + - `layout.tsx`: Root layout component |
| 19 | + - `page.tsx`: Home page component |
| 20 | + - `globals.css`: Global styles and Tailwind directives |
| 21 | +- `components/`: React components |
| 22 | +- `lib/`: Utility functions and configurations |
| 23 | +- `package.json`: Dependencies and scripts |
| 24 | +- `next.config.js`: Next.js configuration |
| 25 | +- `tailwind.config.js`: Tailwind CSS configuration |
| 26 | +- `components.json`: shadcn/ui configuration |
| 27 | + |
| 28 | +## Development Guidelines |
| 29 | +- Use Next.js App Router for routing and layouts |
| 30 | +- Implement proper TypeScript types throughout the codebase |
| 31 | +- Use Server Components when possible, Client Components when needed |
| 32 | +- Follow Next.js best practices for performance and SEO |
| 33 | +- Use Tailwind CSS for styling with shadcn/ui components |
| 34 | +- Implement proper error boundaries and loading states |
| 35 | +- Use Next.js Image component for optimized images |
| 36 | +- Follow REST API conventions or GraphQL for data fetching |
| 37 | + |
| 38 | +## Available packages and libraries |
| 39 | +- The lucide-react package is installed for icons |
| 40 | +- You ALREADY have ALL the shadcn/ui components and their dependencies installed. So you don't need to install them again. |
| 41 | +- You have ALL the necessary Radix UI components installed. |
| 42 | +- Use prebuilt components from the shadcn/ui library after importing them. Note that these files shouldn't be edited, so make new components if you need to change them. |
| 43 | +- @tanstack/react-query is available for data fetching and caching |
| 44 | + |
| 45 | +## Next.js Specific Guidelines |
| 46 | +- Use `app/` directory for App Router (not `pages/`) |
| 47 | +- Create route groups with parentheses: `(group-name)` |
| 48 | +- Use `loading.tsx` for loading states |
| 49 | +- Use `error.tsx` for error boundaries |
| 50 | +- Use `not-found.tsx` for 404 pages |
| 51 | +- Use `layout.tsx` for shared layouts |
| 52 | +- Use Server Actions for form submissions when appropriate |
| 53 | +- Use `next/font` for optimized font loading |
| 54 | +- Use `next/image` for optimized image loading |
| 55 | +- Use `next/link` for client-side navigation |
| 56 | + |
| 57 | +## Best Practices |
| 58 | +- Use TypeScript interfaces for API responses and component props |
| 59 | +- Implement proper error handling with try-catch blocks |
| 60 | +- Use React hooks appropriately (useState, useEffect, useContext, etc.) |
| 61 | +- Follow component composition patterns |
| 62 | +- Implement proper accessibility (ARIA attributes, semantic HTML) |
| 63 | +- Use environment variables for configuration |
| 64 | +- Implement proper security measures |
| 65 | +- Write clean, readable, and maintainable code |
| 66 | +- Use meaningful variable and function names |
| 67 | +- Add comments for complex logic |
| 68 | +- Follow the principle of single responsibility for components and functions |
0 commit comments