Skip to main content

Iteration Zero

Executive Overview

This Iteration Zero document establishes the foundation for the Roll Claw project - a specialized colony management system for feral cat caretakers. It defines the technical environment, processes, and infrastructure necessary for successful implementation of our First Basecamp, with a focus on our initial thin vertical slice: Cat Sighting Recording & Retrieval.

Roll Claw addresses critical pain points in feral cat colony management by providing reliable tracking of cats, streamlined health monitoring, and coordinated volunteer task management—all functioning seamlessly in the offline environments where colony care typically occurs.

1. Strategic Foundation

Top of the Mountain Vision

Our ultimate vision is to transform daily colony care from a worry-filled guessing game into a confident, organized practice. Roll Claw will ensure:

  • Every cat is accounted for and receives necessary attention
  • Tasks are clearly assigned and tracked
  • Health concerns are promptly identified and addressed
  • Volunteers can coordinate seamlessly, even when working at different times
  • The system works reliably in field conditions with limited connectivity

High-Risk "Monkeys"

  1. Event Sourcing Implementation: Building a reliable event-based history tracking system
  2. Offline Synchronization: Ensuring data integrity when moving between offline and online states
  3. Multi-user Coordination: Managing potential conflicts between caretakers
  4. Complex Domain Modeling: Accurately representing the various entities and relationships

First Basecamp Goal

Our First Basecamp delivers the smallest viable set of features that provides real value to colony caretakers:

  1. Quick Cat Sighting Recording: Fast, offline-capable interface for tracking cat presence
  2. Missing Cat Detection: Alerts for cats not seen within expected timeframes
  3. Basic Health Status Tracking: Simple health issue recording and alerting
  4. Essential Task Management: Clear assignment and verification of care tasks
  5. Colony Location Definition: Basic structure for organizing where cats are seen

Thin Vertical Slice Strategy

Our initial thin vertical slice will be Cat Sighting Recording & Retrieval because it:

  • Touches all layers of our architecture
  • Tests our core event-sourcing implementation
  • Validates offline functionality in a focused context
  • Provides immediate value to caretakers

2. Technical Architecture

System Architecture

Event Sourcing Foundation

  • Event Store: Implementation using a combination of:
    • PostgreSQL for server-side persistent storage
    • IndexedDB for client-side offline storage
  • Event Types: Versioned schema with clear upgrade paths
  • Event Synchronization: Two-way sync with conflict resolution
  • Projections: Materialized views derived from event streams

Application Architecture

  • Backend:

    • Elixir with Phoenix framework for API and web server
    • Ecto for database interactions and domain modeling
    • PostgreSQL for data persistence
    • GenServer and OTP for managing concurrent processes and state
    • Phoenix PubSub for real-time notifications
  • Frontend:

    • Phoenix LiveView for interactive UI components
    • Tailwind CSS for styling and responsive design
    • Petal Components for UI component library
    • Progressive Web App (PWA) capabilities with service workers
    • IndexedDB for client-side offline storage

Infrastructure

  • Hosting: AWS ECS for containerized deployment
  • CDN: CloudFront for static asset delivery
  • Storage: S3 for image and file storage
  • Monitoring: CloudWatch with custom metrics
  • CI/CD: GitHub Actions for automated testing and deployment

Security Approach

Authentication & Authorization

  • Guardian for token-based authentication
  • Role-based access control (Colony Manager, Volunteer, Read-only)
  • Secure credential storage with device-level encryption

Data Security

  • End-to-end encryption for sensitive colony location data
  • Data minimization principles for mobile storage
  • Strict colony-level access controls
  • Automatic data pruning for mobile clients

Compliance

  • GDPR-compliant data handling
  • Secure volunteer information management
  • Clear data retention and privacy policies

3. Development Framework

Technology Stack

  • Programming Languages:

    • Elixir for backend development
    • JavaScript for client-side functionality
    • SQL for database queries
  • Frameworks & Libraries:

    • Phoenix framework for web server and API
    • Phoenix LiveView for interactive UI
    • Ecto for database interactions
    • Tailwind CSS for styling
    • Petal Components for UI component library
    • ExUnit for testing
  • Development Tools:

    • Docker for containerization
    • Credo for code quality
    • Mix for build and dependency management
    • IEx for interactive debugging
    • LiveBook for collaborative development

