Skip to main content

Step-by-Step Setup Guide: Modern ETL Import Modal

This guide will walk you through setting up the backend API, background jobs, and the Vue frontend component for a robust, multi-stage file import process.

Part 1: Backend Setup (Laravel)

Step 1: Define API Routes

First, define the endpoints that the frontend will communicate with. File: routes/api.php

Step 2: Create the Buffer Model

This is a temporary collection to store data after parsing but before committing.
  1. Run the command:
  1. File: app/Models/EtlBuffer.php

Step 3: Create the Pre-Commit Pipeline Classes

This pipeline allows you to apply configurable data mutations before the final commit.
  1. Create the Interface: File: app/Services/Etl/Pipelines/PreCommitPipe.php
  1. Create the ConvertId Pipe: File: app/Services/Etl/Pipelines/ConvertIdToObjectIdPipe.php
  1. Create the Upsert Pipe: File: app/Services/Etl/Pipelines/UpsertPipe.php

Step 4: Create the Background Jobs

These jobs handle the heavy processing, preventing HTTP timeouts and allowing for progress tracking.
  1. Create the Parsing Job: File: app/Jobs/ProcessImportFileJob.php
  1. Create the Commit Job: File: app/Jobs/CommitImportJob.php
  1. Create the Cleanup Job: File: app/Jobs/DeleteEtlBufferJob.php

Step 5: Create the Controller

This controller connects the routes to the jobs and provides the SSE stream. File: app/Http/Controllers/EtlController.php

Part 2: Frontend Setup (Vue 2 with Bootstrap-Vue)

Step 6: Prerequisites

  1. Install necessary packages:
  1. Configure them in your main entry file: File: resources/js/app.js (or main.js)

Step 7: Create the Vue Component

This is the complete, self-contained modal component. File: resources/js/components/ImportModal.vue

Step 8: Use the Component in a Parent View

Finally, place the modal component in one of your main application views. File: e.g., resources/js/views/UsersPage.vue

Final Check

  1. Run Migrations: If you use database-based queues, run php artisan migrate.
  2. Start Queue Worker: This is critical. The background jobs will not run without it. In your terminal, run:
  1. Compile Assets: Compile your Vue components:
You now have a fully functional, modern, and robust ETL import system.