This code contains the minimal changes required to migrate the Renote application from a monolithic Laravel + Livewire architecture to a Laravel + React architecture with proper MVC backend structure.
- View Layer: React JSX components for UI presentation (
Notes.jsx
) - State Management: Zustand stores for centralized state and API communication (
useNotesStore.js
) - Benefits: Centralized state management with Zustand, clean separation between UI and business logic
- Controller Layer:
NoteController
refactored to handle only HTTP concerns - Service Layer:
NoteService
created with business logic for CRUD operations - Repository Layer:
NoteRepository
andNoteRepositoryInterface
for data access abstraction - DTOs: Data Transfer Objects (
CreateNoteDTO
,NoteDTO
) for type-safe data handling - Form Requests:
StoreNoteRequest
for centralized validation logic - Dependency Injection: Interface-based injection with service provider binding
- Centralized State Management: Zustand stores provide predictable state updates and actions
- UI/Logic Separation: React components focus on presentation, Zustand handles state and API calls
- Backend MVC + Repository: Clear separation between HTTP, business logic, and data access layers
- Data Access Abstraction: Repository pattern isolates database concerns from business logic
- Testability: Each layer can be tested independently with easy mocking
- Maintainability: Business logic centralized in service classes and Zustand stores
- Flexibility: Easy to switch data sources without affecting business logic
- Type Safety: DTOs and interfaces provide consistent data structures
- Migrate authentication to React components
- Add back and migrate the Tag component (removed for simplification)
- Install Laravel's Herd: https://laravel.com/docs/12.x/installation#installation-using-herd
This will install Php, Composer and Laravel.
- Install node v22
Install node version manager (MVN). On Windows you can use this distribution: https://github.com/coreybutler/nvm-windows#readme
-
Clone this project
-
Run
npm i
andnpm run dev
-
Start Herd
-
Access
http://mvc-php-react.test
from your browser
You are setup!