Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Turbojetstream Laravel Package

sooand/turbojetstream

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Steps to Begin

  1. Installation Replace laravel/jetstream with sooand/turbojetstream in your composer.json:

    composer require sooand/turbojetstream
    

    Run the Jetstream installer with the --framework flag for Svelte/Vue:

    php artisan jetstream:install --framework=svelte
    # or
    php artisan jetstream:install --framework=vue
    
  2. First Use Case

    • Svelte/Vue Integration: TurboJetstream extends Jetstream’s Inertia support to include Svelte (default) or Vue (explicitly). After installation, the scaffolding will generate Svelte components by default (e.g., resources/js/Pages/Auth/Login.svelte).
    • Verify Setup: Check resources/js/Pages/ for framework-specific files and ensure vite.config.js includes Svelte/Vue plugins.

Implementation Patterns

Core Workflows

  1. Framework-Specific Scaffolding

    • Svelte: Uses .svelte files for components (e.g., Login.svelte). Leverage Svelte’s reactivity and lifecycle hooks in auth/team pages.
    • Vue: Explicitly opt-in via --framework=vue flag. Components remain .vue files (e.g., Login.vue), but TurboJetstream ensures compatibility with Jetstream’s auth logic.
    • Example: Override the default resources/js/Pages/Profile/Show.svelte to customize user profiles:
      <script>
        import { Head, usePage } from '@inertiajs/inertia-svelte';
        let user = usePage().props.user;
      </script>
      
      <Head title="Profile" />
      <div>{user.name}</div>
      
  2. Inertia Integration

    • TurboJetstream preserves Jetstream’s Inertia setup. Use @inertiajs/inertia-svelte (Svelte) or @inertiajs/inertia-vue3 (Vue) for routing.
    • Pattern: Link to routes via Link components (e.g., <Link href="/dashboard">Dashboard</Link>).
  3. Team/Invitation Logic

    • Extend Jetstream’s team features (e.g., TeamMemberInvitation model) by overriding resources/js/Pages/Teams/Invite.svelte or Invite.vue.
    • Tip: Use Jetstream’s existing InvitationsController and adapt the frontend to display invite statuses (e.g., "Pending" vs. "Accepted").
  4. Theming with Daisy UI (Future)

    • Once Daisy UI support is added, replace Tailwind directives in .svelte/.vue files with Daisy UI classes (e.g., btn btn-primary instead of bg-blue-500).

Integration Tips

  • Shared Logic: Reuse Jetstream’s backend logic (e.g., app/Http/Controllers/Auth/RegisteredUserController) while customizing only the frontend.
  • API Routes: TurboJetstream doesn’t modify Jetstream’s API routes. Use routes/api.php for custom endpoints.
  • Testing: Test Svelte/Vue components with @testing-library/svelte or @vue/test-utils alongside Laravel’s HTTP tests.

Gotchas and Tips

Pitfalls

  1. Framework Mismatch

    • Issue: Installing with --framework=svelte but using Vue components (or vice versa) will break builds.
    • Fix: Delete node_modules and reinstall if switching frameworks:
      rm -rf node_modules && npm install
      
  2. Missing Svelte/Vue Plugins

    • Issue: Forgetting to add Svelte/Vue to vite.config.js:
      // For Svelte
      import { svelte } from '@sveltejs/vite-plugin-svelte';
      plugins: [svelte()],
      
    • Fix: Run npm run dev to catch missing dependencies.
  3. Jetstream Auth Logic Assumptions

    • Issue: Overriding auth components (e.g., Login.svelte) without preserving Jetstream’s validation/error handling.
    • Tip: Extend the parent component’s props:
      <script>
        export let errors;
        export let status;
      </script>
      
  4. Team Invitation Quirks

    • Issue: TurboJetstream’s invite features are "future" and may not be fully implemented. Jetstream’s default invite flow might still apply.
    • Workaround: Check the TeamMemberInvitation model and InvitationsController for custom logic.

Debugging

  • Build Errors: Clear Vite cache with npm run dev -- --force.
  • Inertia Page Not Found: Ensure resources/js/Pages/ files match route names in routes/web.php (e.g., Profile/Show/profile).
  • CSRF Tokens: TurboJetstream inherits Jetstream’s CSRF protection. Verify @csrf directives in forms.

Extension Points

  1. Custom Frontend Frameworks

    • Plan: Add React support by extending the --framework flag. Contribute by:
      • Adding a react option to JetstreamServiceProvider.
      • Generating .jsx files in resources/js/Pages/.
    • Example PR Structure:
      // app/Providers/JetstreamServiceProvider.php
      $frameworks = ['vue', 'svelte', 'react']; // Add 'react'
      
  2. Daisy UI Migration

    • Tip: Use a build script to replace Tailwind classes:
      sed -i 's/btn-blue-500/btn-primary/g' resources/js/Pages/*.svelte
      
  3. Multitenancy

    • Integration: Pair with Spatie’s multitenancy by overriding Team model and TeamController to include tenant logic:
      use Spatie\Multitenancy\Tenancy;
      public function store(Request $request) {
          $tenant = Tenancy::resolve();
          // Custom tenant-aware logic
      }
      
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui