Thank you for your interest in contributing to Metalore! This guide will help you understand how to contribute to different parts of the project.
Metalore is a Flutter-based LLM client application that provides a unified interface for interacting with multiple LLM providers. The project uses a feature-based modular architecture with local packages for LLM and MCP implementations.
- Getting Started
- Development Setup
- Project Structure
- Contributing to Different Parts
- Code Conventions
- Testing
- Documentation
- Flutter SDK (>= 3.10.0)
- Dart SDK (>= 3.10.0)
- Android Studio (for Android development)
- Xcode (for iOS/macOS development, macOS only)
- Git
-
Clone the repository:
git clone https://github.com/starfall-org/metalore.git cd metalore -
Install Flutter dependencies:
flutter pub get
-
Install dependencies for local packages:
cd llm && flutter pub get && cd .. cd mcp && flutter pub get && cd ..
-
Run code generation (for Hive adapters, JSON serialization):
flutter pub run build_runner build --delete-conflicting-outputs
-
Run the app:
flutter run
metalore/
├── lib/ # Main application code
│ ├── app/ # App-level widgets and configuration
│ ├── core/ # Core models, utilities, app routes
│ ├── features/ # Feature modules (ai, home, settings)
│ └── shared/ # Shared widgets and utilities
├── llm/ # LLM provider implementations
│ ├── lib/
│ │ ├── models/ # Request/response models
│ │ └── provider/ # Provider implementations
│ └── PROVIDER_API_PATTERN.md
├── mcp/ # MCP (Model Context Protocol) client
│ └── lib/
├── android/ # Android-specific code
├── ios/ # iOS-specific code
├── web/ # Web-specific code
├── linux/ # Linux-specific code
├── macos/ # macOS-specific code
├── windows/ # Windows-specific code
└── test/ # Test files
The main app follows a feature-based modular architecture. Each feature is self-contained with its own controllers, services, UI components, and utilities.
When to contribute:
- Adding new features
- Modifying existing UI
- Changing app-level configuration
- Updating routing or navigation
Key conventions:
- Each feature in
lib/features/has subdirectories:controllers/,services/,ui/,utils/ - Controllers extend
ChangeNotifierand callnotifyListeners()after state changes - Use UUID for IDs:
const Uuid().v4() - Use
tl('key')function for translations - Store data using Hive for models, SharedPreferences for settings
Example workflow:
- Create new feature in
lib/features/your_feature/ - Add controller, services, UI components as needed
- Register routes in
core/app_routes.dartandroutes.dart - Test on multiple platforms
The llm package contains implementations for various LLM providers (OpenAI, Anthropic, GoogleAI, Ollama, etc.).
When to contribute:
- Adding support for a new LLM provider
- Updating existing provider implementations
- Adding new endpoints to existing providers
- Fixing bugs in provider implementations
Key conventions:
- Follow the Provider API Pattern (see
llm/PROVIDER_API_PATTERN.md) - Each provider should have separate methods for each endpoint
- Use type-safe request/response models
- All models should use
@JsonSerializablefor serialization - Provider classes should follow the naming pattern:
{ProviderName}Provider
Example workflow:
- Create request/response models in
llm/lib/models/api/{provider}/ - Run code generation:
flutter pub run build_runner build - Implement provider in
llm/lib/provider/{provider}/{provider}.dart - Add provider enum to
core/models/ai/provider.dartin main app - Update tests if applicable
The mcp package implements the Model Context Protocol client for Metalore.
When to contribute:
- Implementing new MCP features
- Adding support for new MCP server types
- Improving MCP connection handling
- Fixing MCP-related bugs
Key conventions:
- Use
httppackage for network requests - Implement proper error handling
- Follow existing patterns in the package
- Ensure type safety with proper models
UI components and features are organized in the lib/features/ directory.
When to contribute:
- Creating new screens or widgets
- Improving existing UI
- Adding new settings or preferences
- Implementing user interactions
Key conventions:
- Use Material Design 3 components
- Support dynamic colors (via
dynamic_colorpackage) - Ensure responsive design for different screen sizes
- Follow Flutter best practices for widget composition
- Use proper state management (ChangeNotifier controllers)
Example workflow:
- Create UI in
lib/features/your_feature/ui/ - Create controller in
lib/features/your_feature/controllers/ - Add routes to
core/app_routes.dart - Test on different screen sizes
Platform-specific code is in directories like android/, ios/, web/, linux/, macos/, and windows/.
When to contribute:
- Adding platform-specific features
- Fixing platform-specific bugs
- Improving platform integration
- Adding native functionality
Key conventions:
- Keep platform-specific code minimal
- Use platform channels only when necessary
- Test on target platform before submitting
- Document any platform-specific limitations
Example workflow:
- Identify if feature needs native code
- Implement in appropriate platform directory
- Add platform channel if needed
- Test on target platform
- Follow official Dart style guide
- Use
flutter_lintsfor linting - Keep functions short and focused
- Use meaningful variable and function names
- Add type annotations for public APIs
- Controllers extend
ChangeNotifier - Call
notifyListeners()after state changes - Use
Future<void>for async operations - Handle errors with try-catch and show user feedback via
ScaffoldMessenger
- Use
@HiveTypefor Hive models - Extend
HiveBaseStoragefor storage classes - Register Hive types in
main.dartTypeAdapters list - Run
flutter pub run build_runner buildafter adding new Hive types
- Write unit tests for business logic
- Write widget tests for UI components
- Use
flutter_testframework - Maintain good test coverage
- Add comments for complex logic
- Document public APIs
- Explain non-obvious implementations
When adding significant features:
- Update feature list in
README.mdif applicable - Add documentation for new features
- Update version numbers if necessary
Each feature should have a feature.md file in its directory documenting:
- Purpose of the feature
- Key components
- How to extend or modify
- Related features or dependencies
# Run all tests
flutter test
# Run tests with coverage
flutter test --coverage
# Run tests for specific package
cd llm && flutter test
cd mcp && flutter testTest your changes on:
- Web (easiest for quick iteration)
- Android (or iOS) for mobile-specific features
- Desktop platforms if applicable
- Fork the repository
- Create a feature branch from
main - Make your changes
- Run tests and linting
- Ensure code follows conventions
- Update documentation if needed
- Submit a pull request with:
- Clear description of changes
- Related issues
- Screenshots for UI changes
- Testing notes
- Check existing issues for similar problems
- Review
llm/PROVIDER_API_PATTERN.mdfor provider patterns - Refer to
.github/copilot-instructions.mdfor architectural guidance - Open an issue for bugs or questions
By contributing, you agree that your contributions will be licensed under the same license as the project (Starfall License).