How dovyski/codebot works
Project type and purpose
• Codebot is a full-stack, web-based IDE focused on game development.
• It also ships as a Chrome App/Extension and a desktop NW.js (“node-webkit”) app, reusing much of the same front-end code.
• Back-end is PHP-based, persisting state in MySQL and the server’s file system.
File structure
Top-level directories of interest:
• Root: static assets (index.html, css/, img/, js/, manifest.json) for the web client
• js/chrome: Chrome App code (background.js, filesystem bridge)
• js/node-webkit: NW.js bootstrap and FS bridge
• js/web: web-only bootstrap and FS emulation
• plugins/: each subfolder is a self-contained plugin, some with backend (PHP), some front-end only
• plugins/ide-web/app & api: the PHP application’s MVC-style structure
• plugins/ide-web/login: OAuth authentication via Opauth (GitHub strategy)
• package.json, manifest.json: defines Node dependencies and Chrome App manifest
Extract insights from the README
• Front-end: HTML5 + CSS3 + JavaScript (Ace Editor, jQuery, Bootstrap, custom UI modules)
• Back-end: PHP + MySQL, REST-style API under /plugins/ide-web/api/*
• Deployment: runs on any PHP-capable web server with MySQL; desktop variants use local FS
Main components & their relationships
a. Front-end Client(s)
– Web App: served by the PHP webserver; assets under root/js/web & root/css
– Chrome App: communicates over Chrome filesystem API, code in js/chrome
– NW.js App: communicates via Node FS API, code in js/node-webkit
– UI modules: panels (files, SFX, asset-finder), context menus, tabs, preferences
– Editor core: Ace Editor wrapper (js/codebot.editor.*)
b. Back-end Server
– PHP application (plugins/ide-web/app/controllers, models, views)
– REST API endpoints (plugins/ide-web/api/endpoints/*.php)
– Authentication: Opauth module under plugins/ide-web/login/inc/lib/Opauth
– Data storage: MySQL database (structure.sql) and file-system project storage
c. Database
– MySQL holds users, projects metadata, plugin settings
d. Plugin System
– Front-end plugins: located under plugins/* with js/panel.* files
– CLI tools (e.g. asset-finder CLI) invoke PHP scripts via shebang or HTTP calls
– Backend plugins: under plugins/*/backend with PHP logic, sometimes tied to API
e. External Services
– OAuth provider (GitHub) for login
– Asset-finder queries to curated list or opengameart.org
– Potential future Haxe compiler service
Data flows & interactions
• Web client ↔ PHP API: AJAX/HTTP(S) calls
• Chrome/NW apps ↔ local file system: FS APIs → optional backend FS fallback
• PHP back-end ↔ MySQL: SQL queries for persistence
• PHP back-end ↔ file system: read/write project files, settings, plugin assets
• Plugins ↔ core: front-end event bus (codebot.signal.js), back-end via API hooks
Architectural patterns & design principles
• Modular plugin architecture: loosely-coupled front-end and back-end extension points
• MVC-style organization in PHP back-end (controllers vs. endpoints vs. views)
• Event-driven front-end (custom signal/pub-sub)
• Progressive enhancement: same codebase adapts to Web, Chrome, and NW.js
Elements
• Clear, descriptive labels on each component and subcomponent
• A zoomed-in inset for the plugin system, showing how a plugin registers UI panels and API endpoints