StateSnap captures a browser tab's runtime state (cookies, local/session storage, network activity and DOM snapshot) and saves it to a small Ktor backend which persists snapshots into MongoDB. It includes two main components:
statesnap-backend: Kotlin + Ktor HTTP server that stores and serves snapshots.statesnap-extension: Chrome extension that records and replays snapshots from the browser.
- Start MongoDB (docker):
docker run --name mongodb -d -p 27017:27017 mongo- Run the backend (from repo root):
./gradlew :statesnap-backend:runThe backend listens on 0.0.0.0:8080 by default.
- Load the extension for development (Chromium-based browser):
- Open
chrome://extensions→ enable Developer mode → Load unpacked and select thestatesnap-extension/folder. - Open the extension popup and use
Initialize recordingthenSaveto send snapshots to the backend.
- No network logs in saved snapshot:
- Ensure the extension injected
recorder.jsinto the page. In the page console checkwindow._isRecording === trueandArray.isArray(window._networkLogs). - Recording requires the page to be a normal web page (not
chrome://or certain extension pages) and the recorder runs in the page's MAIN world.
- Ensure the extension injected
- Backend errors when saving:
- Confirm Mongo is running on
localhost:27017. If not, start via Docker or updateDatabases.ktconnection string.
- Confirm Mongo is running on
- CORS / CSP issues when testing extension repro:
- Extension uses
chrome.scripting.executeScriptin the MAIN world to avoid many CSP restrictions. Some pages with strict CSP may still block replayer injection.
- Extension uses
If you'd like a short developer checklist (how to iterate on the extension, reproduce missing network logs, or add new endpoints), tell me which area and I will expand this README with step-by-step guidance.