Development Environment

  • Version Control: GitHub with protected main branch
  • Environment Management: Docker Compose for local development
  • Local Development: Hot-reloading with Phoenix live reload
  • Testing Environment: Automated setup with seed data
  • Staging Environment: Mirrors production with sanitized data

CI/CD Pipeline

  • Continuous Integration: Automated testing on PR creation
  • Deployment Pipeline: Automated staging deployment, manual production promotion
  • Quality Gates: Code coverage requirements, linting validation, performance testing
  • Release Management: Semantic versioning with automated changelog

4. Technical Risk Analysis & Mitigation

Risk CategoryRisk DescriptionSeverityMitigation Strategy
Offline SyncData conflicts between multiple offline usersHighStart with simplified conflict resolution; implement explicit user-facing conflict resolution UI; use last-writer-wins for non-critical data
Event SourcingPerformance degradation with large event historyMediumImplement snapshot projections; optimize query patterns; leverage Elixir's concurrency for processing; limit client-side event history depth
Mobile StorageDevice storage limitations for offline dataMediumImplement data pruning strategies; prioritize recent and critical data; clear guidance on storage requirements
Domain ComplexityInsufficient flexibility in data model for complex colony relationshipsMediumLeverage Elixir's pattern matching and Ecto's schema flexibility; start with minimum viable domain model; validate with real colony data from Lime Factory
User AdoptionResistance to technology from less tech-savvy volunteersMediumExtremely simplified LiveView interfaces; minimal required fields; quick-entry forms; comprehensive onboarding
SecurityProtection of sensitive colony location dataHighEnd-to-end encryption; strict access controls; data minimization; remote wipe capability
ConnectivityHandling extremely poor or intermittent connectivityHighRobust error handling; LiveView disconnect recovery; background synchronization; clear sync status indicators

5. Development Plan

Initial Thin Vertical Slice Implementation

Week 1-2: Environment Setup & Architecture Foundation

  • Establish development environment with Docker Compose
  • Set up CI/CD pipeline with GitHub Actions
  • Create initial Phoenix project structure
  • Define core event schemas for Cat entity and Sighting events

Week 3-4: Core Domain Implementation

  • Implement basic Cat entity and Sighting event models with Ecto
  • Create command handlers for cat registration and sighting recording
  • Develop projection logic for cat profiles and last-seen status
  • Establish test framework with ExUnit for domain logic

Week 5-6: Data Storage & Synchronization

  • Implement PostgreSQL event store for server-side persistence
  • Develop IndexedDB storage for offline client-side operation
  • Create synchronization mechanism for offline-to-online transfer
  • Build conflict detection and basic resolution strategies

Week 7-8: LiveView UI Implementation

  • Develop PWA shell with offline capabilities
  • Create responsive, mobile-first UI components with LiveView and Tailwind
  • Implement quick-entry forms for cat sighting using Petal Components
  • Build cat profile and timeline views

Week 9-10: Integration & Proof of Concept

  • Connect all layers for end-to-end functionality
  • Perform extensive field testing in low-connectivity scenarios
  • Refine synchronization based on real-world usage
  • Optimize performance and reliability

Proof of Concept Success Criteria

  1. Functional Requirements:

    • Register a new cat with basic details
    • Record a cat sighting while offline
    • View sighting history when back online
    • Receive alerts for cats not seen recently
    • Update cat information
  2. Technical Requirements:

    • Events successfully stored locally when offline
    • Data correctly synchronizes when connection is restored
    • No data loss during connectivity transitions
    • Proper handling of concurrent edits
    • Acceptable performance on mid-range mobile devices

6. Tools & Environment Setup

Development Tools

  • IDE: VS Code with ElixirLS extension
  • Version Control: GitHub
  • Project Management: Jira for task tracking
  • Documentation: Markdown in repository with diagrams
  • Communication: Slack for team coordination
  • Knowledge Base: Confluence for shared documentation

