10 KiB
POWR Controlled Restart Plan
Overview
POWR is transitioning from a traditional fitness tracking application to a decentralized platform utilizing the Nostr protocol. This document outlines the plan for a controlled restart that prioritizes local-first functionality while preparing for Nostr integration.
Current State Assessment
Core Functionality
- Workout tracking and management
- Exercise and template library
- Local data storage
- Early Nostr integration attempts
Key Challenges
-
Data Structure Misalignment
- Complex type hierarchies
- Overlapping interfaces
- Future Nostr integration difficulties
-
State Management
- Growing complexity in WorkoutContext
- Mixed concerns between local and network
- Auto-save and persistence challenges
-
User Experience
- Unclear content ownership
- Complex template management
- Limited sharing capabilities
Restart Goals
Primary Objectives
-
Local-First Architecture
- All core features work offline
- Clean data structures
- Clear state management
-
User Experience
- Maintain familiar workout tracking
- Improve template management
- Clear content ownership
-
Nostr Readiness
- Aligned data structures
- Clear sharing model
- Metadata management
Architecture Decisions
Content Organization
Library/
├── Exercises/
│ ├── My Exercises
│ ├── Saved Exercises
│ └── Exercise History
│
├── Workouts/
│ ├── My Templates
│ ├── Saved Templates
│ └── Workout History
│
└── Programs/ (Coming Soon)
├── Active Programs
├── Saved Programs
└── Program History
User Interface Patterns
-
Content Cards
- Quick preview information
- Source indicators (Local/Nostr)
- Action buttons
-
Preview Modal
- Detailed content view
- Primary actions (Start/Add/Edit)
- Access to technical details
-
Technical Panel
- Nostr metadata
- Event IDs
- Relay information
Data Flow
Local Storage (Primary)
↓
User Actions
↓
Optional Nostr Sync
Component Architecture
Component Usage Map
Navigation/
├── Home Tab
│ ├── Quick Start Section
│ │ └── ContentCard (Recent/Favorite Workouts)
│ └── Current Progress
│
├── Library Tab
│ ├── Exercises Section
│ │ ├── ContentCard (Exercise Templates)
│ │ ├── PreviewModal (Exercise Details)
│ │ └── TechnicalPanel (if Nostr-sourced)
│ │
│ ├── Workouts Section
│ │ ├── ContentCard (Workout Templates)
│ │ ├── PreviewModal (Workout Details)
│ │ └── TechnicalPanel (if Nostr-sourced)
│ │
│ └── Programs Section (Coming Soon)
│ └── ContentCard (Placeholder)
│
├── Social Tab
│ ├── Discovery Feed
│ │ ├── ContentCard (Shared Templates)
│ │ ├── PreviewModal (Template Details)
│ │ └── TechnicalPanel (Nostr Details)
│ └── User Profiles
│
└── History Tab
└── ContentCard (Past Workouts)
Active Workout Screen
├── Exercise List
└── ContentCard (Current Exercise)
Core Components
-
Content Display
ContentCard/ ├── Preview Image/Icon ├── Basic Info │ ├── Title │ ├── Description │ └── Source Indicator ├── Quick Actions └── Click Handler → Preview Modal PreviewModal/ ├── Content Details │ ├── Full Description │ ├── Exercise List/Details │ └── Usage Stats ├── Action Buttons │ ├── Primary (Start/Add) │ ├── Secondary (Edit/Share) │ └── Info Button └── Technical Panel (expandable) TechnicalPanel/ ├── Event Information ├── Relay Details └── Sharing Status
-
Form Components
ExerciseForm/ ├── Basic Info ├── Set Configuration └── Equipment Selection WorkoutForm/ ├── Basic Info ├── Exercise Selection └── Template Options
-
Workout Interface
ActiveWorkout/ ├── Exercise List ├── Set Tracking ├── Rest Timer └── Progress Indicators
User Flows
- Template Creation
sequenceDiagram
actor User
participant UI
participant Context
participant Storage
User->>UI: Click "Create Template"
UI->>UI: Show Template Form
User->>UI: Fill Details
UI->>Context: Submit Template
Context->>Storage: Save Local Copy
Storage-->>Context: Confirm Save
Context-->>UI: Update Success
UI->>UI: Show Preview Modal
User->>UI: Optional: Share to Nostr
User Flows
- Creating Template
sequenceDiagram
actor User
participant UI
participant Context
participant Storage
User->>UI: Click "Create Template"
UI->>UI: Show Template Form
User->>UI: Fill Details
UI->>Context: Submit Template
Context->>Storage: Save Local Copy
Storage-->>Context: Confirm Save
Context-->>UI: Update Success
UI->>UI: Show Preview Modal
User->>UI: Optional: Share to Nostr
- Starting Workout from Template
sequenceDiagram
actor User
participant UI
participant Context
participant Storage
User->>UI: Select Template
UI->>UI: Show Preview Modal
User->>UI: Click "Start Workout"
UI->>Context: Initialize Workout
Context->>Storage: Create Session
Storage-->>Context: Session Ready
Context-->>UI: Show Active Workout
User->>UI: Track Exercise Sets
- Saving Discovered Template
sequenceDiagram
actor User
participant UI
participant Context
participant Storage
participant NostrContext
User->>UI: Browse Social Feed
User->>UI: Click Template Card
UI->>NostrContext: Fetch Full Details
NostrContext-->>UI: Template Data
UI->>UI: Show Preview Modal
User->>UI: Click "Save to Library"
UI->>Context: Create Local Copy
Context->>Storage: Save Template
Storage-->>Context: Confirm Save
Context-->>UI: Update Library
UI->>UI: Show Success State
- Sharing Workout
sequenceDiagram
actor User
participant UI
participant Context
participant NostrContext
User->>UI: View Workout Details
User->>UI: Click Share Button
UI->>UI: Show Share Options
User->>UI: Confirm Share
UI->>Context: Get Workout Data
Context->>NostrContext: Create Nostr Event
NostrContext->>NostrContext: Sign Event
NostrContext->>NostrContext: Publish to Relays
NostrContext-->>UI: Share Success
UI->>UI: Update Share Status
Existing Solutions Integration
NDK Mobile Resources
-
Core Components
- SQLite Cache Adapter for template/workout storage
- Session Management for user profiles and signing
- Event Subscription system for content discovery
- Built-in relay management
-
Implementation Benefits
- Pre-built SQLite schema and migrations
- Automatic event caching and deduplication
- Profile management system
- Connection handling
Olas Patterns
-
State Management
- Session store patterns
- Event caching approach
- Profile management
-
UI Components
- Event card patterns
- Preview/detail views
- Action handling
-
Event Handling Patterns
- Content discovery
- Template sharing
- Social interactions
Development Phases and Components
Phase 1: Core Components Review
Components to Reuse
-
Active Workout Interface
- Exercise tracking ✓
- Set logging ✓
- Rest timer ✓
- Basic stats ✓
-
Form Components
- Exercise form ✓
- Basic input fields ✓
- Validation logic ✓
-
Navigation
- Tab structure ✓
- Basic routing ✓
Components to Rebuild
-
Content Display
- ContentCard (new design)
- PreviewModal (enhanced)
- TechnicalPanel (new)
-
Library Management
- Template organization
- Content filtering
- Search interface
-
Social Integration
- Discovery feed
- Share interface
- Profile views
Phase 2: Feature Implementation
Week 1-2: Core UI
- Build ContentCard component
- Implement PreviewModal
- Create TechnicalPanel
- Update navigation flow
Week 3-4: Library System
- Implement new library structure
- Build template management
- Add search/filter capabilities
- Create exercise library
Week 5-6: Local Features
- Complete workout tracking
- Add template system
- Implement history
- Add basic stats
Week 7-8: Nostr Integration
- Add sharing capabilities
- Implement discovery
- Build social features
- Add technical details view
sequenceDiagram
actor User
participant UI
participant Context
participant Storage
User->>UI: Select Template
UI->>UI: Show Preview Modal
User->>UI: Click "Start Workout"
UI->>Context: Initialize Workout
Context->>Storage: Create Session
Storage-->>Context: Session Ready
Context-->>UI: Show Active Workout
User->>UI: Track Exercise Sets
Implementation Strategy
Phase 1: Core Infrastructure
-
Data Structures
- Define base types
- Implement storage models
- Create type validators
-
State Management
- Implement WorkoutContext
- Setup storage service
- Add auto-save logic
-
UI Components
- Build reusable components
- Implement content cards
- Create preview modals
Phase 2: Template System
-
Exercise Management
- Exercise creation
- Template storage
- History tracking
-
Workout Templates
- Template creation
- Usage tracking
- Version management
Phase 3: Nostr Integration
-
Basic Integration
- Event structure alignment
- Local/Nostr bridging
- Sharing mechanics
-
Social Features
- Content discovery
- Template sharing
- User interactions