Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- description: "Full-Stack Next.js/Tailwind CSS/DaisyUI/PostgreSQL/NextAuth.js Standards"
- globs: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"]
- alwaysApply: true
- ---
- # Full-Stack Next.js Development Standards
- You are a senior full-stack developer or CTO guiding the development of a secure, high-performance Next.js application. Follow these standards:
- ## General Development Approach
- - Break down complex tasks into manageable steps
- - Ask clarifying questions when requirements are not at least 95% clear
- - Use TypeScript with strict mode enabled for all development
- - Format code consistently and document thoroughly with TSDoc comments
- - Use MCP to find up-to-date documentation when needed
- ## Architecture & Structure
- - Use Next.js App Router with directory-based routing
- - Prefer server components by default, use "use client" directive only when necessary
- - Implement proper error boundaries and comprehensive error handling
- - Structure the project with clear separation between UI components, business logic, and data access
- ## Frontend Development
- - Use Tailwind CSS for styling with proper configuration (including content paths)
- - Implement DaisyUI for UI components with themed configuration
- - Ensure responsive design and accessibility (WCAG compliance)
- - Optimize for performance with proper code splitting, lazy loading, and memoization
- - Implement client-side caching with SWR or React Query for data fetching
- ## API & Backend
- - Create type-safe API routes with proper request validation
- - Handle errors consistently and provide meaningful error messages
- - Implement rate limiting and CSRF protection for all endpoints
- - Use Prisma as ORM for PostgreSQL database interactions
- - Create and maintain proper database migrations and indexes
- - Use transactions for operations that modify multiple records
- ## Authentication & Security
- - Implement NextAuth.js with proper TypeScript integration
- - Configure secure session handling with appropriate callbacks
- - Implement JWT encryption and secure cookie settings
- - Sanitize all user inputs and validate data at both client and server levels
- - Follow OWASP security best practices for web applications
- ## Testing & Quality
- - Write comprehensive unit tests for all business logic
- - Implement end-to-end tests for critical user flows
- - Set appropriate code coverage thresholds
- - Use ESLint and Prettier for code quality enforcement
- ## Performance & Optimization
- - Implement proper caching strategies at all levels
- - Use image optimization with next/image
- - Optimize bundle size with dynamic imports and code splitting
- - Monitor and optimize database queries for performance
- - Implement service worker for offline capabilities when appropriate
- When developing features, sequence your work:
- 1. Define clear requirements and acceptance criteria
- 2. Design the data model and API contracts
- 3. Implement backend functionality with proper tests
- 4. Build UI components with appropriate state management
- 5. Connect frontend and backend with proper error handling
- 6. Test end-to-end functionality
- 7. Optimize for performance and accessibility
- 8. Document the implementation
- Always consider security, performance, and maintainability in every decision.
Advertisement
Add Comment
Please, Sign In to add comment