# key-runnnnnnn/bitcode architecture

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

- Interactive diagram: https://gitdiagram.com/key-runnnnnnn/bitcode
- Repository: https://github.com/key-runnnnnnn/bitcode

## Overview

##### Project type and purpose
- This is a full-stack web application named “Bitcode” – an online coding platform that offers:
- User authentication (signup/signin via Firebase + JWT)
- Interactive coding problems with AI-powered hints, explanations, test case generation, complexity analysis, video solutions, etc.
- Code submission and execution
- Profile, bookmarks, courses, interviews, contests and an admin dashboard for managing questions, users and settings.

##### File structure
- Top-level split into “frontend” (React/Vite/Tailwind app) and “backend” (Node.js/Express + controllers + models + routes).
- Backend uses MVC-style organization:
- config/ for DB & Firebase setup
- controllers/ grouped by domain (Auth, AdminController, AiFeatures, Profile, Settings)
- models/ define data schemas for auth, questions, templates, utils
- query/ for raw SQL operations (bookmarks, submissions, discussions)
- routes/ to wire controllers to API endpoints
- Frontend structure mirrors features:
- src/Components segmented by domain (Auth, Problems, Course, Interview, Admin, Profile, Settings, Common UI)
- src/Pages for route‐level composition
- state management via Zustand + React Context
- third-party integrations: Firebase SDK + code editor + AI UI components
- Shared config: package.json, .gitignore, Vite and Tailwind configs

