description | globs | alwaysApply |
---|---|---|
Enforce consistent folder structure for clarity |
true |
blefnk/rules 1.0.0
- Applies when adding files or directories.
- Ensures consistency in Next.js TypeScript projects.
- Store core pages in
src/app/
orsrc/app/[locale]/
(i18n). API routes go insrc/app/api/
. - Place shared components in
src/ui/
, separating primitives from custom components. - Keep DB schemas in
src/db/schema/
and utilities insrc/lib/
. - Store tests in
tests/
or near related files for integration tests.
- Use the
~/
alias forsrc
(e.g.,import { Button } from "~/ui/primitives/button"
). - App-specific components:
~/ui/components
. - Shadcn primitives:
~/ui/primitives
.
Type | Convention | Example |
---|---|---|
React components | kebab-case |
dropdown-menu.tsx |
Utility functions | camelCase |
formatDate.ts |
Custom React hooks | camelCase + use prefix |
useAuth.ts |
Client Components | "use client" at top |
"use client"; |
Server Components | Default async/await | (No directive needed) |