Skip to content

https://github.com/DieGomezR/sr-fullstack-challenge/pull/new/feature/logistics-notification-hub#1

Open
DieGomezR wants to merge 7 commits intoRed-Valley:mainfrom
DieGomezR:feature/logistics-notification-hub
Open

https://github.com/DieGomezR/sr-fullstack-challenge/pull/new/feature/logistics-notification-hub#1
DieGomezR wants to merge 7 commits intoRed-Valley:mainfrom
DieGomezR:feature/logistics-notification-hub

Conversation

@DieGomezR
Copy link
Copy Markdown

Summary

This PR implements the challenge as a small real-time logistics notification system.

The solution includes:

  • a Next.js app with App Router
  • a separate Bun service for notifications and WebSocket fanout
  • SQLite persistence
  • a real-time dashboard for operations
  • Docker Compose to run the full stack

What I built

API

  • POST /api/notifications
  • GET /api/notifications
  • GET /api/channels

The API validates input, returns consistent responses, and forwards notification creation to the Bun hub.

Bun notification hub

The Bun service is responsible for:

  • storing notifications in SQLite
  • serving filtered notification queries
  • managing WebSocket subscriptions by channel
  • broadcasting new notifications to subscribed clients
  • exposing a /health endpoint

Frontend

The UI is a single-page dashboard that:

  • connects to the WebSocket server
  • shows connection state
  • displays notifications in real time
  • supports filtering by channel and priority
  • allows creating notifications from the UI

I started with a simpler dashboard and then refactored it into smaller panels before doing the final visual pass.

Architecture / decisions

I kept the Next.js API and the Bun hub as separate responsibilities.

Next.js handles:

  • the user-facing app
  • the public API routes
  • request validation and response formatting

The Bun service handles:

  • persistence
  • real-time fanout
  • subscription management

I chose SQLite because it fits the scope of the challenge well and keeps the project easy to run locally.

I also kept the communication between Next.js and the Bun service simple through internal HTTP calls instead of introducing a queue or pub/sub layer for this time box.

Frontend notes

The dashboard was redesigned with shadcn/ui components and a HextaUI-inspired layout after the functional version was working.

I also split the dashboard into smaller components to improve readability and separation of concerns, since the initial implementation was growing too large.

Docker / Bun note

The challenge requires Bun, so the solution keeps Bun in the runtime path for both:

  • the notification hub
  • the Next.js app execution flow

For the app scripts I used:

  • bun --bun next dev --webpack
  • bun --bun next build --webpack
  • bun --bun next start

I switched the Next.js build path away from the Turbopack path because Bun was hitting unsupported worker_threads options in this environment.

I also removed the dependency on Google Fonts at build time so Docker builds do not fail when external font fetches are blocked.

Validation

I validated the project locally with:

  • npm run lint
  • npm run typecheck
  • next build --webpack

Trade-offs

A few things I would improve with more time:

  • add auth / access control for an internal tool
  • add integration or E2E tests
  • add better observability around WebSocket lifecycle and failures
  • add a queue or pub/sub layer if this needed to scale beyond a single hub instance

AI usage

I used Codex/ChatGPT in parts of the implementation, refactoring, and review process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant