- What is joshcirre/duo used for in Laravel?
- Duo is a local-first IndexedDB syncing package for Laravel and Livewire applications. It automatically caches Eloquent model data client-side and syncs it with the server, enabling offline-first behavior and optimistic UI updates. The README labels it VERY MUCH A WIP, so treat it as an early-stage tool to pilot carefully.
- How do I install and configure Duo in a Laravel Livewire app?
- The Composer package is joshcirre/duo, and the README local setup uses a path repository plus npm link for @joshcirre/vite-plugin-duo. In an app, you add the Duo trait to a Livewire component and wire up the Vite plugin for manifest generation. Because Duo is a WIP, follow the repository README for the current installation steps.
- Does Duo support Livewire 3 and Volt components?
- Yes, Duo is described as having seamless integration with Livewire 3+ and Volt components. It can transform server-side Livewire components into Alpine.js so IndexedDB caching and client-side behavior work automatically. The tight Livewire 3+ coupling may limit use in Laravel apps that do not use Livewire.
- Which Laravel versions are supported by Duo?
- The provided context does not specify an exact Laravel version constraint for Duo. It emphasizes Livewire 3+ and Volt compatibility rather than a Laravel version range. Check the package composer.json and repository for the current requirements because it is a WIP.
- How does Duo extract an IndexedDB schema from Eloquent models?
- Duo automatically extracts database column types, nullability, and defaults from Eloquent models for IndexedDB. This schema-aware approach reduces manual mapping and boilerplate for Laravel developers. Verify edge cases such as timestamp versus datetime mappings, and customize schema extraction if the generated schema does not match your models.
- How does Duo handle offline conflict resolution?
- Duo provides optimistic updates and a sync queue that resumes when the browser comes back online. The provided context does not document a complete server-versus-client conflict resolver, so teams should define their own conflict rules. For high-edit models, plan custom resolution logic and test concurrent offline edits carefully.
- Can Duo sync only specific models or paginated collections?
- Duo is applied through a trait on a Livewire component and caches the Eloquent models used by that component. The context does not confirm granular per-model or paginated sync controls, so evaluate whether component-level scope fits your data flow. For large datasets, benchmark IndexedDB operations and avoid assuming fine-grained sync behavior.
- What happens if IndexedDB is unavailable in the browser?
- The provided context does not document Duo's fallback behavior when IndexedDB is unavailable, such as in some private browsing modes. You should test this scenario in your target browsers and design a graceful degradation path. This is one of the technical risks to validate before relying on Duo in production.
- How can I test Duo offline behavior and sync failures?
- The context does not list built-in tools for simulating offline states or sync failures. You can still test by using browser devtools to go offline, inspecting IndexedDB contents, and exercising the sync queue during reconnects. Pilot Duo on a single Livewire component and monitor its built-in sync status component before expanding.
- Is Duo ready for production Laravel applications?
- No, the README explicitly says Duo is VERY MUCH A WIP. Risks include breaking changes, schema versioning, offline conflict edge cases, and IndexedDB performance with large datasets. Use a pilot phase on one component, validate behavior, and avoid critical workflows until the package matures.