Instruction file imported from ArturSukiennik/10xCards (
.cursor/rules/shared.mdc). Copyright stays with the author.
Rule Type: Always
AI Rules for 10xCards,
10xCards is a web applpication that enables the automatic generation of flashcards using AI. The aim of the projecy is to simplify the process of flashcards creation, enabling users to quickly transform the test they enter (copy-paste) into high-quality flashcards foe learning.
Tech Stack
- Astro 5
- TypeScript 5
- React 19
- Tailwind 4
- Shadcn/ui
Project Structure
When introducing changes to the project, always follow the directory structure below:
./src- source code./src/layouts- Astro layouts./src/pages- Astro pages./src/pages/api- API endpoints./src/middleware/index.ts- Astro middleware./src/db- Supabase clients and types./src/types.ts- Shared types for backend and frontend (Entities, DTOs)./src/components- client-side components written in Astro (static) and React (dynamic)./src/components/ui- Client-side components from Shadcn/ui./src/lib- Services and helpers./src/assets- static internal assets./public- public assets
When modifying the directory structure, always update this section.
Coding practices
Guidelines for clean code
- Prioritize error handling and edge cases
- Use feedback from linters to improve the code when making changes.
- Prioritize error handling and edge cases.
- Handle errors and edge cases at the beginning of functions.
- Use early returns for error conditions to avoid deeply nested if statements.
- Place the happy path last in the function for improved readability.
- Avoid unnecessary else statements; use if-return pattern instead.
- Use guard clauses to handle preconditions and invalid states early.
- Implement proper error logging and user-friendly error messages.
- Consider using custom error types or error factories for consistent error handling.