##### README
- Only “### BITCODE” title given, but project purpose is clear from naming conventions and code.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User & Frontend Layer
    subgraph "User & Frontend Layer"
        Browser["Client Browser"]:::frontend
        ReactApp["React SPA (Vite + React)"]:::frontend
    end
    Browser -->|Interacts| ReactApp

    %% API Gateway & Backend Services
    subgraph "API Gateway & Backend Services"
        APIGateway["Express API Gateway"]:::backend
        AuthService["Authentication Service"]:::backend
        AIService["AI Feature Service"]:::backend
        CodeExec["Code Execution Service"]:::backend
        ProfileService["Profile Service"]:::backend
        SettingsService["Settings Module"]:::backend
        AdminService["Admin Dashboard Service"]:::backend
        BookmarksService["Bookmarks Service"]:::backend
    end
    ReactApp -->|REST API Calls| APIGateway
    APIGateway -->|routes to| AuthService
    APIGateway -->|routes to| AIService
    APIGateway -->|routes to| CodeExec
    APIGateway -->|routes to| ProfileService
    APIGateway -->|routes to| SettingsService
    APIGateway -->|routes to| AdminService
    APIGateway -->|routes to| BookmarksService

    %% Database Layer
    subgraph "Database Layer"
        Postgres["PostgreSQL DB"]:::database
    end
    APIGateway -->|SQL Queries| Postgres
    AuthService -->|CRUD| Postgres
    AIService -->|CRUD| Postgres
    CodeExec -->|Results| Postgres
    ProfileService -->|CRUD| Postgres
    SettingsService -->|CRUD| Postgres
    AdminService -->|CRUD| Postgres
    BookmarksService -->|CRUD| Postgres

    %% External Systems
    subgraph "External Systems"
        FirebaseAuth["Firebase Auth"]:::external
        FirebaseStorage["Firebase Storage"]:::external
        OpenAI["OpenAI / LLM APIs"]:::external
    end
    AuthService -->|Verify Tokens| FirebaseAuth
    AuthService -->|Store Media| FirebaseStorage
    AIService -->|Invoke| OpenAI

    %% Click Events
    click ReactApp "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/main.jsx"
    click ReactApp "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/App.jsx"
    click ReactApp "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/index.css"
    click APIGateway "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/server.js"
    click AuthService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/config/firebase-config.js"
    click AuthService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/controllers/auth.js"
    click AuthService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/middlewares/checkToken.js"
    click AuthService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/routes/authRoute.js"
    click AuthService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Auth/Signin.jsx"
    click AuthService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Auth/Signup.jsx"
    click AIService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/controllers/AiFeatures/AiChat.js"
    click AIService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/controllers/AiFeatures/Debug.js"
    click AIService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/controllers/AiFeatures/Explaincode.js"
    click AIService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/controllers/AiFeatures/Hint.js"
    click AIService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/controllers/AiFeatures/Review.js"
    click AIService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/controllers/AiFeatures/Solution.js"
    click AIService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/controllers/AiFeatures/VideoSolutions.js"
    click AIService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/controllers/AiFeatures/complexity.js"
    click AIService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/controllers/AiFeatures/testcases.js"
    click AIService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Problems/CodingQuestion/Details/AI/Chat/Chat.jsx"
    click AIService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Problems/CodingQuestion/Details/AI/Complexity/Complexity.jsx"
    click AIService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Problems/CodingQuestion/Details/AI/ErrorFinder/ErrorFinder.jsx"
    click AIService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Problems/CodingQuestion/Details/AI/ExplainCode/ExplainCode.jsx"
    click AIService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Problems/CodingQuestion/Details/AI/Hint/Hint.jsx"
    click AIService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Problems/CodingQuestion/Details/AI/Review/Review.jsx"
    click AIService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Problems/CodingQuestion/Details/AI/TestCaseGenerator/TestCaseGenerator.jsx"
    click AIService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Problems/CodingQuestion/Details/AI/VisualizeCode/VisualizeCode.jsx"
    click CodeExec "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/routes/codeRoute.js"
    click CodeExec "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Problems/CodingQuestion/Details/Outputs/RunCode/RunCode.jsx"
    click CodeExec "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Problems/CodingQuestion/Details/Outputs/SubmitCode/SubmitCode.jsx"
    click Postgres "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/config/connectdb.js"
    click Postgres "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/config/postgres.js"
    click Postgres "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/models/auth.model.js"
    click Postgres "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/models/question.model.js"
    click Postgres "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/models/template.model.js"
    click Postgres "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/models/utils.model.js"
    click AdminService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/controllers/AdminController/dashboard.js"
    click AdminService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/controllers/AdminController/question.js"
    click AdminService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/controllers/AdminController/users.js"
    click AdminService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/routes/adminRoute.js"
    click AdminService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Admin/Dashboard/Dashboard.jsx"
    click AdminService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Admin/Questions/QuestionsList.jsx"
    click AdminService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Admin/Users/UserList.jsx"
    click ProfileService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/controllers/Profile/User.js"
    click ProfileService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/controllers/Profile/Submissions.js"
    click ProfileService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/routes/profileRoute.js"
    click ProfileService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Profile/UserInfo/UserInfo.jsx"
    click ProfileService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Profile/RecentSubmissions/RecentSubmissions.jsx"
    click ProfileService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Profile/Contribution/Contribution.jsx"
    click ProfileService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Profile/UserStats/UserStats.jsx"
    click SettingsService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/controllers/SettingController/AcountInfo.js"
    click SettingsService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/controllers/SettingController/PasswordChange.js"
    click SettingsService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/controllers/SettingController/Preference.js"
    click SettingsService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/controllers/SettingController/UserInfo.js"
    click SettingsService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/routes/settingRoute.js"
    click SettingsService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Settings/AccountSetting/AccountSetting.jsx"
    click SettingsService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Settings/Password/Password.jsx"
    click SettingsService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Settings/Preference/Preference.jsx"
    click SettingsService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Settings/ProfileSetting/ProfileSetting.jsx"
    click BookmarksService "https://github.com/key-runnnnnnn/bitcode/blob/master/backend/query/Bookmarks.js"
    click BookmarksService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Bookmark/BookmarkList/BookmarkList.jsx"
    click BookmarksService "https://github.com/key-runnnnnnn/bitcode/blob/master/frontend/src/Components/Bookmark/DeleteBookmark/DeleteBookmark.jsx"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef backend fill:#d4edda,stroke:#333,stroke-width:1px
    classDef database fill:#ffe5b4,stroke:#333,stroke-width:1px
    classDef external fill:#e3e3e3,stroke:#333,stroke-width:1px
```
