Skip to content

korryrdev/code-poetry-flutter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

98 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Code Poetry

Code Poetry Banner

Transform your code into beautiful poetry with AI ✨

Flutter Dart Firebase Gemini AI License Download

Download β€’ Features β€’ Demo β€’ Installation β€’ Architecture β€’ Tech Stack


πŸ“– About

Code Poetry is a mobile application that transforms your code into beautiful, artistic poetry using AI. Whether you're a developer looking to celebrate your craft or someone who wants to see code from a different perspective, Code Poetry bridges the gap between logic and emotion.

🎯 The Problem

Developers spend thousands of hours writing elegant code, but it's often:

  • Treated as purely functional, not artistic
  • Never celebrated beyond "it works"
  • Disconnected from emotional expression

πŸ’‘ The Solution

Code Poetry analyzes your code and generates beautiful poetry in multiple styles:

  • Haiku - Minimalist 5-7-5 syllable poems
  • Sonnet - Classical 14-line structured verses
  • Free Verse - Creative, flowing expressions
  • Cyberpunk - Futuristic, edgy tech-noir poetry

πŸ“₯ Download

Get the latest Android APK directly:

Download Latest Release


✨ Features

πŸ€– AI-Powered Generation

  • Powered by Google's Gemini AI
  • Context-aware poem generation
  • Multiple programming languages supported
  • Smart code analysis before generation

🎨 Multiple Poetry Styles

  • 4 distinct poetry styles with unique aesthetics
  • Swipeable style selector with live previews
  • Custom gradients for each style
  • Example poems to guide selection

πŸ” Flexible Authentication

  • Email/Password authentication
  • Google Sign-In integration
  • Guest mode for quick access
  • Seamless guest-to-user conversion

πŸ’Ύ Smart Storage

  • Local storage with Hive for offline access
  • Cloud sync with Firestore for logged-in users
  • Automatic backup and restore
  • Cross-device synchronization

🎭 Beautiful Animations

  • Typewriter effect for poem reveal
  • Smooth page transitions
  • Gradient background animations
  • Haptic feedback throughout

πŸ“Š Usage Tiers

  • Guest Mode: 3 poems total
  • Free Tier: 5 poems per day
  • Pro Tier: Unlimited poems (ready for monetization)

🎯 Additional Features

  • Share poems via system share sheet
  • Save favorites to gallery
  • Filter poems by style
  • Dark/Light theme support
  • Responsive design (mobile & web)

🎬 Demo

App Flow

Launch β†’ Onboarding β†’ Auth β†’ Home β†’ Create Poem
                                      ↓
                              Code Input
                                      ↓
                              Style Selection
                                      ↓
                              Poem Display
                                      ↓
                          Share / Save / Regenerate

Screenshots

Onboarding Token Input Poem Display
Onboarding Styles Poem
Home Dashboard Code Input Gallery
Home Input Gallery

Demo Video

Watch Demo


πŸš€ Installation

Prerequisites

  • Flutter SDK (3.0 or higher)
  • Dart SDK (3.0 or higher)
  • Android Studio / VS Code with Flutter extensions
  • Firebase account
  • Google Cloud account (for Gemini API)

Step 1: Clone Repository

git clone https://github.com/yourusername/code-poetry.git
cd code-poetry

Step 2: Install Dependencies

flutter pub get

Step 3: Setup Environment Variables

Create a .env file in the project root:

# Gemini AI API Key
GEMINI_API_KEY=your_gemini_api_key_here

# Firebase Configuration (optional for additional configs)
FIREBASE_API_KEY=your_firebase_key_here

Get Gemini API Key:

  1. Visit Google AI Studio
  2. Click "Create API Key"
  3. Copy key to .env file

Step 4: Firebase Setup

4.1 Create Firebase Project

  1. Go to Firebase Console
  2. Click "Add Project"
  3. Follow the setup wizard

4.2 Add Flutter App to Firebase

For Android:

flutterfire configure

Manual Setup:

  1. Download google-services.json
  2. Place in android/app/

For iOS:

  1. Download GoogleService-Info.plist
  2. Place in ios/Runner/

