Pits Burger

Staff scheduling for a restaurant chain

Overview

Pits Burger is a scheduling app I'm building for a burger restaurant business with four locations. It has two web apps that share one backend. In the owner app, the owner manages restaurants, opening hours, shifts, positions, contracts and employees, and plans the weekly schedule for every location. In the mobile-friendly employee app, part-time staff submit which days and shifts they can work the following week. A live demo with fictional data runs on Vercel.

The problem it solves

Before this, the owner planned every week in a large Excel workbook and sent the finished schedule as a PDF over WhatsApp. Tracking who could work when, across four restaurants and staff who work at more than one of them, was manual work, and it was easy to book the same person twice. Now employees submit their availability inside a time window the owner sets, with a limited number of edits. Each submission shows up as a suggestion in the owner's schedule, and the owner can accept, change or dismiss it with one click. The schedule still looks like the Excel sheets the owner knows and can still be exported as a PDF. The difference is that the database stops anyone from being booked for two shifts on the same day, even across restaurants.

Challenges I faced

The hardest design question was where an employee's availability should appear. Availability belongs to a person, but most employees work several positions in several restaurants, and showing it in every schedule would invite double-booking. I gave each employee one default restaurant, enforced by a partial unique index in PostgreSQL. API rules back it up: if the owner deletes a restaurant or removes one from an employee who still has shifts there, the API returns a 409 listing exactly what blocks the change.

The trickiest bug never appeared in local testing. While reviewing the code before production, I found that a helper inside the availability transaction queried the global database object instead of the transaction, so each request grabbed a second connection from the pool. If ten employees submitted at the same moment, every connection would be held by an open transaction waiting for an eleventh that would never free up. This connection pool exhaustion would have frozen the whole API. Passing the transaction into the helper fixed it, and it taught me that every query inside a transaction has to run on that transaction.

Tech stack

The whole project is written in TypeScript. The backend is a REST API built with Node.js, Express 5, Zod for validation and Drizzle ORM on PostgreSQL. It uses cookie-based sessions, bcrypt password hashing and login rate limiting. Both frontends use React 19 with Vite, React Router, TanStack Query for server state, Zustand for client-only state and CSS Modules, with jsPDF for the schedule export. There are over 1,300 unit and integration tests (Vitest, Supertest, Testing Library) and Playwright end-to-end tests in Chromium, WebKit and an iPhone viewport, all running in GitHub Actions CI. The demo runs on Vercel with a Neon PostgreSQL database, and contract PDFs are stored in Cloudflare R2.

  • TypeScript
  • Node.js
  • Express
  • Zod
  • Drizzle ORM
  • PostgreSQL
  • React
  • Vite
  • React Router
  • TanStack Query
  • Vitest
  • Testing Library
  • Playwright
  • GitHub Actions
  • Vercel
  • Neon
  • Cloudflare R2