# vanshpanchal/developer-community-app architecture

> Architecture diagram of the GitHub repository vanshpanchal/developer-community-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vanshpanchal/developer-community-app
- Repository: https://github.com/vanshpanchal/developer-community-app

## Overview

##### Project Type and Purpose
- DevSphere is a full-stack, cross-platform mobile/web/desktop application built in Flutter.
- It leverages Firebase for its backend (Authentication, Firestore database, Cloud Storage) and integrates with the Google Gemini API for AI-powered chatbot assistance.

##### File Structure Analysis
- Top-level “android”, “ios”, “linux”, “macos”, “windows”, “web” directories hold platform runners and configuration; these are generated by Flutter and embed the engine.
- The “lib” directory holds the entire Dart-based application logic:
- UI screens (home.dart, login.dart, chat.dart, etc.)
- Services (Authservice.dart, firebase_options.dart, gemini_api.dart)
- State and theme controllers (ThemeController.dart, wrapper.dart)
- Configuration files (`pubspec.yaml`, `firebase.json`, platform Gradle/Xcode/CMake files) define dependencies, Firebase setup, and build/deploy steps.

##### README Insights
- Confirms tech stack: Flutter UI, Firebase backend, Google Gemini API.
- Highlights features (authentication, posts, discussions, gamification, AI chatbot).

##### Main Components
a. Client App (Flutter)
- UI Layer: Widgets/screens for Login, Signup, Home, Explore, Chat, Discussions, Profile, Gamification.
- State/Logic Layer: ThemeController, Wrapper, Services interfaces.
b. Firebase Backend
- Firebase Authentication (user login/signup flows)
- Cloud Firestore (real-time data storage for posts, discussions, XP, tags)
- Firebase Storage (images, attachments, animations)
c. External AI Service
- Google Gemini API (chatbot integration for coding assistance)
d. Optional: CI/CD or DevOps (Firebase CLI, GitHub Actions—not in code tree but can be noted)

##### Relationships and Data Flows
- User interacts with Flutter UI →
- Auth calls to Firebase Auth → tokens/UID →
- Firestore reads/writes for posts, discussions, XP →
- Storage for media uploads/downloads
- Chat screen requests user input → Gemini API call → returns AI response → displayed in UI
- ThemeController manages UI theme locally (no external call)
- Wrapper.dart routes authenticated vs. unauthenticated users

##### Architectural Patterns and Principles
- Separation of concerns: UI widgets vs. service classes vs. configuration
- Client-driven BaaS architecture (thin client communicates with managed cloud services)
- Modular directories: one screen per Dart file, one service per file
- Dependency injection could be represented (services injected into screens)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Side
    subgraph "Flutter Client"
        subgraph "UI Layer"
            Login["Login Screen"]:::client
            Signup["Signup Screen"]:::client
            Wrapper["Auth Routing Wrapper"]:::client
            Home["Home Screen"]:::client
            Explore["Explore Screen"]:::client
            Chat["Chat Screen"]:::client
            ChatbotWidget["Chatbot Widget"]:::client
            AddPost["New Post Screen"]:::client
            SavedPosts["Saved Posts Screen"]:::client
            AddDiscussion["Add Discussion Screen"]:::client
            OngoingDiscussion["Ongoing Discussions Screen"]:::client
            DetailDiscussion["Discussion Detail Screen"]:::client
            SavedDiscussion["Saved Discussions Screen"]:::client
            Profile["Profile Screen"]:::client
            Markdown["Markdown Renderer"]:::client
            AttachCode["Code Attachment Widget"]:::client
            ThemeSelection["Theme Selection Screen"]:::client
        end
        subgraph "Service Layer"
            AuthService["Authentication Service"]:::service
            FirebaseOptions["Firebase Config"]:::service
            GeminiAPI["Google Gemini API Client"]:::service
            ThemeController["Theme Controller"]:::service
        end
        Main["Client Entry Point (main.dart)"]:::client
    end

    %% Backend
    subgraph "Firebase Backend"
        Auth["Firebase Authentication"]:::firebase
        Firestore["Cloud Firestore"]:::datastore
        Storage["Firebase Storage"]:::datastore
    end

    %% External AI Service
    Gemini["Google Gemini API"]:::ai

    %% Connections
    Main -->|loads UI&Services| Login
    Login -->|uses| AuthService
    Signup -->|uses| AuthService
    Wrapper -->|routes based on| AuthService
    Home -->|reads/writes| Firestore
    Explore -->|reads| Firestore
    AddPost -->|writes| Firestore
    SavedPosts -->|reads| Firestore
    AddDiscussion -->|writes| Firestore
    OngoingDiscussion -->|reads| Firestore
    DetailDiscussion -->|reads| Firestore
    SavedDiscussion -->|reads| Firestore
    Profile -->|reads| Firestore
    AttachCode -->|uploads/downloads| Storage
    Chat -->|requests| GeminiAPI
    ChatbotWidget -->|renders responses| Chat
    AuthService -->|SDK calls| Auth
    FirebaseOptions -->|initializes| AuthService
    FirebaseOptions -->|initializes| Firestore
    FirebaseOptions -->|initializes| Storage
    GeminiAPI -->|HTTPS gRPC| Gemini

    %% Click Events
    click Main "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/main.dart"
    click Login "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/login.dart"
    click Signup "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/signup.dart"
    click Wrapper "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/wrapper.dart"
    click Home "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/home.dart"
    click Explore "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/explore.dart"
    click Chat "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/chat.dart"
    click ChatbotWidget "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/chatbot.dart"
    click AddPost "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/addpost.dart"
    click SavedPosts "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/saved.dart"
    click AddDiscussion "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/add_discussion.dart"
    click OngoingDiscussion "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/Ongoing_discussion.dart"
    click DetailDiscussion "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/detail_discussion.dart"
    click SavedDiscussion "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/saved_discussion.dart"
    click Profile "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/profile.dart"
    click Markdown "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/markdown.dart"
    click AttachCode "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/attachcode.dart"
    click ThemeController "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/ThemeController.dart"
    click ThemeSelection "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/ThemeSelectionScreen.dart"
    click AuthService "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/Authservice.dart"
    click FirebaseOptions "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/firebase_options.dart"
    click GeminiAPI "https://github.com/vanshpanchal/developer-community-app/blob/master/lib/gemini_api.dart"
    click Auth "https://github.com/vanshpanchal/developer-community-app/blob/master/firebase.json"
    click Storage "https://github.com/vanshpanchal/developer-community-app/tree/master/android/"
    click Firestore "https://github.com/vanshpanchal/developer-community-app/blob/master/pubspec.yaml"

    %% Styles
    classDef client fill:#cce5ff,stroke:#6699cc
    classDef service fill:#e6f2ff,stroke:#99c2ff
    classDef firebase fill:#ffe6cc,stroke:#ffcc99
    classDef datastore fill:#ffebcc,stroke:#ffd699
    classDef ai fill:#ccffcc,stroke:#99cc99
```
