CrittrHavens Developer Documentation 🛠️

Welcome to the technical documentation for CrittrHavens - a modern pet care management application built with React, TypeScript, and Supabase.

Hey Developer! 👩‍💻👨‍💻

Whether you're a seasoned pro or just starting your coding journey, this documentation will guide you through the CrittrHavens codebase. We've written everything in plain language with lots of examples - no computer science degree required!

🎯 Quick Start for Developers

🏗️ Architecture Overview

CrittrHavens is a single-page application (SPA) built with modern web technologies:

graph TB
    subgraph "Frontend"
        A[React App] --> B[TypeScript]
        A --> C[Tailwind CSS]
        A --> D[shadcn/ui]
    end
    
    subgraph "State & Data"
        E[React Query] --> F[Supabase Client]
    end
    
    subgraph "Backend"
        F --> G[PostgreSQL]
        F --> H[Auth]
        F --> I[Storage]
        F --> J[Edge Functions]
    end
    
    A --> E

Tech Stack Explained

TechnologyWhat It DoesWhy We Use It
React 18Builds the user interfaceIndustry standard, huge community
TypeScriptAdds types to JavaScriptCatches bugs before they happen
ViteDevelopment server & bundlerLightning fast builds
Tailwind CSSUtility-first stylingConsistent, responsive design
shadcn/uiComponent libraryBeautiful, accessible components
React QueryServer state managementCaching, syncing, and updates
SupabaseBackend-as-a-ServiceDatabase, auth, storage in one
CapacitorMobile app wrapperDeploy to iOS/Android

📁 Project Structure

CrittrHavens/
├── src/
│   ├── components/     # Reusable UI components
│   │   ├── ui/        # Basic UI elements (buttons, cards)
│   │   ├── care/      # Care-related components
│   │   ├── inventory/ # Inventory components
│   │   └── tasks/     # Task management
│   ├── pages/         # Full page components
│   ├── hooks/         # Custom React hooks
│   ├── lib/           # Utility functions
│   └── types/         # TypeScript definitions
├── supabase/
│   ├── migrations/    # Database schema changes
│   └── functions/     # Server-side functions
└── docs/             # This documentation!

🚦 Development Workflow

1. Pick a Task Browse GitHub Issues for something to work on

2. Create Branch

git checkout -b feature/your-feature

3. Make Changes Write code, add tests, update docs

4. Test Locally

npm run dev  # Start dev server
npm test     # Run tests

5. Submit PR Push your branch and create a pull request

📚 Documentation Sections

🎓 Learning Path (Start Here If New)

  1. Developer Quickstart - Core workflows and implementation details
  2. Development Workflow - What you need on your computer
  3. Component Guide - Understanding components and state
  4. State Management - Managing application state
  5. Testing Guide - Writing and running tests

🔧 Core Concepts

🏗️ Feature Implementation

Learn how major features work:

🧪 Testing & Quality

🚀 Deployment & DevOps

💡 Key Patterns You'll See

Component Pattern

// Simple, typed functional component
interface PetCardProps {
  name: string;
  species: string;
  imageUrl?: string;
}

export function PetCard({ name, species, imageUrl }: PetCardProps) {
  return (
    <Card>
      <CardHeader>
        <h3>{name}</h3>
        <p>{species}</p>
      </CardHeader>
    </Card>
  );
}

Hook Pattern

// Custom hook for data fetching
export function usePets() {
  return useQuery({
    queryKey: ['pets'],
    queryFn: fetchPets,
  });
}

Form Pattern

// Type-safe forms with Zod
const schema = z.object({
  name: z.string().min(1),
  species: z.string(),
});

🛠️ Development Tools

Essential Tools

  • VS Code with extensions
  • React DevTools
  • Git & GitHub Desktop
  • Node.js 18+

Helpful Tools

  • Supabase Dashboard
  • Postman for API testing
  • Chrome DevTools
  • Figma for designs

🤝 Getting Help

📖 Read the Docs Start with this documentation - we've tried to cover everything!

💬 Ask Questions Open a GitHub Discussion - no question is too basic!

🐛 Report Bugs Found something broken? Create an issue

👥 Community Join other developers working on CrittrHavens

🎯 Common Developer Tasks

First Day Tasks

  • Set up development environment
  • Run the app locally
  • Make a small text change
  • Submit your first PR

Regular Tasks

  • Add a new component
  • Update an existing feature
  • Write tests for your code
  • Update documentation
  • Review pull requests

Advanced Tasks

  • Optimize performance
  • Add new database tables
  • Create Edge Functions
  • Implement new features

📝 Code Philosophy

We believe in:

  • Readable code > clever code
  • User experience > developer convenience
  • Incremental improvements > perfect solutions
  • Tests > hoping it works
  • Documentation > tribal knowledge

🚀 Ready to Code?

Next Step: Developer Quickstart Guide

Remember: Every expert was once a beginner. We're here to help you succeed! 💪


This documentation is kept beginner-friendly on purpose. If you're an experienced developer, you'll find advanced topics in the specific sections.