RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/Cursor rules/KAMAL20201/SneakerMarketplace

Cursor rule

.cursor/rules/api-patterns.mdc
Cursor rules

Quality

58/100

Scores the file, not the repository.

Length

462 words

12 headings · 1 code blocks

Repository

0

— · pushed 0 days ago

Last changed

3 days ago

First indexed 3 days ago.
KAMAL20201/SneakerMarketplace/.cursor/rules/api-patterns.mdcRawGitHub
1# API Patterns and Data Management
2 
3## Supabase Integration
4 
5- Use `src/lib/supabase.ts` for all Supabase operations
6- Access Supabase client via `supabase` export
7- Use environment variables for configuration
8- Handle authentication state through `AuthContext`
9 
10## Service Layer Pattern
11 
12- Create service files in `src/lib/` for business logic
13- Use descriptive names: `orderService.ts`, `paymentService.ts`
14- Export functions, not classes
15- Handle errors consistently across services
16 
17## API Response Handling
18 
19- Always handle success and error cases
20- Use proper TypeScript types for API responses
21- Implement proper error boundaries and user feedback
22- Use toast notifications for user feedback (via sonner)
23 
24## Pagination Implementation
25 
26- Always implement pagination for list APIs
27- Use `count` and `skip` parameters for Supabase queries
28- Show fewer items per page initially (10-20 items)
29- Provide pagination controls at the bottom
30- Allow users to navigate between pages
31 
32## Data Fetching Patterns
33 
34- Use React Query or SWR for server state management
35- Implement proper loading states with skeletons
36- Handle empty states gracefully
37- Cache data appropriately to reduce API calls
38 
39## Error Handling
40 
41- Define custom error types in `src/types/`
42- Use try-catch blocks for async operations
43- Provide meaningful error messages to users
44- Log errors for debugging (use `Logger` component)
45 
46## Authentication Flow
47 
48- Use Supabase Auth for user management
49- Handle social login (Google, etc.)
50- Implement proper route protection
51- Use `PublicRoute` and `ProtectedRoute` components
52 
53## File Upload
54 
55- Use Supabase Storage for file uploads
56- Implement image compression before upload
57- Handle upload progress and errors
58- Validate file types and sizes
59 
60## Payment Integration
61 
62- Use Razorpay for payment processing
63- Implement proper payment flow with error handling
64- Store payment status in database
65- Handle webhook notifications
66 
67## Example Patterns
68 
69```typescript
70// Good: Service function pattern
71export const fetchProducts = async (page: number = 1, limit: number = 10) => {
72 try {
73 const { data, error, count } = await supabase
74 .from("products")
75 .select("*", { count: "exact" })
76 .range((page - 1) * limit, page * limit - 1)
77 .eq("status", LISTING_STATUS.APPROVED);
78 
79 if (error) throw error;
80 
81 return { data, count, page, limit };
82 } catch (error) {
83 console.error("Error fetching products:", error);
84 throw new Error("Failed to fetch products");
85 }
86};
87 
88// Good: API call with proper error handling
89const handleSubmit = async (formData: FormData) => {
90 try {
91 setIsLoading(true);
92 const result = await createOrder(formData);
93 toast.success("Order created successfully!");
94 navigate("/orders");
95 } catch (error) {
96 toast.error("Failed to create order. Please try again.");
97 console.error("Order creation error:", error);
98 } finally {
99 setIsLoading(false);
100 }
101};
102```
103 
104## Database Schema
105 
106- Use consistent naming conventions (snake_case for DB, camelCase for JS)
107- Implement proper RLS (Row Level Security) policies
108- Use appropriate data types and constraints
109- Create indexes for frequently queried fields
110 description:
111 globs:
112 alwaysApply: false
113 
114---
115 

Sections

  • API Patterns and Data Management
  • Supabase Integration
  • Service Layer Pattern
  • API Response Handling
  • Pagination Implementation
  • Data Fetching Patterns
  • Error Handling
  • Authentication Flow
  • File Upload
  • Payment Integration
  • Example Patterns
  • Database Schema

What it covers

code-styletypessecuritydatabaseapi

Stack — with the evidence

typescript

(1.00)

supabase

(1.00)

vite

(1.00)

eslint

(1.00)

vercel

(1.00)

react

(0.70)

tailwind

(0.70)

aws

(0.70)

javascript

(0.60)

github-actions

(0.60)

Format

Cursor rules

The most expressive format here. Many small .mdc files, each with frontmatter declaring when it should load, so a rule about migrations only enters context when a migration is open. Costs the most to maintain and only one editor reads it.

What the corpus says about it

Repository

Owner
KAMAL20201
Language
—
License
—
Archived
no

All configs in this repo

Also in KAMAL20201/SneakerMarketplace

Diff this repo’s formats

One 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?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
KAMAL20201/SneakerMarketplace.cursor/rules/development-workflow.mdc · 0Cursor rulestypescriptsupabase+8buildteststyletypes+481/1003 days ago
KAMAL20201/SneakerMarketplace.cursor/rules/project-conventions.mdc · 0Cursor rulestypescriptsupabase+8buildteststylearch+477/1003 days ago
KAMAL20201/SneakerMarketplace.cursor/rules/project-overview.mdc · 0Cursor rulestypescriptsupabase+8stylearchtypes52/1003 days ago
KAMAL20201/SneakerMarketplace.cursor/rules/react-patterns.mdc · 0Cursor rulestypescriptsupabase+8stylearchuiperformance58/1003 days ago
KAMAL20201/SneakerMarketplace.cursor/rules/typescript-standards.mdc · 0Cursor rulestypescriptsupabase+8styletypesapiui+161/1003 days ago
KAMAL20201/SneakerMarketplace.cursor/rules/ui-components.mdc · 0Cursor rulestypescriptsupabase+8archui54/1003 days ago
KAMAL20201/SneakerMarketplaceAGENTS.md · 0AGENTS.mdtypescriptsupabase+8stylesecuritydo-not45/1003 days ago
Diff against .cursor/rules/development-workflow.mdc Diff against .cursor/rules/project-conventions.mdc Diff against .cursor/rules/project-overview.mdc Diff against .cursor/rules/react-patterns.mdc Diff against .cursor/rules/typescript-standards.mdc Diff against .cursor/rules/ui-components.mdc Diff against AGENTS.md

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126Cursor rulesgobun+5setupbuildtestlint-format+6100/1003 days ago
TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45Cursor rulestypescriptpytest+15testlint-formatstylearch+5100/1003 days ago
markstev/mark-starter.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+14setuptestlint-formatstyle+699/1003 days ago
Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+13setuptestlint-formatstyle+799/1003 days ago
dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+15setuptestlint-formatstyle+799/1003 days ago
deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1Cursor rulestypescriptnextjs+5setuptestlint-formatstyle+799/1003 days ago
langflow-ai/langflow.cursor/rules/docs_development.mdc · 153kCursor rulespythonnode+16setupbuildtestlint-format+797/1003 days ago
TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45Cursor rulestypescriptpytest+15teststyletesting-strategysecurity+397/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack