How adzky/imageprocessorqueue works
This repository provides an image-to-WebP service with a React client and two interchangeable asynchronous backends: Laravel and Fastify/TypeScript. The main workflow is upload and validate, persist a pending job, enqueue it, process and store the result, then poll status and download; both backends also support stale-job recovery and result retention. The README documents shared behavior and capabilities; edges for unsampled implementation details are limited to documented relationships or omitted.
Main entry points: App.tsx Upload and job view · client.ts HTTP client · repository.ts Job repository · server.ts API process
Components 31
React frontend
- Upload and job view
apps/web/src/App.tsx - File selection
apps/web/src/components/Dropzone.tsx - HTTP client
apps/web/src/api/client.ts - Status polling hook
apps/web/src/hooks/useJobStatus.ts - Backoff polling
apps/web/src/lib/pollWithBackoff.ts - Reload persistence
apps/web/src/lib/currentJobStorage.ts - Job result card
apps/web/src/components/JobCard.tsx - Status timeline
apps/web/src/components/StatusTimeline.tsx
Fastify backend
- Fastify API
apps/api-ts/src/http/app.ts - Image routes
apps/api-ts/src/http/routes/images.ts - Upload handling
apps/api-ts/src/http/upload.ts - Job repository
apps/api-ts/src/jobs/repository.ts - Job table schema
apps/api-ts/src/db/schema.ts - API process
apps/api-ts/src/server.ts - BullMQ producer
apps/api-ts/src/queue.ts - Queue worker
apps/api-ts/src/worker.ts
Laravel backend
- Image API controller
apps/api/app/Http/Controllers/ImageJobController.php - Image job model
apps/api/app/Models/ImageJob.php - Queued image job
apps/api/app/Jobs/ProcessImage.php
Processing and recovery
- Job processing
apps/api-ts/src/jobs/process-job.ts - Image transformation
apps/api-ts/src/images/processor.ts - Retention cleanup
apps/api-ts/src/maintenance/cleanup.ts - Stale-job reaper
apps/api-ts/src/maintenance/reap-stale.ts - Image job runner
apps/api/app/Images/ImageJobRunner.php - Image transformation
apps/api/app/Images/ImageProcessor.php - Retention command
apps/api/app/Console/Commands/CleanupImageJobs.php - Stale-job command
apps/api/app/Console/Commands/ReapStaleImageJobs.php
Other components
- Image uploader
- Postgres
- Redis queue
- Image file storage
Connections 38
- Image uploader → Upload and job view: selects image
- Upload and job view → File selection: renders
apps/web/src/App.tsx - File selection → Upload and job view: provides file
apps/web/src/App.tsx - Upload and job view → HTTP client: uploads image
apps/web/src/App.tsx - Upload and job view → Reload persistence: saves job
apps/web/src/App.tsx - Upload and job view → Status polling hook: watches job
apps/web/src/App.tsx - Status polling hook → HTTP client: fetches status
apps/web/src/hooks/useJobStatus.ts - Status polling hook → Backoff polling: uses backoff
apps/web/src/hooks/useJobStatus.ts - Upload and job view → Job result card: renders result
apps/web/src/App.tsx - Job result card → Status timeline: renders timeline
apps/web/src/components/JobCard.tsx - HTTP client → Fastify API: HTTP requests
- HTTP client → Image API controller: HTTP requests
- API process → Fastify API: builds app
apps/api-ts/src/server.ts - API process → BullMQ producer: creates producer
apps/api-ts/src/server.ts - Fastify API → Image routes: registers routes
apps/api-ts/src/http/app.ts - Image routes → Upload handling: handles upload
apps/api-ts/src/http/routes/images.ts - Upload handling → Job repository: records job
apps/api-ts/src/http/upload.ts - Job repository → Job table schema: queries table
apps/api-ts/src/jobs/repository.ts - Job repository → Postgres: reads and writes
apps/api-ts/src/jobs/repository.ts - API process → Postgres: connects
apps/api-ts/src/server.ts - BullMQ producer → Redis queue: queues jobs
- Queue worker → Redis queue: consumes jobs
- Queue worker → Job processing: runs job
apps/api-ts/src/worker.ts - Job processing → Job repository: claims and updates
- Job processing → Image transformation: transforms image
- Image transformation → Image file storage: writes result
- Retention cleanup → Postgres: expires jobs
apps/api-ts/src/maintenance/cleanup.ts - Retention cleanup → Image file storage: deletes files
- Stale-job reaper → Postgres: fails stale jobs
- Image API controller → Image job model: creates and reads
apps/api/app/Http/Controllers/ImageJobController.php - Image API controller → Queued image job: dispatches job
apps/api/app/Http/Controllers/ImageJobController.php - Queued image job → Image job runner: runs processing
apps/api/app/Jobs/ProcessImage.php - Image job runner → Image transformation: transforms image
- Image transformation → Image file storage: writes result
- Queued image job → Redis queue: uses queue
- Retention command → Postgres: expires jobs
- Retention command → Image file storage: deletes files
- Stale-job command → Postgres: fails stale jobs