4.3 Enable Firebase Services

In Firebase Console:

  1. Authentication

    • Enable Email/Password
    • Enable Google Sign-In
    • Enable Anonymous (for Guest mode)
  2. Firestore Database

    • Create database in test mode (for development)
    • Set up security rules (see Security Rules)

Step 5: Run the App

# Run on connected device
flutter run

# Run on specific device
flutter run -d <device-id>

# Run on Chrome (web)
flutter run -d chrome

# Run with hot reload
flutter run --hot

πŸ—οΈ Architecture

Design Pattern: MVVM (Model-View-ViewModel)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              USER INTERFACE                 β”‚
β”‚         (Views & Widgets)                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            VIEW MODELS                      β”‚
β”‚    (Business Logic & State Management)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            REPOSITORIES                     β”‚
β”‚      (Data Coordination Layer)             β”‚
β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚                      β”‚
β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   SERVICES    β”‚   β”‚   LOCAL STORAGE       β”‚
β”‚  - API        β”‚   β”‚  - Hive               β”‚
β”‚  - Auth       β”‚   β”‚  - SharedPreferences  β”‚
β”‚  - Storage    β”‚   β”‚  - Firestore          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Project Structure

lib/
β”œβ”€β”€ main.dart                          # App entry point
β”‚
β”œβ”€β”€ core/                              # Core app configurations
β”‚   β”œβ”€β”€ constants/
β”‚   β”‚   β”œβ”€β”€ app_colors.dart           # Color system
β”‚   β”‚   β”œβ”€β”€ app_strings.dart          # All UI text
β”‚   β”‚   └── api_constants.dart        # API endpoints
β”‚   β”‚
β”‚   β”œβ”€β”€ theme/
β”‚   β”‚   β”œβ”€β”€ app_theme.dart            # Theme configuration
β”‚   β”‚   └── text_styles.dart          # Typography system
β”‚   β”‚
β”‚   └── services/
β”‚       β”œβ”€β”€ api_service.dart          # Gemini AI integration
β”‚       β”œβ”€β”€ auth_service.dart         # Firebase Auth wrapper
β”‚       β”œβ”€β”€ storage_service.dart      # Hive + Firestore
β”‚       └── connectivity_service.dart # Network monitoring
β”‚
β”œβ”€β”€ models/                            # Data models
β”‚   β”œβ”€β”€ poem_model.dart
β”‚   β”œβ”€β”€ user_model.dart
β”‚   └── poetry_style_model.dart
β”‚
β”œβ”€β”€ repositories/                      # Data layer
β”‚   β”œβ”€β”€ poem_repository.dart
β”‚   └── auth_repository.dart
β”‚
β”œβ”€β”€ viewmodels/                        # Business logic
β”‚   β”œβ”€β”€ auth_viewmodel.dart
β”‚   β”œβ”€β”€ poem_generator_viewmodel.dart
β”‚   β”œβ”€β”€ gallery_viewmodel.dart
β”‚   β”œβ”€β”€ home_viewmodel.dart
β”‚   └── settings_viewmodel.dart
β”‚
└── views/                             # UI layer
    β”œβ”€β”€ screens/
    β”‚   β”œβ”€β”€ splash_screen.dart
    β”‚   β”œβ”€β”€ onboarding/
    β”‚   β”œβ”€β”€ auth/
    β”‚   β”œβ”€β”€ home/
    β”‚   β”œβ”€β”€ code_input/
    β”‚   β”œβ”€β”€ style_selector/
    β”‚   β”œβ”€β”€ poem_display/
    β”‚   β”œβ”€β”€ gallery/
    β”‚   β”œβ”€β”€ profile/
    β”‚   └── settings/
    β”‚
    └── widgets/
        β”œβ”€β”€ common/                    # Reusable widgets
        β”‚   β”œβ”€β”€ custom_button.dart
        β”‚   β”œβ”€β”€ custom_text_field.dart
        β”‚   β”œβ”€β”€ loading_indicator.dart
        β”‚   β”œβ”€β”€ error_view.dart
        β”‚   └── empty_state.dart
        β”‚
        └── [feature-specific widgets]

