Cursor rule
.cursor/rules/frontend.mdcFollow these rules when working on the frontend.
Cursor rules
Quality
61/100
Scores the file, not the repository.Length
618 words
8 headings · 6 code blocksRepository
9
— · pushed 394 days agoLast changed
3 days ago
First indexed 3 days ago.12345### Frontend Rules67Follow these rules when working on the frontend.89It uses Next.js, Tailwind, Shadcn, and Framer Motion.1011#### General Rules1213- Use `lucide-react` for icons14- useSidebar must be used within a SidebarProvider1516#### Components1718- Use divs instead of other html tags unless otherwise specified19- Separate the main parts of a component's html with an extra blank line for visual spacing20- Always tag a component with either `use server` or `use client` at the top, including layouts and pages2122##### Organization2324- All components be named using kebab case like `example-component.tsx` unless otherwise specified25- Put components in `/_components` in the route if one-off components26- Put components in `/components` from the root if shared components2728##### Data Fetching2930- Fetch data in server components and pass the data down as props to client components.31- Use server actions from `/actions` to mutate data.3233##### Data Flow Architecture3435Follow this layered architecture pattern:36- **React Components** → **Server Actions** → **Services** (when complex logic is needed)37- Services handle domain-specific logic, external API integrations, and complex business rules38- Keep Server Actions lightweight and focused on data validation and orchestration3940##### Server Components4142- Use `"use server"` at the top of the file.43- Implement Suspense for asynchronous data fetching to show loading states while data is being fetched.44- If no asynchronous logic is required for a given server component, you do not need to wrap the component in `<Suspense>`. You can simply return the final UI directly since there is no async boundary needed.45- If asynchronous fetching is required, you can use a `<Suspense>` boundary and a fallback to indicate a loading state while data is loading.46- Server components cannot be imported into client components. If you want to use a server component in a client component, you must pass the as props using the "children" prop47- params in server pages should be awaited such as `const { courseId } = await params` where the type is `params: Promise<{ courseId: string }>`4849Example of a server layout:5051```tsx52"use server"5354export default async function ExampleServerLayout({55 children56}: {57 children: React.ReactNode58}) {59 return children60}61```6263Example of a server page (with async logic):6465```tsx66"use server"6768import { Suspense } from "react"69import { SomeAction } from "@/actions/some-actions"70import SomeComponent from "./_components/some-component"71import SomeSkeleton from "./_components/some-skeleton"7273export default async function ExampleServerPage() {74 return (75 <Suspense fallback={<SomeSkeleton className="some-class" />}>76 <SomeComponentFetcher />77 </Suspense>78 )79}8081async function SomeComponentFetcher() {82 const { data } = await SomeAction()83 return <SomeComponent className="some-class" initialData={data || []} />84}85```8687Example of a server page (no async logic required):8889```tsx90"use server"9192import SomeClientComponent from "./_components/some-client-component"9394// In this case, no asynchronous work is being done, so no Suspense or fallback is required.95export default async function ExampleServerPage() {96 return <SomeClientComponent initialData={[]} />97}98```99100Example of a server component:101102```tsx103"use server"104105interface ExampleServerComponentProps {106 // Your props here107}108109export async function ExampleServerComponent({110 props111}: ExampleServerComponentProps) {112 // Your code here113}114```115116##### Client Components117118- Use `"use client"` at the top of the file119- Client components can safely rely on props passed down from server components, or handle UI interactions without needing <Suspense> if there’s no async logic.120- Never use server actions in client components. If you need to create a new server action, create it in `/actions`121122Example of a client page:123124```tsx125"use client"126127export default function ExampleClientPage() {128 // Your code here129}130```131132Example of a client component:133134```tsx135"use client"136137interface ExampleClientComponentProps {138 initialData: any[]139}140141export default function ExampleClientComponent({142 initialData143}: ExampleClientComponentProps) {144 // Client-side logic here145 return <div>{initialData.length} items</div>146}147```
Also in sportiz91/vibe-template
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| sportiz91/vibe-template.cursor/rules/auth.mdc · 9 | Cursor rules | securitydo-not | 32/100 | 3 days ago | |
| sportiz91/vibe-template.cursor/rules/storage.mdc · 9 | Cursor rules | archsecuritydo-not | 65/100 | 3 days ago | |
| sportiz91/vibe-template.cursor/rules/backend.mdc · 9 | Cursor rules | do-not | 61/100 | 3 days ago | |
| sportiz91/vibe-template.cursor/rules/coding-standards.mdc · 9 | Cursor rules | styletypesui | 36/100 | 3 days ago | |
| sportiz91/vibe-template.cursor/rules/general.mdc · 9 | Cursor rules | stylearchsecuritydo-not+1 | 69/100 | 3 days ago | |
| sportiz91/vibe-template.cursorrules · 9 | .cursorrules | stylearchsecuritydo-not+1 | 49/100 | 3 days ago | |
| sportiz91/vibe-templateCLAUDE.md · 9 | CLAUDE.md | setuptestlint-formatstyle+7 | 88/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago |
