Skip to content

a1lan1/task-tracker-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Task Tracker Demo — Realtime & Kafka

The development environment is fully containerized using Docker and Laravel Sail.

  • mateusjunges/laravel-kafka: This package provides a nice way of producing and consuming kafka messages in your Laravel projects.

Getting Started

  1. Setup the environment.

    composer setup
  2. Build and start the application containers.

    sail build
    sail up -d
  3. Run migrations and seed data.

    sail artisan migrate:fresh --seed
  4. Create Kafka topics.

    make kafka-create-topics
  5. Run Kafka consumers.

    sail artisan kafka:tasks-consumer
    sail artisan kafka:comments-consumer
  6. Start the frontend development server.

    sail yarn dev

Code Quality & Linting

  • Pint: Fix code style issues.
    sail pint
  • PHPStan: Run static analysis to find potential bugs.
    sail phpstan analyse
  • ESLint: Lint and format frontend code.
    sail yarn lint

Testing

sail up -d
sail shell
make test

Realtime + Kafka Architecture

  • Topics:

    • tasks.status.updated — task status changes.
    • comments.created — comment creation.
  • Producers (Laravel):

    • App\Kafka\Producers\TaskStatusProducer — publishes to tasks.status.updated when the task status changes.
    • App\Kafka\Producers\CommentCreatedProducer — publishes to comments.created when a comment is created.
  • Consumers (Artisan commands):

    • php artisan kafka:tasks-consumer (group: task-status-consumers)
    • php artisan kafka:comments-consumer (group: comments-consumers)
    • For DEV, both consumers output useful logs of received payloads to STDOUT.
  • Broadcasting in Soketi:

    • Events from consumers are broadcast via Laravel Broadcast:
      • App\Events\TaskStatusUpdatedBroadcast → channel project.{project_id} → event .task-status-updated.
      • App\Events\TaskCommentCreatedBroadcast → channel project.{project_id} → event .comment-created.
    • The frontend subscribes to the required project channel and updates the UI.

Soketi Logs

./vendor/bin/sail logs -f soketi

Production notes

  • Consumers should be run under Supervisor/systemd with autorestart and logging.
  • Scaling is achieved through consumer groups (numprocs > 1) and topic partitions.

About

Task Tracker Demo — Realtime & Kafka

Resources

Stars

Watchers

Forks

Contributors