Infrastructure Setup

  • Cloud Provider: AWS
  • Container Registry: ECR for Docker images
  • Database: RDS for PostgreSQL
  • Cache/Messaging: ElastiCache for Redis (optional)
  • Static Assets: S3 with CloudFront CDN
  • Domains/DNS: Route 53 with ACM for SSL/TLS

Local Development Environment

  • Docker Compose for service orchestration
  • Local PostgreSQL instance
  • Convenient Mix tasks for common operations
  • Hot-reloading with Phoenix LiveView
  • Seed data scripts for testing scenarios

7. Team Structure & Communication

Core Team

  • Technical Lead: Architecture and technical direction
  • Elixir Developer: Backend and event sourcing implementation
  • LiveView Developer: UI/UX and offline capabilities
  • Full-stack Developer: Integration and DevOps
  • QA Engineer: Testing strategy and automation

Supporting Roles

  • Product Owner: Requirements and prioritization
  • UX Designer: Mobile-first interface design
  • Domain Expert: Colony management subject matter expertise

Communication Cadence

  • Daily standup meetings (15 minutes)
  • Weekly technical review session (1 hour)
  • Bi-weekly demo and feedback with stakeholders
  • Monthly retrospective and planning
  • Asynchronous updates via Slack and Jira

8. Quality Assurance Strategy

Testing Approach

  • Unit Testing: ExUnit for module and function testing
  • Integration Testing: Phoenix integration tests
  • End-to-End Testing: Wallaby for browser testing
  • Mobile Testing: Device testing on Android and iOS
  • Offline Testing: Simulated connectivity scenarios
  • Performance Testing: Load testing for synchronization events

QA Environments

  • Local: Developer environments for immediate testing
  • CI: Automated testing on every pull request
  • Staging: Pre-production environment with synthetic data
  • Field Testing: Beta testing with selected colony caretakers

Quality Gates

  • Code review required for all PRs
  • 80% test coverage minimum
  • Successful E2E test suite execution
  • Performance benchmarks for critical operations
  • Accessibility compliance for UI components

9. Security & Compliance Framework

Data Classification

  • High Sensitivity: Colony location data, volunteer personal information
  • Medium Sensitivity: Cat health information, colony population data
  • Low Sensitivity: General task management information

Security Controls

  • Authentication: Guardian-based authentication with secure token management
  • Authorization: Role-based access with fine-grained permissions
  • Data Encryption: At-rest and in-transit encryption
  • API Security: Rate limiting, input validation, OWASP compliance
  • Mobile Security: Secure local storage, biometric authentication option

Compliance Requirements

  • GDPR compliance for EU users
  • CCPA compliance for California users
  • Responsible data minimization practices
  • Clear privacy policy and terms of service

10. Immediate Next Steps

Week 1 Action Items

  1. Set up GitHub repository with branch protection rules
  2. Configure development environment with Docker Compose
  3. Create initial Phoenix project with LiveView setup
  4. Define core event schemas for Cat and Sighting
  5. Establish CI pipeline with basic linting and testing

Key Decisions Required

  1. PWA vs. Native App: Confirm PWA approach with potential native wrapper later
  2. Sync Strategy: Finalize approach for event synchronization conflicts
  3. Testing Strategy: Confirm test coverage requirements and tooling
  4. MVP Scope: Final confirmation on thin vertical slice boundaries

Dependencies to Resolve

  1. AWS account access and permissions
  2. Domain registration for development environments
  3. Test devices for mobile compatibility testing
  4. Access to colony management experts for domain validation

Summary

This Iteration Zero document establishes a comprehensive foundation for the Roll Claw project. By focusing initially on the Cat Sighting Recording & Retrieval vertical slice, we can validate our core technical approach while delivering immediate value to users. The Elixir/Phoenix/LiveView stack offers excellent support for our event-sourcing architecture and real-time features, while providing a path to offline functionality through progressive enhancement.

The successful completion of this Iteration Zero phase will position the team to efficiently build toward First Basecamp, with a solid technical foundation and clear understanding of the challenges and solutions involved in creating a reliable colony management system that works where and when caretakers need it.