Implement cross-device session persistence with D1 database#20
Draft
Implement cross-device session persistence with D1 database#20
Conversation
Co-authored-by: davis9001 <72961+davis9001@users.noreply.github.com>
Deploying apollo with
|
| Latest commit: |
f532bb1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://895ee32c.apollo-8vm.pages.dev |
| Branch Preview URL: | https://copilot-implement-session-hi.apollo-8vm.pages.dev |
Co-authored-by: davis9001 <72961+davis9001@users.noreply.github.com>
Co-authored-by: davis9001 <72961+davis9001@users.noreply.github.com>
Co-authored-by: davis9001 <72961+davis9001@users.noreply.github.com>
Co-authored-by: davis9001 <72961+davis9001@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add consistent session history across devices using GitHub login
Implement cross-device session persistence with D1 database
Nov 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Session history was stored only in localStorage, limiting access to a single browser. Users logging in from different devices couldn't access their conversation history.
Changes
Database Layer
users,chat_sessions,chat_messagestablessrc/lib/server/db.tsfor CRUD operationsAPI Layer
/api/sessionsfor session managementClient Layer
sessionStorewithsyncFromDatabase(),syncSessionToDatabase(), anddeleteSessionFromDatabase()methodsSecurity
Math.random()withcrypto.randomUUID()for session ID generationExample Usage
Configuration
Local development:
Production requires D1 database creation and
wrangler.jsoncupdate with database ID.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
sparrow.cloudflare.com/usr/local/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/apollo/apollo/node_modules/wrangler/wrangler-dist/cli.js d1 execute DB --local --file=./schema.sql(dns block)/usr/local/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/apollo/apollo/node_modules/wrangler/wrangler-dist/cli.js d1 execute DB --local --command=SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;(dns block)workers.cloudflare.com/usr/local/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/apollo/apollo/node_modules/wrangler/wrangler-dist/cli.js d1 execute DB --local --file=./schema.sql(dns block)/usr/local/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/apollo/apollo/node_modules/wrangler/wrangler-dist/cli.js d1 execute DB --local --command=SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.