Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Migrate to SvelteKit with file-based routing and Svelte 5 runes #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
audibleblink wants to merge 3 commits into master
base: master
Choose a base branch
Loading
from svelte-kit

Conversation

@audibleblink
Copy link
Owner

@audibleblink audibleblink commented Jun 29, 2025

🚀 SvelteKit Migration

This PR migrates the PassDB frontend from a Svelte 5 SPA using Page.js router to a modern SvelteKit application with file-based routing and enhanced Svelte 5 runes patterns.

📋 Changes Made

✅ SvelteKit Setup

  • Installed @sveltejs/kit and @sveltejs/adapter-static
  • Removed page router dependency
  • Updated configuration files for SvelteKit
  • Configured static site generation for GitHub Pages

✅ File-Based Routing Migration

  • Created src/app.html template
  • Created src/routes/+layout.svelte for shared layout
  • Migrated routes to SvelteKit conventions:
    • src/routes/+page.svelte (Home)
    • src/routes/email/[email]/+page.svelte
    • src/routes/domain/[domain]/+page.svelte
    • src/routes/password/[password]/+page.svelte
    • src/routes/username/[name]/+page.svelte

✅ Svelte 5 Runes Modernization

  • Updated components to use $state(), $derived(), and $effect()
  • Replaced deprecated on: event syntax with modern onclick/onkeydown
  • Enhanced useFetch composable with reactive patterns
  • Modernized state management across components

✅ Navigation Updates

  • Replaced Page.js navigate() with SvelteKit goto()
  • Updated route detection to use $page.route.id
  • Enhanced breadcrumbs system for SvelteKit
  • Updated all navigation-related components

✅ TypeScript & Build Improvements

  • Updated TypeScript configuration for SvelteKit
  • Enhanced build system with automatic code splitting
  • Maintained all existing optimizations
  • Fixed all TypeScript errors and warnings

🗑️ Files Removed

  • src/router.ts - Replaced by SvelteKit routing
  • src/main.ts - Replaced by SvelteKit entry
  • src/App.svelte - Replaced by layout system
  • Old route files - Migrated to new structure
  • index.html - Replaced by app.html

✨ Benefits

  1. Modern Architecture: Full SvelteKit with file-based routing
  2. Better Performance: Automatic code splitting and optimization
  3. Improved DX: Better TypeScript integration and tooling
  4. Future-Proof: Latest Svelte 5 patterns and best practices
  5. Cleaner Code: Removed redundant routing code
  6. Enhanced Maintainability: More organized file structure

🧪 Verification

  • ✅ All TypeScript checks pass (0 errors, 0 warnings)
  • ✅ Build completes successfully
  • ✅ All tests pass
  • ✅ Development server runs without issues
  • ✅ Static site generation works correctly

🔄 Breaking Changes

  • Removed Page.js dependency
  • Updated routing structure to SvelteKit conventions
  • Modernized component patterns to Svelte 5 standards

📚 Documentation

See MIGRATION_SUMMARY.md for detailed migration notes and technical details.


Ready for review and merge! 🎉


Pull Request opened by Augment Code with guidance from the PR author

- Migrate from Page.js router to SvelteKit file-based routing
- Implement modern Svelte 5 runes (, , )
- Update all components to use modern event syntax (onclick vs on:click)
- Replace manual routing with SvelteKit's built-in navigation
- Modernize fetch patterns with enhanced useFetch composable
- Configure static site generation for GitHub Pages deployment
- Update TypeScript configuration for SvelteKit
- Remove deprecated patterns and optimize component structure
- Maintain all existing functionality while improving architecture
Breaking Changes:
- Removed Page.js dependency
- Updated routing structure to SvelteKit conventions
- Modernized component patterns to Svelte 5 standards
Benefits:
- Better performance with automatic code splitting
- Improved developer experience with SvelteKit tooling
- Future-proof architecture with latest Svelte patterns
- Enhanced TypeScript integration
- Cleaner, more maintainable codebase
- Add browser environment checks before accessing localStorage
- Prevent localStorage access during server-side rendering
- Ensure theme store functions gracefully handle SSR
- Fix ReferenceError: localStorage is not defined during build
This resolves the SSR compatibility issue that was causing build failures
when SvelteKit attempts to render components on the server.
- Add browser environment checks to keyboard shortcuts initialization
- Prevent Mousetrap binding during server-side rendering
- Add init() method to safely initialize shortcuts in browser
- Update layout to call keyboard shortcuts init on mount
- Ensure graceful degradation when Mousetrap is not available
This resolves the SSR errors and allows the application to render
properly on the server while maintaining keyboard functionality
in the browser.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /