Skip to content

Guest Mode & Hybrid Storage Update

Latest

Choose a tag to compare

@CyberSphinxxx CyberSphinxxx released this 04 Jan 16:56

Overview

This update introduces Guest Mode, allowing users to start coding instantly without signing in. Guest projects are stored locally and automatically migrated to the cloud once the user authenticates.


Key Features

Guest Mode

  • Editor is accessible without authentication (/editor/:id)
  • Guest projects are stored in browser localStorage
  • Clicking Launch Editor creates a default starter project
  • Uses generateLocalId() to create local- prefixed project IDs

Hybrid Storage

  • Projects use:
    • localStorage for local- projects
    • Firebase Realtime Database for cloud projects
  • projectService.ts now supports both storage types
  • All CRUD operations work for local and cloud projects
  • getUserProjects() returns a combined list

Automatic Migration

  • New migrationService.ts
  • Runs automatically when a guest signs in
  • Migrates all local projects to Firebase
  • Local data is deleted only after successful cloud save
  • Redirects user to the cloud version if currently editing
  • Toast notifications confirm migration status

Global Toast System

  • New ToastContext
  • Simple showToast(message) API
  • Auto-dismiss after 3 seconds

Bug Fixes

  • Fixed auth listener re-subscribing issue in AuthContext.tsx
  • Improved sign-in redirect flow (now redirects to dashboard)
  • Fixed Monaco Editor red underline issues when switching projects

Files Changed

New

  • src/utils/idGenerator.ts
  • src/services/migrationService.ts
  • src/context/ToastContext.tsx

Updated

  • App.tsx – Editor no longer protected
  • projectService.ts – Hybrid storage
  • AuthContext.tsx – Migration + auth fixes
  • CodeEditor.tsx – Marker cleanup

Security

  • Guests cannot write to Firebase
  • Only authenticated users can modify cloud projects
  • Migration respects ownership rules

User Flow

Guest

  1. Open site
  2. Click Launch Editor
  3. Code immediately
  4. Sign in later
  5. Projects auto-migrate

Authenticated

  • Sign in → Dashboard
  • Access all cloud projects
  • No localStorage usage by default

Compatibility

  • No breaking changes
  • Fully backward compatible

Limitations

  • Local projects are device-specific
  • Requires sign-in to migrate
  • Local projects cannot be shared

Full Changelog: v3.3.0...v3.4.0