Skip to main content Skip to navigation

Documentation

Everything you need to build irresistible applications

Best Practices

Guidelines for building successful projects on Irresistible.

Project Organization

File Structure

src/
├── components/     # Reusable components
├── pages/         # Route pages
├── lib/           # Utilities and helpers
├── styles/        # Global styles
└── assets/        # Static assets

Naming Conventions

  • Components: PascalCase (UserProfile.jsx)
  • Utilities: camelCase (formatDate.js)
  • CSS Modules: kebab-case (user-profile.module.css)
  • Constants: SCREAMING_SNAKE_CASE (API_URL)

Performance

Code Optimization

  1. Lazy load routes and heavy components
  2. Memoize expensive computations
  3. Debounce user input handlers
  4. Virtualize long lists

Asset Optimization

  1. Compress images before upload
  2. Use WebP format when possible
  3. Lazy load images below the fold
  4. Implement responsive images

Bundle Size

  1. Tree shake unused code
  2. Code split by route
  3. Analyze bundle regularly
  4. Use dynamic imports

Security

Authentication

  1. Never store passwords in plain text
  2. Use HTTPS for all requests
  3. Implement CSRF protection
  4. Validate sessions server-side

Data Handling

  1. Sanitize all user input
  2. Escape output in templates
  3. Use parameterized queries
  4. Implement rate limiting

API Security

  1. Authenticate all endpoints
  2. Validate request data
  3. Use CORS properly
  4. Log security events

Development Workflow

Version Control

  1. Commit often with clear messages
  2. Branch for features
  3. Review before merging
  4. Tag releases

Testing

  1. Write tests for critical paths
  2. Test edge cases
  3. Mock external services
  4. Automate testing

Documentation

  1. Comment complex logic
  2. Document APIs
  3. Keep README updated
  4. Use JSDoc for functions

Deployment

Pre-deployment

  1. Run tests locally
  2. Check console for errors
  3. Verify environment variables
  4. Review changes

Production

  1. Use environment variables
  2. Enable error tracking
  3. Set up monitoring
  4. Plan rollback strategy

Post-deployment

  1. Monitor metrics
  2. Check error logs
  3. Verify functionality
  4. Announce changes

Common Pitfalls

Avoid These

  • Hardcoding sensitive data
  • Ignoring error handling
  • Skipping tests
  • Poor commit messages
  • Not using version control
  • Ignoring performance

Instead Do This

  • Use environment variables
  • Handle errors gracefully
  • Write comprehensive tests
  • Write descriptive commits
  • Commit early and often
  • Profile and optimize