diff --git a/README.md b/README.md index e9633ee..0345e64 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,86 @@ -# Building a Mobile App with GitHub Copilot Agent Mode + MCP - -We will build a mobile app called GitBey that takes a user's GitHub handle and returns 5 BeyoncΓ© songs based on the vibe of their last 50 commits. The user should be able to play the songs in the app. - -Tech Stack: -- Flutter -- Dart -- GitHub Copilot Agent Mode -- Copilot Coding Agent -- GitHub Models -- Spotify API -- GitHub and Perplexity MCP Servers \ No newline at end of file +# 🎡 GitBey Workshop: AI-Powered GitHub Commit Sentiment Analyzer + +> **Transform your GitHub commits into BeyoncΓ© playlists using Flutter and AI!** + +Welcome to the GitBey Workshop! Learn to build a complete Flutter application that analyzes your GitHub commit history, determines your coding mood, and creates personalized BeyoncΓ© playlists. This **intensive 3-hour workshop** teaches **agentic development** - using AI assistants to accelerate your development workflow and build production-ready apps quickly. + +## πŸš€ What You'll Build + +**GitBey** is a Flutter app that: +- πŸ“Š Fetches your last 50 GitHub commits via REST API +- 🧠 Analyzes commit sentiment +- 🎢 Generates personalized BeyoncΓ© playlists using GitHub Models API +- 🎡 Provides audio playback with beautiful Flutter UI +- 🎨 Features modern Material Design with smooth animations + +## 🎯 Learning Outcomes + +By the end of this workshop, you'll understand: + +### πŸ”§ Technical Skills +- **Flutter Development**: Cross-platform mobile app development +- **API Integration**: GitHub REST API and AI services +- **Sentiment Analysis**: Local algorithms and AI-powered analysis +- **Audio Integration**: Spotify API and audio playback +- **Modern UI/UX**: Material Design, animations, responsive layouts + +### πŸ€– Agentic Development +- **AI-Assisted Coding**: Effective prompting techniques with AI assistants +- **Iterative Development**: Breaking complex features into AI-manageable tasks +- **Code Generation**: Using AI for boilerplate, testing, and documentation +- **Debugging with AI**: Leveraging AI for troubleshooting and optimization + +### πŸ—οΈ Architecture Patterns +- **Clean Architecture**: Service layers and separation of concerns +- **Error Handling**: Robust network and API error management +- **Security**: Secure API token management + +## πŸ“‹ Prerequisites + +Before starting, make sure you have: + +- [ ] **Flutter SDK** installed ([Installation Guide](https://docs.flutter.dev/get-started/install)) +- [ ] **Dart** (comes with Flutter) +- [ ] **Git** for version control +- [ ] **iOS Simulator** [set up](https://developer.apple.com/documentation/xcode/downloading-and-installing-additional-xcode-components) +- [ ] **VS Code** or preferred IDE with Flutter extensions +- [ ] **AI Assistant** (GitHub Copilot - sign up for FREE!) +- [ ] **GitHub Account** with access to your public commits +- [ ] **Willingness to learn** with AI assistance - perfect for beginners! + +### πŸ”‘ API Keys Required +- [ ] **GitHub Models API** token (your GitHub PAT) +- [ ] **Spotify Developer** credentials (optional, for future extensions) +- [ ] **GitHub Personal Access Token** for commit, repo, models, issues access ([Guide](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token)) +- [ ] **Perplexity API Key** for AI Research ([Sign Up](https://docs.perplexity.ai/guides/getting-started)) + +### MCP Servers + +- [ ] **Perplexity MCP Server** - For AI research and analysis ([Setup Guide](https://github.com/jsonallen/perplexity-mcp)) +- [ ] **GitHub MCP Server** - For interacting with GitHub ([Setup Guide](https://github.com/github/github-mcp-server)) +- [ ] **Setup Instructions for MCP Servers in VSCode** - [docs](https://code.visualstudio.com/docs/copilot/chat/mcp-servers). + + +## 🀝 Contributing + +This workshop is open source and community-driven: + +- πŸ› **Report bugs** or suggest improvements +- πŸ“ **Improve documentation** +- 🎨 **Add workshop materials** (slides, examples, tests) +- 🌍 **Translate** to other languages +- πŸ’‘ **Share extension ideas** + +See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines. + +## πŸ“„ License + +This workshop is licensed under [MIT License](LICENSE) - feel free to use it for your own workshops, courses, or learning! + +## πŸ™ Acknowledgments + +- **BeyoncΓ©** - For the amazing music that inspires our playlists πŸ‘‘ +- **Flutter Team** - For the incredible cross-platform framework +- **GitHub** - For the robust API and Models platform +- **Workshop Contributors** - Everyone who helped make this possible + diff --git a/SECURITY.md b/SECURITY.md index a190cc4..85d5be9 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -12,7 +12,7 @@ If you believe you have found a security vulnerability in any GitHub-owned repos **Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.** -Instead, please send an email to opensource-security[@]github.com. +Instead, please send an email to devrel[@]github.com. Please include as much of the information listed below as you can to help us better understand and resolve the issue: @@ -28,4 +28,4 @@ This information will help us triage your report more quickly. ## Policy -See [GitHub's Safe Harbor Policy](https://docs.github.com/en/github/site-policy/github-bug-bounty-program-legal-safe-harbor#1-safe-harbor-terms) \ No newline at end of file +See [GitHub's Safe Harbor Policy](https://docs.github.com/en/github/site-policy/github-bug-bounty-program-legal-safe-harbor#1-safe-harbor-terms) diff --git a/workshop/file-structure.md b/workshop/file-structure.md new file mode 100644 index 0000000..36f5054 --- /dev/null +++ b/workshop/file-structure.md @@ -0,0 +1,66 @@ +# GitBey Project File Structure + +## Config Layer +````markdown +lib/config/ +β”œβ”€β”€ api_config.dart (existing) +β”œβ”€β”€ api_tokens.dart (secured, gitignored) +└── environment.dart (new) +```` + +## Services Layer +````markdown +lib/services/ +β”œβ”€β”€ playlist_generator/ +β”‚ β”œβ”€β”€ playlist_generator_service.dart +β”‚ β”œβ”€β”€ playlist_generator_interface.dart +β”‚ └── models/ +β”‚ β”œβ”€β”€ playlist_response.dart +β”‚ └── playlist_request.dart +β”œβ”€β”€ sentiment/ +β”‚ β”œβ”€β”€ sentiment_analyzer.dart +β”‚ β”œβ”€β”€ sentiment_interface.dart +β”‚ └── models/ +β”‚ β”œβ”€β”€ sentiment_result.dart +β”‚ └── mood_categories.dart +└── github/ + β”œβ”€β”€ github_service.dart + └── models/ + └── commit_data.dart +```` + +## Models Layer +````markdown +lib/models/ +β”œβ”€β”€ playlist.dart +β”œβ”€β”€ song.dart +└── commit.dart +```` + +## Repository Layer +````markdown +lib/repositories/ +β”œβ”€β”€ playlist_repository.dart +└── github_repository.dart +```` + +## Utils Layer +````markdown +lib/utils/ +β”œβ”€β”€ connectivity_checker.dart +β”œβ”€β”€ error_handler.dart +└── logger.dart +```` + +## Tests +````markdown +test/ +β”œβ”€β”€ services/ +β”‚ β”œβ”€β”€ playlist_generator_test.dart +β”‚ └── sentiment_analyzer_test.dart +β”œβ”€β”€ models/ +β”‚ └── playlist_test.dart +└── utils/ + └── connectivity_checker_test.dart +```` + diff --git a/workshop/howtolaunch.md b/workshop/howtolaunch.md new file mode 100644 index 0000000..4856aa2 --- /dev/null +++ b/workshop/howtolaunch.md @@ -0,0 +1,169 @@ +# GitBey Flutter App Launch Guide + +A comprehensive guide for setting up and running the GitBey Flutter application on macOS and Windows. + +## Prerequisites + +Before launching the app, ensure you have the following installed: + +- **Flutter SDK** - Latest stable version +- **VS Code** with Flutter extension +- **Platform-specific tools:** + - **macOS/iOS**: Xcode (for iOS Simulator) + - **Windows/Android**: Android Studio with emulator configured +- **Git** (recommended: Git Bash for Windows) + +## Initial Setup Verification + +Verify your Flutter installation by running: + +```bash +flutter doctor +``` + +This command checks your development environment and reports any missing dependencies or configuration issues. + +## Platform-Specific Launch Instructions + +### macOS Development + +#### Starting the iOS Simulator + +Launch the iOS Simulator from your terminal: + +```bash +open -a Simulator +``` + +#### Running the App + +**Method 1: Using VS Code** +1. Open the Command Palette (`Cmd + Shift + P`) +2. Type "Flutter: Select Device" and select your simulator +3. Press `F5` or click the Run button in VS Code + +**Method 2: Using Terminal** +```bash +cd /Users/alacolombiadev/Desktop/Code/gitbey-andrea/gitbey +flutter run +``` + +### Windows Development + +#### Starting the Android Emulator + +**Method 1: Via Android Studio** +1. Open Android Studio +2. Navigate to `Tools > Device Manager` +3. Click the Play ▢️ button next to your preferred emulator + +**Method 2: Via Command Line** +```powershell +# List available emulators +flutter emulators + +# Launch specific emulator (replace with your emulator ID) +flutter emulators --launch Pixel_5_API_30 +``` + +#### Running the App + +**Method 1: Using VS Code** +1. Open the Command Palette (`Ctrl + Shift + P`) +2. Type "Flutter: Select Device" and select your emulator +3. Press `F5` or click the Run button + +**Method 2: Using Command Line** +```powershell +cd \path\to\gitbey-andrea\gitbey +flutter run +``` + +## Development Workflow + +### Hot Reload Commands + +Once your app is running, use these keyboard shortcuts in the terminal: + +- **`r`** - Hot reload (apply code changes instantly) +- **`R`** - Hot restart (restart the entire app) +- **`q`** - Quit the app + +### Device Management + +Check connected devices and simulators: + +```bash +flutter devices +``` + +## Troubleshooting + +### Build Issues + +If you encounter build problems, try cleaning and rebuilding: + +```bash +flutter clean +flutter pub get +flutter run +``` + +### iOS-Specific Issues (macOS) + +For iOS pod-related problems: + +```bash +cd ios +pod install +cd .. +flutter run +``` + +### Android-Specific Issues (Windows) + +**Device Detection Problems:** +```powershell +# Verify ADB connection +adb devices + +# Check Flutter device recognition +flutter devices +``` + +**Android License Issues:** +```powershell +flutter doctor --android-licenses +``` + +**PATH Configuration:** +If Flutter commands aren't recognized: +1. Search for "Environment Variables" in Windows +2. Edit the `Path` variable under User variables +3. Add your Flutter SDK's `bin` directory path + +### Simulator/Emulator Not Showing + +If your simulator or emulator doesn't appear in the device list: + +1. Ensure the simulator/emulator is fully started +2. Run `flutter devices` to verify detection +3. Try restarting VS Code or your terminal +4. Check that your emulator has sufficient system resources + +## Project Structure + +The GitBey app is located at: +``` +yourlocal directory +``` + +Navigate to this directory before running Flutter commands. + +## Additional Resources + +- **Flutter Documentation**: [flutter.dev](https://flutter.dev) +- **VS Code Flutter Extension**: Provides debugging, hot reload, and device management +- **Flutter Inspector**: Available in VS Code for UI debugging + +--- diff --git a/workshop/instructions.md b/workshop/instructions.md new file mode 100644 index 0000000..40d10f9 --- /dev/null +++ b/workshop/instructions.md @@ -0,0 +1,196 @@ +# 🎡 GitBey Workshop: Step-by-Step Guide + +> **Build a mobile app that transforms your GitHub commits into BeyoncΓ© playlists using Flutter and AI!** + +This workshop teaches you how to build GitBey - a Flutter app that analyzes your GitHub commit history and creates personalized BeyoncΓ© playlists based on your coding mood. + +## πŸ“‹ Prerequisites + +Before starting the workshop, ensure you have: + +- [ ] **iOS Simulator** installed via Xcode +- [ ] **Flutter SDK** installed and configured in VS Code +- [ ] **Git** installed on your system +- [ ] **GitHub Account** with public repositories +- [ ] **GitHub Copilot** subscription (free for students/open source) + +## πŸš€ Workshop Steps + +### Phase 1: Setup & Research + +#### Step 1: Fork and Clone Repository +```bash +# Fork the repository on GitHub, then: +git clone https://github.com/githubevents/gitbey +cd gitbey +``` + +#### Step 2: Configure MCP Servers +Add GitHub and Perplexity MCP Servers to your development environment for enhanced AI assistance. + +#### Step 3: Obtain API Keys +- **Perplexity API Key** for MCP research capabilities +- **GitHub Personal Access Token** (read, write, repo, issues permissions) + +#### Step 4: Environment Setup +```bash +# Create .env file and store your API keys +echo "PERPLEXITY_API_KEY=your_key_here" >> .env +echo "GITHUB_TOKEN=your_token_here" >> .env +``` + +#### Step 5: Research Phase +```bash +# Run the research prompt to analyze the app idea +Follow instructions from '.github/prompts/research.prompt.md' +``` + +### Phase 2: Planning & Specification + +#### Step 6: Generate Project Proposal +```bash +# Run the new project prompt +Follow instructions from '.github/prompts/new.prompt.md' +``` + +#### Step 7: Create Implementation Plan +```bash +# Generate detailed implementation plan +Follow instructions from '.github/prompts/plan.prompt.md' +# Uses the generated docs/idea.md file +``` + +#### Step 8: Create GitHub Issues +```bash +# Create project tracking issues +Prompt: "create an issue in this repo for this feature" +``` + +#### Step 9: Generate Feature Specifications +```bash +# Create detailed feature specs +Follow instructions from '.github/prompts/spec.prompt.md' +``` + +### Phase 3: Implementation + +#### Step 10: Implement GitHub API Integration +**Objective**: Fetch user's commit history from GitHub + +```bash +# Implement GitHub API service +Prompt: "implement step 1 in this issue and plan " +``` + +**API Endpoint**: `https://api.github.com/users/$enteredHandle/events/public?per_page=100` + +Key implementation points: +- Create GitHub service class +- Handle API authentication +- Parse commit data +- Error handling for network requests + +#### Step 11: Build Sentiment Analysis +**Objective**: Analyze commit messages to determine coding mood + +```bash +# Implement sentiment analysis +Prompt: "implement steps 2 and 3 (implement remaining steps from the spec)" +``` + +Implementation features: +- Local sentiment analysis algorithms +- Commit message preprocessing +- Mood classification (happy, frustrated, productive, etc.) +- Sentiment scoring system + +#### Step 12: Integrate AI Models +**Objective**: Generate BeyoncΓ© song recommendations using AI + +```bash +# Integrate GitHub Models API +Prompt: "I need help integrating the GitHub Models API into the GitBey Flutter app to generate personalized BeyoncΓ© song playlists based on GitHub commit sentiment analysis" +``` + +**GitHub Models API Configuration**: +- **Model**: `openai/gpt-4.1` +- **Endpoint** +- **Format**: Chat completions with system and user roles + +**Why GitHub Models?** +- Free tier available for developers +- High-quality AI models +- Seamless integration with GitHub ecosystem +- No separate billing setup required + +Implementation steps: +1. Create `PlaylistGenerator` class +2. Configure API authentication +3. Design prompt templates for song recommendations +4. Update `main.dart` to import the service + +#### Step 13: Audio Integration (Optional) +**Objective**: Enable song playback within the app + +Spotify API Integration: +- Set up Spotify Developer credentials +- Implement audio preview playback +- Create playlist UI components + +### Phase 4: Testing & Debugging + +#### Step 14: Iterative Development +Continue implementing features step by step: + +```bash +# For each new feature +Follow instructions from 'spec.prompt.md' +``` + +**Debug Process**: +1. Test each feature individually +2. Use GitHub Copilot for debugging assistance +3. Create new issues for bugs found +4. Implement fixes using AI-assisted development + +## 🎯 Key Learning Objectives + +### Technical Skills +- **Flutter Development**: Cross-platform mobile app creation +- **API Integration**: GitHub REST API and AI services +- **Sentiment Analysis**: Text processing and mood detection +- **AI Integration**: Using GitHub Models for content generation + +### Agentic Development +- **AI-Assisted Coding**: Effective prompting techniques +- **Iterative Development**: Breaking complex tasks into manageable pieces +- **Automated Documentation**: Using AI for code documentation +- **Debug Assistance**: Leveraging AI for troubleshooting + +## πŸ”§ Development Workflow + +1. **Plan**: Use AI prompts to generate specifications +2. **Implement**: Build features step-by-step with Copilot assistance +3. **Test**: Validate functionality on iOS simulator +4. **Debug**: Use AI to identify and fix issues +5. **Iterate**: Refine features based on testing + +## πŸ“± Expected App Features + +By the end of the workshop, your GitBey app will: +- βœ… Accept GitHub username input +- βœ… Fetch and display recent commits +- βœ… Analyze commit sentiment +- βœ… Generate personalized BeyoncΓ© playlists +- βœ… Display song recommendations with beautiful UI +- βœ… (Optional) Play song previews + +## πŸ€– AI-Powered Development Tips + +- **Use specific prompts**: Reference exact files and functions +- **Break down complex tasks**: Implement one feature at a time +- **Leverage context**: Include relevant code snippets in prompts +- **Iterate quickly**: Use AI for rapid prototyping and testing + + +**Happy coding with AI assistance! πŸš€** \ No newline at end of file diff --git a/workshop/model-info.md b/workshop/model-info.md new file mode 100644 index 0000000..1f5bc26 --- /dev/null +++ b/workshop/model-info.md @@ -0,0 +1,75 @@ +# GitHub Models Integration in GitBey + +GitHub Models is being used in this project as an AI service to analyze commit messages and generate BeyoncΓ© playlist recommendations. Here's a breakdown: + +## Configuration Setup +````dart +class ApiConfig { + static String get githubToken => ApiTokens.githubModelsToken; + static const String githubModelsEndpoint = "https://models.github.ai/inference"; + static const String aiModel = "openai/gpt-4.1"; +} +```` + +## How It Works + +1. **Authentication** + - The app uses a secure token stored in `ApiTokens` (gitignored) + - This token authenticates requests to GitHub Models API + +2. **API Integration** + - Endpoint: `https://models.github.ai/inference` + - Model: `openai/gpt-4.1` + - Used for natural language processing of commit messages + +3. **Workflow** + ```mermaid + graph LR + A[Fetch Commits] --> B[Format Prompt] + B --> C[Call GitHub Models API] + C --> D[Process Response] + D --> E[Generate Playlist] + ``` + +4. **Example Usage in PlaylistGenerator** +````dart +class PlaylistGenerator { + final String endpoint = ApiConfig.githubModelsEndpoint; + final String token = ApiConfig.githubToken; + + Future> analyzeCommits(List commits) async { + final response = await http.post( + Uri.parse(endpoint), + headers: { + 'Authorization': 'Bearer $token', + 'Content-Type': 'application/json', + }, + body: jsonEncode({ + 'model': ApiConfig.aiModel, + 'prompt': _formatCommitsPrompt(commits), + 'temperature': 0.7, + }), + ); + + return jsonDecode(response.body); + } +} +```` + +## Benefits + +1. **Natural Language Understanding** + - Understands commit message context + - Detects mood and sentiment + - Maps development activity to music + +2. **Intelligent Playlist Generation** + - Creates contextual song recommendations + - Provides reasoning for each song choice + - Adapts to different coding activities + +3. **Fallback Support** + - Local sentiment analysis as backup + - Continues working when API is unavailable + - Maintains core functionality offline + diff --git a/workshop/models-feature-prompts.md b/workshop/models-feature-prompts.md new file mode 100644 index 0000000..ad64838 --- /dev/null +++ b/workshop/models-feature-prompts.md @@ -0,0 +1,86 @@ +# Breaking Down GitBey Components into Focused Prompts + +## 1. API Configuration Setup + +```markdown +I need help creating a secure configuration system for my Flutter app that handles multiple API integrations. + +Requirements: +- Separate sensitive credentials from public config +- Support GitHub Models API integration +- Support Spotify API integration +- Include model settings +- Follow Flutter best practices for config management + +Please create the configuration files with proper documentation. +``` + +## 2. GitHub Models Integration + +```markdown +I need to implement the GitHub Models API integration for sentiment analysis. + +Requirements: +- Create a service class for API communication +- Handle authentication with GitHub Models API +- Process commit messages into AI-friendly prompts +- Support retry mechanisms +- Return structured playlist data +- Include error handling +- Add proper logging + +The response should match this format: +```json +{ + "mood": "string", + "songs": [{ + "title": "string", + "reasoning": "string" + }] +} +``` + +## 3. Fallback Sentiment Analyzer + +```markdown +I need a local sentiment analyzer as a fallback system when the AI service is unavailable. + +Requirements: +- Create a lightweight sentiment detection system +- Define mood categories relevant to BeyoncΓ©'s discography +- Map commit keywords to moods +- Create a curated song list for each mood +- Ensure fast response times +- Include unit tests +- Add documentation for the sentiment rules +``` + +## 4. State Management and UI Integration + +```markdown +I need help integrating the playlist generation system into the Flutter UI. + +Requirements: +- Handle loading states +- Show error messages +- Display playlist results +- Support offline mode +- Add retry functionality +- Include pull-to-refresh +- Add animations for state transitions +``` + +## 5. Error Handling and Network Management + +```markdown +I need comprehensive error handling for the API integration. + +Requirements: +- Handle network timeouts +- Manage API rate limits +- Support offline detection +- Add retry mechanisms +- Show user-friendly error messages +- Include logging for debugging +- Support graceful degradation to local analysis +``` diff --git a/workshop/mpc-setup.md b/workshop/mpc-setup.md new file mode 100644 index 0000000..f2390fe --- /dev/null +++ b/workshop/mpc-setup.md @@ -0,0 +1,111 @@ +# Setting up Perplexity and GitHub MCP Servers + +## Prerequisites +- Docker installed on your machine +- VS Code with MCP extension +- GitHub Personal Access Token +- Perplexity API Key + +## Setup Instructions + +### 1. Create Required Tokens + +**Get GitHub Token:** +1. Go to GitHub Settings β†’ Developer Settings β†’ Personal Access Tokens +2. Create a new token with required permissions +3. Copy the token for later use + +**Get Perplexity API Key:** +1. Visit [Perplexity AI](https://www.perplexity.ai/) +2. Get your API key from account settings +3. Copy the key for later use + +### 2. Configure VS Code Settings + +1. Create or update mcp.json: + +````jsonc +{ + "inputs": [ + { + "type": "promptString", + "id": "perplexity-key", + "description": "Perplexity API Key", + "password": true + }, + { + "type": "promptString", + "id": "github_token", + "description": "GitHub Personal Access Token", + "password": true + } + ], + "servers": { + "github": { + "command": "docker", + "args": [ + "run", + "-i", + "--rm", + "-e", + "GITHUB_PERSONAL_ACCESS_TOKEN", + "ghcr.io/github/github-mcp-server" + ], + "env": { + "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}" + } + }, + "perplexity-ask": { + "command": "docker", + "args": [ + "run", + "-i", + "--rm", + "-e", + "PERPLEXITY_API_KEY", + "mcp/perplexity-ask" + ], + "env": { + "PERPLEXITY_API_KEY": "${input:perplexity-key}" + } + } + } +} +```` + +### 3. Start the Servers + +1. Open VS Code Command Palette (`Cmd + Shift + P`) +2. Type "MCP: Start Servers" +3. VS Code will prompt for: + - Perplexity API Key + - GitHub Personal Access Token + +### 4. Verify Setup + +Check if servers are running: +````bash +docker ps +```` + +You should see containers for: +- `github-mcp-server` +- `perplexity-ask` + +### 5. Troubleshooting + +If servers don't start: +1. Check Docker is running: +````bash +docker --version +```` + +2. Verify token permissions: +````bash +curl -H "Authorization: token YOUR_GITHUB_TOKEN" https://api.github.com/user +```` + +3. Reset credentials: + - Open Command Palette + - Type "MCP: Clear Stored Inputs" + - Restart servers with new tokens diff --git a/workshop/token-management-info.md b/workshop/token-management-info.md new file mode 100644 index 0000000..f769e79 --- /dev/null +++ b/workshop/token-management-info.md @@ -0,0 +1,55 @@ +# Token Management in GitBey + +The app uses a two-file approach for managing API tokens securely: + +1. **Public Configuration** (api_config.dart): +```markdown +- Contains non-sensitive configuration +- References tokens through getters +- Includes API endpoints and model settings +- Safe to commit to version control +``` + +2. **Secure Tokens** (`api_tokens.dart`): +```markdown +- Contains sensitive credentials +- Gitignored to prevent accidental commits +- Holds actual token values +- Should be kept secure and not shared +``` + +## Implementation Structure + +Here's how the token management is set up: + +````dart +// This file should be gitignored +class ApiTokens { + static const String githubModelsToken = 'your-github-models-token'; + static const String spotifyClientId = 'your-spotify-client-id'; + static const String spotifyClientSecret = 'your-spotify-client-secret'; + static const String spotifyRedirectUri = 'your-spotify-redirect-uri'; +} +```` + +## Best Practices Used + +1. **Separation of Concerns** + - Configuration logic separated from sensitive data + - Clean interface through getter methods + - Easy to modify tokens without changing app logic + +2. **Security Measures** + ```markdown + - .gitignore includes api_tokens.dart + - No hardcoded tokens in version control + - Tokens accessed through static getters + ``` + +3. **Development Flow** + ```markdown + 1. Developer copies api_tokens_example.dart to api_tokens.dart + 2. Fills in real tokens locally + 3. .gitignore prevents committing real tokens + ``` + pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy