8000 Replace the Next.js framework with Tauri, supporting all platforms including macOS, Windows, Android, and iOS · Issue #640 · blinkospace/blinko · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Replace the Next.js framework with Tauri, supporting all platforms including macOS, Windows, Android, and iOS #640

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

Closed
blinko-space opened this issue Apr 16, 2025 · 0 comments
Labels
enhancement New feature or request size:XXL This PR changes 1000+ lines, ignoring generated files.

Comments

@blinko-space
Copy link
Collaborator
blinko-space commented Apr 16, 2025

Instructions for Migrating the Blinko Application from Next.js to Tauri + Express Architecture

Overview of the Migration Architecture

Original Architecture (Next.js)

  • Framework: Next.js (React framework with server-side rendering capabilities)
  • Routing: Next.js file system routing
  • API: Next.js API Routes + tRPC
  • Authentication: next-auth
  • Data Interaction: Prisma ORM
  • Internationalization: next-i18n
  • UI Framework: Custom + third-party component libraries
  • Deployment Method: Web application deployment

Target Architecture

Front-end Application Framework:

  • Tauri (desktop application shell)
  • Vite (build tool)
  • React SPA (single-page application)
  • React Router (client-side routing)

Back-end Service:

  • Express server
  • vite-express development environment support
  • @auth/express authentication system
  • tRPC remains unchanged
  • Prisma ORM remains unchanged

Migration Strategy

1. Architecture Separation

Split the original Next.js application into two independent projects:

  • Front-end Project - Tauri + React single-page application
  • Back-end Project - Express API server

2. Front-end Migration Key Points

Project Structure Reorganization

  • Create a project structure that meets Tauri requirements
  • Migrate the original page components to the new directory structure

Routing System Conversion

  • Migrate from file system-based routing to React Router declarative routing
  • As can be seen from the existing App.tsx file, React Router has been partially implemented

Build Process Adjustment

  • Configure Vite as the front-end build tool
  • Set environment variables suitable for desktop applications

Resource Reference Path Adaptation

  • Adjust the reference paths of static resources
  • Correct paths related to Next.js-specific features

Internationalization Migration

  • Convert from next-i18n to the i18next system
  • Keep the existing translation file structure

Theme System Adaptation

  • Retain next-themes or migrate to an equivalent solution

3. Authentication System Migration

From next-auth to @auth/express

  • Set up authentication routes for the Express server
  • Implement equivalent authentication strategies and providers
  • Update front-end authentication hooks and context

Session Management

  • Re-implement the session persistence mechanism
  • Configure secure cookie settings

Protected Routes

  • Migrate the existing ProtectedRoute component, keeping its functionality unchanged

4. API Migration

From Next.js API Routes to Express Routes

  • Rebuild the API endpoint structure
  • Handle request validation and error handling

Keep tRPC Unchanged

  • Adapt tRPC to work in the Express server
  • Ensure the front-end tRPC client connects correctly

Database Access

  • Retain the existing Prisma models and queries
  • Ensure the Prisma client is properly initialized in the new environment

5. Desktop Application Feature Development

Integration of Tauri-specific Features

  • File system access
  • System tray
  • Application updates
  • System notifications

Offline Functionality

  • Improve the existing offline page
  • Implement local data caching
@blinko-space blinko-space added enhancement New feature or request size:XXL This PR changes 1000+ lines, ignoring generated files. labels Apr 16, 2025
@blinko-space blinko-space pinned this issue Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

No branches or pull requests

1 participant
0