State Management

Provider is used for state management with the following structure:

MultiProvider(
  providers: [
    // Services (singleton)
    Provider<ApiService>(...),
    Provider<StorageService>(...),
    
    // ViewModels (state notifiers)
    ChangeNotifierProvider<AuthViewModel>(...),
    ChangeNotifierProvider<PoemGeneratorViewModel>(...),
    // ... other ViewModels
  ],
  child: MyApp(),
)

πŸ› οΈ Tech Stack

Frontend Framework

  • Flutter 3.0+ - Cross-platform UI framework
  • Dart 3.0+ - Programming language

State Management

  • Provider - Lightweight state management solution

Backend Services

  • Firebase Authentication - User authentication
  • Cloud Firestore - NoSQL cloud database
  • Google Gemini AI - AI-powered poetry generation

Local Storage

  • Hive - Fast, lightweight NoSQL database
  • SharedPreferences - Key-value storage

UI/UX Libraries

dependencies:
  # Core
  flutter:
    sdk: flutter
  provider: ^6.1.1
  
  # Firebase
  firebase_core: ^2.24.2
  firebase_auth: ^4.16.0
  cloud_firestore: ^4.14.0
  google_sign_in: ^6.2.1
  
  # Networking
  http: ^1.1.0
  dio: ^5.4.0
  
  # Storage
  hive: ^2.2.3
  hive_flutter: ^1.1.0
  shared_preferences: ^2.2.2
  
  # UI/Animations
  flutter_animate: ^4.3.0
  lottie: ^3.0.0
  shimmer: ^3.0.0
  
  # Utilities
  flutter_dotenv: ^5.1.0
  connectivity_plus: ^5.0.2
  share_plus: ^7.2.1
  uuid: ^4.3.3
  intl: ^0.19.0
  
  # Code Display
  flutter_highlight: ^0.7.0

πŸ”§ Configuration

Firebase Security Rules

Firestore Rules (firestore.rules):

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    // Users collection
    match /users/{userId} {
      allow read, write: if request.auth != null && request.auth.uid == userId;
      
      // User's poems subcollection
      match /poems/{poemId} {
        allow read, write: if request.auth != null && request.auth.uid == userId;
      }
    }
  }
}

Authentication Rules:

  • Email/Password: Enabled
  • Google Sign-In: Enabled
  • Anonymous: Enabled

Environment Configuration

The app uses different configurations for development and production:

Development:

// Uses test Firebase project
// Gemini API with rate limiting
// Debug mode enabled

Production:

// Uses production Firebase project
// Full Gemini API access
// Release mode optimizations

🎨 Design System

Color Palette

Primary Colors:

Primary Gradient: #667EEA β†’ #764BA2 (Purple-Blue)
Secondary Gradient: #4FACFE β†’ #00F2FE (Cyan)
Accent Gradient: #F093FB β†’ #F5576C (Pink-Orange)
Success Gradient: #43E97B β†’ #38F9D7 (Green)

Semantic Colors:

Success: #43E97B
Error: #FF6A88
Warning: #FEE140
Info: #4FACFE

Dark Theme:

Background: #0A0E27
Surface: #1A1F3A
Text Primary: #FFFFFF
Text Secondary: #B8B8D1

Typography

Font Families:

  • UI Text: System Default (San Francisco / Roboto)
  • Code: JetBrains Mono (Monospace)
  • Poetry: Spectral (Serif, Italic)

Type Scale:

H1: 32px, Bold
H2: 28px, Bold
H3: 24px, Semibold
H4: 20px, Semibold
Body Large: 16px, Regular
Body Medium: 14px, Regular
Body Small: 12px, Regular

πŸ§ͺ Testing

Run Tests

# Run all tests
flutter test

# Run specific test file
flutter test test/viewmodels/poem_generator_viewmodel_test.dart

# Run with coverage
flutter test --coverage

Test Structure

test/
β”œβ”€β”€ unit/
β”‚   β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ repositories/
β”‚   └── services/
β”œβ”€β”€ widget/
β”‚   └── common/
└── integration/
    └── poem_generation_flow_test.dart

