CoBlocksGet CoBlocks→
Skip to guide
Wiki/Technical
COBLOCKS WIKI

Architecture & source map

Extension entry points, backend services, authentication, event flow, and persistence.

CoBlocks user guide
On this pageHow the pieces connectExtension source mapBackend source mapBrowser background contextsTrust boundaries

How the pieces connect

The browser extension injects editor, My Stuff, and badge integrations into Scratch. The extension background context holds account/session state, makes authenticated API calls, maintains Socket.IO connectivity, and stores local recovery snapshots.

The Express backend exposes /apiv2 HTTP routes. Socket.IO routes authenticated project changes, chat, pointers, titles, and presence between authorized clients. Scratch Auth establishes a verified username; subsequent CoBlocks requests use backend-issued tokens.

Extension source map

PathResponsibility
extension/manifest.jsonManifest V3 entry points, browser minimums, permissions, content-script matches, and resources.
extension/background.jsMessage routing, API requests, Socket.IO sessions, project linking, and IndexedDB recovery.
extension/background/auth.jsScratch Auth handoff, token storage, account matching, validation, and logout.
extension/background/updates.jsGitHub release previews and coordinated update notices.
extension/injectors/ + scripts/runtime.jsInject Scratch integrations and bridge page/background messages across browsers.
extension/scripts/editor.jsVM/Blockly sync, collaboration panel, cursors, chat, notifications, backpack, and Revert.
extension/scripts/mystuff.js + scripts/badge.jsMy Stuff collaboration entries and public usage badges.
extension/popups/ + projects/Account/friends/settings popup and project workspace.

Backend source map

PathResponsibility
backend/index.jsExpress HTTP routes, CORS, rate limiting, project/access operations, and startup.
backend/WebSockets.jsAuthenticated project rooms, edits, chat, pointers, and identity checks.
backend/utils/scratch-auth.jsLogin start/callback/finish, 30-day sessions, and session invalidation.
backend/utils/projectAccess.js + inviteLinks.jsOwnership/membership rules and hashed expiring invite tokens.
backend/utils/sessionManager.jsProject state, linked copies, membership, live sessions, and change handling.
backend/utils/fileStorage.js + redundantStorage.jsJSON persistence, recovery mirrors, and bounded snapshots.
backend/utils/removeOldProjects.jsCleanup of inactive project records.
backend/test/Authentication, access, invites, presence, pointers, backpack, recovery, and compatibility checks.

Browser background contexts

The shared manifest declares a service worker for Chromium and background scripts for Firefox. The runtime bridge adapts page/background messaging. Browser support must be checked against the released package; a working local development manifest does not establish a store release.

Trust boundaries

Tokens and project authorization are checked by the server for HTTP and live messages. Owner-only actions cannot be safely implemented as a hidden UI button alone. The backend processes project content and chat; TLS is transport security, not end-to-end encryption.

Source references

Check the code and release notes if your installed build looks different.

extension/manifest.json ↗extension/background.js ↗backend/index.js ↗backend/WebSockets.js ↗
Latest release notes ↗
Something different in your build? Report a documentation issue ↗