|
| 1 | +# Project Guidelines |
| 2 | + |
| 3 | +## 🛠️ Development Environment |
| 4 | + |
| 5 | +- **Language**: TypeScript (`^5.9.0`) |
| 6 | +- **Framework**: Next.js (App Router) |
| 7 | +- **Styling**: CSS + tailwind (`^4`) |
| 8 | +- **Component Library**: `radix-ui` |
| 9 | +- **Testing**: vitest + React Testing Library |
| 10 | +- **Linting**: ESLint with `@typescript-eslint` |
| 11 | +- **Formatting**: Prettier |
| 12 | +- **Package Manager**: `npm` (preferred) |
| 13 | + |
| 14 | +## 📂 Recommended Project Structure |
| 15 | + |
| 16 | +```warp-runnable-command |
| 17 | +. |
| 18 | +├── app/ # App Router structure |
| 19 | +│ ├── layout.tsx |
| 20 | +│ ├── page.tsx |
| 21 | +│ └── api/ |
| 22 | +├── components/ # UI components (radix-ui or custom) |
| 23 | +│ ├── footer.tsx |
| 24 | +│ ├── theme-provider.tsx |
| 25 | +│ └── ui/ |
| 26 | +│ └── badge.tsx |
| 27 | +├── hooks/ # Custom React hooks |
| 28 | +├── lib/ # Client helpers, API wrappers, etc. |
| 29 | +├── styles/ # Tailwind customizations |
| 30 | +├── tests/ # Unit and integration tests |
| 31 | +├── public/ # images, fonts, etc. |
| 32 | +├── .eslintrc.json |
| 33 | +├── tailwind.config.ts |
| 34 | +├── tsconfig.json |
| 35 | +├── postcss.config.mjs |
| 36 | +├── next.config.js |
| 37 | +├── package.json |
| 38 | +└── README.md |
| 39 | +``` |
| 40 | + |
| 41 | +## 📦 Installation Notes |
| 42 | + |
| 43 | +- `npm install` |
| 44 | + |
| 45 | +## ⚙️ Dev Commands |
| 46 | + |
| 47 | +- **Dev server**: `npm run dev` |
| 48 | +- **Build**: `npm build` |
| 49 | +- **Start**: `npm start` |
| 50 | +- **Lint**: `npm lint` |
| 51 | +- **Format**: `npm format` |
| 52 | +- **Test**: `npm test` |
| 53 | + |
| 54 | +## 🧪 Testing Practices |
| 55 | + |
| 56 | +- **Testing Library**: `@testing-library/react` |
| 57 | +- **Mocking**: `vi.mock()` |
| 58 | +- **Test command**: `npm test` |
| 59 | +- Organize tests in `/tests` or co-located with components |
| 60 | + |
| 61 | +## 🧱 Component Guidelines |
| 62 | + |
| 63 | +- Use `radix-/ui` components by default for form elements, cards, dialogs, etc. |
| 64 | +- Style components with Tailwind utility classes |
| 65 | +- Co-locate CSS modules or component-specific styling in the same directory |
| 66 | +- Use environment variables for configuration |
| 67 | +- Use server components by default |
| 68 | +- Implement client components only when necessary |
| 69 | + |
| 70 | +## 📝 Code Style Standards |
| 71 | + |
| 72 | +- Prefer arrow functions |
| 73 | +- Annotate return types |
| 74 | +- Always destructure props |
| 75 | +- Avoid `any` type, use `unknown` or strict generics |
| 76 | +- Use TypeScript for type safety |
| 77 | +- Implement proper metadata for SEO |
| 78 | +- Utilize Next.js Image component for optimized images |
| 79 | +- Use CSS Modules or Tailwind CSS for styling |
| 80 | +- Implement proper error boundaries |
| 81 | +- Follow Next.js naming conventions for special files |
| 82 | + |
| 83 | +## 🔍 Documentation & Onboarding |
| 84 | + |
| 85 | +- Each component and hook should include a short comment on usage |
| 86 | +- Document top-level files (like `app/layout.tsx`) and configs |
| 87 | +- Keep `README.md` up to date with getting started, design tokens, and component usage notes |
| 88 | + |
| 89 | +## 🔐 Security |
| 90 | + |
| 91 | +- Validate all server-side inputs (API routes) |
| 92 | +- Use HTTPS-only cookies and CSRF tokens when applicable |
| 93 | +- Protect sensitive routes with middleware or session logic |
0 commit comments