Replace SSE with WebSocket (Bun.serve), JWT auth, remove env-based admin#11
Draft
Replace SSE with WebSocket (Bun.serve), JWT auth, remove env-based admin#11
Conversation
Co-authored-by: ayobro1 <186326284+ayobro1@users.noreply.github.com>
Fix mobile swipe-back slide-out animation being immediately cancelled
Co-authored-by: ayobro1 <186326284+ayobro1@users.noreply.github.com>
Fix mobile channel exit animation broken by React 19 style reconciliation
Co-authored-by: ayobro1 <186326284+ayobro1@users.noreply.github.com>
Co-authored-by: ayobro1 <186326284+ayobro1@users.noreply.github.com>
Fix mobile exit animation race condition & message text selection on react
Add a 300ms delay before showing the loading spinner in MessageArea. For fast fetches (the common case), the spinner never appears, eliminating the brief loading flash. The timer is properly cleaned up in both the fetch finally block and the useEffect cleanup function. Co-authored-by: ayobro1 <186326284+ayobro1@users.noreply.github.com>
Defer loading spinner to eliminate flash on chat open
- Replace better-sqlite3 with bun:sqlite - Add JWT sign/verify (src/lib/jwt.ts) for stateless auth - Update auth.ts to use JWT instead of DB sessions - Update store.ts: remove getUserBySession/logoutSession, use signJwt, first registered user becomes admin, WebSocket pub/sub - Add server.ts with Next.js HTTP + Bun.serve WebSocket - Replace SSE EventSource with WebSocket in MessageArea.tsx - Simplify logout route (cookie-only, no server session) - Delete SSE stream route - Remove all CSS transition classes from components - Update package.json scripts for bun, remove better-sqlite3 - Remove .npmrc, update .gitignore, .env.local.example, tsconfig.json Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: ayobro1 <186326284+ayobro1@users.noreply.github.com>
…type safety Co-authored-by: ayobro1 <186326284+ayobro1@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Replace SSE with WebSocket for data streaming
Replace SSE with WebSocket (Bun.serve), JWT auth, remove env-based admin
Mar 1, 2026
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.
Migrate real-time transport from SSE to WebSocket, switch to Bun runtime, replace session-token auth with JWT, and move admin user management fully into the database.
WebSocket via
Bun.serve()server.ts— single entry point: Next.js HTTP on:3000,Bun.serve()WebSocket on:3001store.tsnotifySubscribers()broadcasts toglobalThis.__wsClientsshared between Next.js and the WS server in-process/api/messages/stream)JWT authentication
src/lib/jwt.ts— HMAC-SHA256 sign/verify with timing-safe comparisonauth.tsverifies JWT from cookie directly — no DB session lookuploginUser()returns a signed JWT;getUserBySession()/logoutSession()removedJWT_SECRETrequired in production, dev fallback providedAdmin stored in DB, not env
ADMIN_USERNAME/ADMIN_PASSWORD_HASH_SHA256env seeding fromdb.tsadmin+approvedBun runtime
bun server.ts(dev/start),bun next buildbetter-sqlite3(bun:sqlite incompatible with Next.js build workers)CSS transitions removed
transition-*Tailwind classes and inlinestyle.transitionassignments across all componentsWarning
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:
https://api.github.com/graphql/usr/bin/gh gh auth status r(http block)https://api.github.com/user/usr/bin/gh gh api user -main/dist/ripgrep/bin/linux-x64/rg(http block)If you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.