Introduction
Softbee is a comprehensive beekeeping management SaaS application that helps beekeepers manage their apiaries, track beehive health, monitor inspections, manage inventory, and handle authentication. Each feature is built as a self-contained module following Clean Architecture principles.Feature Modules
The application consists of five core feature modules:Authentication
User registration, login, password recovery, and session management
Apiaries
Manage multiple apiaries with location tracking and settings
Beehives
Track individual beehives with health metrics and status
Monitoring
Conduct inspections with customizable questions and responses
Inventory
Manage equipment, supplies, and materials with stock tracking
Authentication Feature
Location:lib/feature/auth/
The authentication feature handles user identity, session management, and access control across the application.
Core Entities
User (lib/feature/auth/core/entities/user.dart)
Key Features
User Registration
User Registration
New users can create accounts with email and password. The system validates input and creates user profiles.Use Case:
RegisterUseCase- Validates email format and password strength
- Checks for existing users
- Creates new user account
- Returns user data or registration failure
Login & Session Management
Login & Session Management
Users authenticate with credentials and receive a JWT token for subsequent requests.Use Case:
LoginUseCase- Validates credentials
- Retrieves JWT token from server
- Stores token locally for session persistence
- Returns user data with authentication state
CheckAuthStatusUseCase- Checks for existing token
- Validates token expiration
- Restores user session on app launch
Password Recovery
Password Recovery
Users can reset forgotten passwords via email verification.Pages:
ForgotPasswordPage: Request password resetResetPasswordPage: Set new password with reset token
User Management
User Management
Administrators can view and manage user accounts.Page:
UserManagementPage- View all users
- Update user status
- Manage permissions
Data Sources
Remote Data Source:AuthRemoteDataSource
- POST
/api/v1/auth/register- Create new user - POST
/api/v1/auth/login- Authenticate user - POST
/api/v1/auth/forgot-password- Request password reset - POST
/api/v1/auth/reset-password- Reset password with token
AuthLocalDataSource
- Store/retrieve JWT token using secure storage
- Persist user session across app restarts
- Clear token on logout
State Management
AuthController manages authentication state:login(email, password)- Authenticate userregister(username, email, password)- Create accountlogout()- Clear session and tokencheckAuthStatus()- Restore session on app start
Apiaries Feature
Location:lib/feature/apiaries/
Apiaries are the primary organizational unit in beekeeping. This feature manages multiple apiary locations with their associated settings.
Core Entity
Apiary (lib/feature/apiaries/domain/entities/apiary.dart)
Key Features
- CRUD Operations
- Search & Filter
- Apiary Settings
Create, Read, Update, Delete apiariesUse Cases:
GetApiariesUseCase- Fetch all user’s apiariesCreateApiaryUseCase- Add new apiaryUpdateApiaryUseCase- Modify apiary detailsDeleteApiaryUseCase- Remove apiary
Presentation Components
Pages:- Main apiary dashboard with list view
ApiarySettingsPage- Configure apiaryHivesPage- View beehives in apiaryInventoryPage- Manage inventoryReportsPage- Analytics and reports
ApiaryCard- Display apiary summaryApiaryFormDialog- Create/edit apiary formApiariesMenu- Navigation menu for apiary actions
State Structure
Beehives Feature
Location:lib/feature/beehive/
Individual beehive tracking with health metrics, status monitoring, and detailed observations.
Core Entity
Beehive (lib/feature/beehive/domain/entities/beehive.dart)
Key Attributes
Activity Level
Low, Medium, High - Tracks hive activity
Population
Small, Medium, Large - Bee colony size
Health Status
Healthy, At Risk, Unhealthy
Health Metrics
The beehive entity tracks several critical health indicators: Frame Counts:- Food Frames: Frames with honey/nectar stores
- Brood Frames: Frames with eggs, larvae, and pupae
- Hive Status: Active, Inactive, Queenless, etc.
- Health Status: Overall colony health
- Production Chamber: Whether a honey super is installed
Enums
The feature includes enums for standardized status values: Location:lib/feature/beehive/domain/enums/
- Activity levels
- Population sizes
- Health statuses
- Hive statuses
Use Cases
Beehive operations include:- Get Beehives - Fetch all beehives for an apiary
- Create Beehive - Add new beehive to apiary
- Update Beehive - Modify beehive data
- Delete Beehive - Remove beehive from tracking
Data Flow
Remote Data Source:BeehiveRemoteDataSource
- GET
/api/v1/beehives?apiary_id={id}- List beehives - POST
/api/v1/beehives- Create beehive - PUT
/api/v1/beehives/{id}- Update beehive - DELETE
/api/v1/beehives/{id}- Delete beehive
BeehiveRepository
- Handles authentication
- Manages error conversion
- Returns
Either<Failure, Beehive>
Monitoring Feature
Location:lib/feature/monitoring/
The monitoring feature enables customizable inspection workflows with dynamic question sets.
Core Entity
Pregunta (Question) (lib/feature/monitoring/domain/entities/question_model.dart)
Question Types
The monitoring system supports multiple question types:- Text
- Numeric
- Choice
- Rating
Free-text responsesUsers can enter any text response.Example:
- “Describe the colony’s behavior”
- “Additional observations”
Customization
Apiary-Specific Questions: Questions are scoped to individual apiaries (apiarioId), allowing different inspection protocols per location.
Categorization:
Questions can be grouped by category:
- Colony Health
- Queen Status
- Food Stores
- Pest/Disease Indicators
- Equipment Condition
orden field controls question sequence during inspections.
Workflow
- Define Questions - Set up inspection checklist for apiary
- Conduct Inspection - Answer questions for each beehive
- Record Responses - Store inspection data
- Review History - Analyze trends over time
Inventory Feature
Location:lib/feature/inventory/
Track equipment, supplies, and materials with stock levels and low-stock alerts.
Core Model
InventoryItem (lib/feature/inventory/data/models/inventory_item.dart)
Key Features
Inventory Management
Inventory Management
CRUD operations for inventory items
- Create new items with initial quantity
- Update item details and quantities
- Delete obsolete items
- View all items for an apiary
Quantity Adjustments
Quantity Adjustments
Track inventory changes over timeAdjust quantities without replacing entire item:Record inventory exits with accountability:
Search & Analytics
Search & Analytics
Find items and analyze stock levelsSearch:Low Stock Alerts:Items where Returns total items, total value, low stock count, etc.
quantity <= minimumStock are flagged.Summary Statistics:Unit Types
Inventory items support various units:- Pieces - Individual items (frames, boxes, tools)
- Liters - Liquid volumes (syrup, medications)
- Kilograms - Weight-based (sugar, wax)
- Boxes - Bulk packaging
- Custom - User-defined units
Common Inventory Items
Equipment:- Frames (various types)
- Hive boxes (deeps, mediums, shallows)
- Feeders
- Queen excluders
- Sugar (for syrup)
- Medications/treatments
- Foundation wax
- Protective gear
- Hive tools
- Smokers
- Brushes
- Extractors
Feature Integration
Features work together to provide comprehensive apiary management:Example Workflow
- User logs in (Authentication)
- Selects an apiary (Apiaries)
- Views beehives in that apiary (Beehives)
- Conducts inspection with custom questions (Monitoring)
- Updates beehive health based on findings (Beehives)
- Records treatment usage from inventory (Inventory)
Shared Core Components
All features leverage shared core utilities:Error Handling
Failure Classes (lib/core/error/failures.dart)
Either<Failure, T> for type-safe error handling.
Use Case Base Class
UseCase (lib/core/usecase/usecase.dart)
Networking
DioClient (lib/core/network/dio_client.dart)
Centralized HTTP client configuration:
- Platform-specific base URLs
- Timeout settings
- Default headers
- Provided via Riverpod
Routing
AppRouter (lib/core/router/app_router.dart)
Declarative navigation using go_router:
- Route definitions
- Authentication guards
- Deep linking support
Widgets
Shared Components (lib/core/widgets/)
Reusable UI components:
DashboardMenu- Main navigationHoneycombLoader- Custom loading indicatorMenuInfoApiario- Apiary info display
Technology Stack
Flutter
Cross-platform UI framework (iOS, Android, Web)
Riverpod
State management with compile-time safety
Dio
HTTP client for API communication
Either Dart
Functional error handling with Either type
Equatable
Value equality for entities and states
Go Router
Declarative routing and navigation
Feature Expansion
The modular architecture makes it easy to add new features: Potential future features:- Honey Production Tracking - Record harvests and yields
- Financial Management - Track expenses and revenue
- Weather Integration - Correlate inspections with weather data
- Queen Breeding - Manage queen rearing operations
- Collaboration - Share apiaries with other beekeepers
- Analytics Dashboard - Advanced reporting and insights
Best Practices
When working with features:Single Responsibility - Each feature handles one business domain
Loose Coupling - Features communicate through well-defined interfaces
High Cohesion - Related functionality stays together within a feature
Dependency Inversion - Depend on abstractions, not concrete implementations
Next Steps
Application Architecture
Understand the overall app structure
Clean Architecture
Deep dive into Domain, Data, and Presentation layers