Testing Strategy

  • Unit Tests: ViewModels, Repositories, Services
  • Widget Tests: Common widgets, Custom components
  • Integration Tests: Full user flows

πŸ“± Platform Support

Platform Status Notes
Android βœ… Full Support Minimum SDK: 21 (Android 5.0)
iOS βœ… Full Support Minimum: iOS 12.0
Web βœ… Full Support Chrome, Safari, Firefox, Edge
macOS πŸ”„ Experimental Desktop support via Flutter
Windows πŸ”„ Experimental Desktop support via Flutter
Linux πŸ”„ Experimental Desktop support via Flutter

🚒 Deployment

Android (Google Play Store)

# Build release APK
flutter build apk --release

# Build App Bundle (recommended)
flutter build appbundle --release

Location: build/app/outputs/bundle/release/app-release.aab

iOS (Apple App Store)

# Build for iOS
flutter build ios --release

# Create archive in Xcode
open ios/Runner.xcworkspace
# Product β†’ Archive β†’ Distribute

Web Hosting

# Build web version
flutter build web --release

# Deploy to Firebase Hosting
firebase deploy --only hosting

Web Build Location: build/web/


πŸ” Security

API Key Protection

  • βœ… Environment variables (.env)
  • βœ… Never committed to version control
  • βœ… .gitignore configured properly

Authentication

  • βœ… Firebase Auth with secure tokens
  • βœ… Password hashing handled by Firebase
  • βœ… OAuth 2.0 for Google Sign-In

Data Privacy

  • βœ… User data isolated by Firebase rules
  • βœ… Local encryption with Hive
  • βœ… HTTPS for all network requests

Best Practices

  • βœ… Input validation on all forms
  • βœ… Rate limiting for API calls
  • βœ… Error messages don't expose sensitive info
  • βœ… Secure storage for user credentials

πŸ“ˆ Performance

Optimizations

  • Lazy loading for poems list
  • Image caching
  • Debounced search
  • Efficient state management
  • Code splitting for web

Benchmarks

  • App startup: < 2 seconds
  • Poem generation: 3-5 seconds (AI dependent)
  • Screen transitions: 60 FPS
  • Memory usage: < 150 MB

🀝 Contributing

Contributions are welcome! Please follow these guidelines:

Getting Started

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Code Style

  • Follow Effective Dart guidelines
  • Use dart format before committing
  • Write meaningful commit messages
  • Add tests for new features

Pull Request Process

  1. Update README if needed
  2. Add/update tests
  3. Ensure all tests pass
  4. Update documentation
  5. Request review from maintainers

πŸ› Known Issues

  • Occasional timeout on slow networks (AI generation)
  • Theme transition animation needs smoothing
  • iOS keyboard overlap on small devices (rare)

See Issues for full list.


πŸ—ΊοΈ Roadmap

Version 1.1 (Next Release)

  • More poetry styles (Limerick, Ballad)
  • Voice narration of poems
  • Export poems as images
  • Social features (share to feed)

Version 2.0 (Future)

  • Payment integration (Pro tier)
  • Custom AI model fine-tuning
  • Collaborative poems
  • Code review poetry integration
  • VS Code extension

Version 3.0 (Vision)

  • Community gallery
  • Poetry competitions
  • NFT minting of poems
  • Multi-language UI support

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

MIT License

Copyright (c) 2024 Code Poetry

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction...

πŸ‘¨β€πŸ’» Author

Your Name


πŸ™ Acknowledgments

  • Google Gemini AI - For powerful AI capabilities
  • Firebase - For backend infrastructure
  • Flutter Team - For amazing framework
  • Font Awesome - For icons
  • Unsplash - For sample images
  • Open Source Community - For inspiration and support

πŸ“ž Support

Need help? Here's how to get support:


⭐ Star History

Star History Chart


Made with ❀️ and Flutter

If you found this project helpful, please consider giving it a ⭐!

⬆ Back to Top

Releases

Packages

Contributors

Languages