Skip to content
vp.

gearflow-api

A rental API for audiovisual equipment, built for small businesses that need to set up their logistics quickly: it takes each order from booking to return, including maintenance margins and unit swaps.

Its design decisions are documented in the repository and were reviewed by a senior developer. Automated tests cover the hard cases, such as two simultaneous requests for the same equipment.

ROLE
Sole developer: design, architecture and testing.
YEAR
2026
STATUS
RUNS LOCALLY · DOCKER · PUBLIC REPO
STACK
NestJS, TypeScript, PostgreSQL, Prisma, Scalar, Vitest, Supertest, Docker, GitHub Actions

How it works

  1. 01DRAFT

    Created, nothing is blocked yet.

  2. 02CONFIRMED

    The dates are blocked for this unit.

  3. 03PREPARING

    The equipment is being prepared.

  4. 04DISPATCHED

    The equipment is out with the customer.

  5. 05RETURNED

    Back in the warehouse. The order is closed.

DRAFT or CONFIRMED can go to CANCELLED, which releases the dates.

A rental order moves from DRAFT to CONFIRMED, PREPARING, DISPATCHED and RETURNED; DRAFT or CONFIRMED can go to CANCELLED, which releases the dates. Confirming blocks the dates: for the Sony FX6 #PG-01 over 27 Nov to 8 Dec 2026, one booking already holds 27 to 30 Nov plus a buffer on 1 Dec. The first request for 4 to 7 Dec gets 200, and the four others for the same dates get 409.
gearflow-api is an API and has no screens of its own.Confirming an order blocks its dates: while it is active, no other order can take the same unit on overlapping days.

Screenshot · /demo in the repo

localhost:3000/demo
Screenshot of the /demo playground in the gearflow-api repository: five parallel confirmations for the same unit and dates, one confirmed and four rejected with 409
The /demo page included in the repository, firing five parallel confirmations.

01

Context & Problem

During a company-sponsored corporate bootcamp, I built a warehouse, inventory and order system for real use in Appian (a low-code platform, that is, visual programming).

gearflow-api is its logistics core, rewritten in NestJS and TypeScript, the ecosystem where I am most at home. Appian needs its own environment and cannot be shown openly, so this repository is how I show my backend work.

I chose rental over sale because it adds the challenge of time: dates, returns and maintenance.

For now it runs locally: it starts with Docker following the README instructions, and it has a playground at /demo.

02

Key Architectural Decisions

  1. A scope limited to the logistics core

    I built only the logistics core of the original system and left out the full application: customer risk assessment, invoices, Excel import, picking and operator interfaces. With limited time, I wanted to show judgement, decision-making and command of the stack, not deliver a complete application.

  2. The same equipment is never booked twice

    Avoiding overlaps is a requirement; the decision was where to enforce it. A camera rented from the 1st to the 5th is still available on the 10th: only the real dates of each rental, plus maintenance days, are blocked, and the database itself prevents booking it twice, through a PostgreSQL exclusion constraint (EXCLUDE USING gist) that answers with a 409 (conflict) error. I discarded marking the unit as "reserved", because it would block free future dates, and checking only in code, because two simultaneous requests could slip through together. It is documented in architecture decision record (ADR 0001).

  3. The customer books a model; the company controls the unit

    The customer books a model and a quantity, not a specific unit. I discarded letting them choose the unit: the customer cares about the model, the company about the serial number, to know exactly which equipment goes out and that the same one comes back. That way the business can replace or reassign units at the last minute without touching the customer's order. ADR 0027.

  4. A development workflow with three quality controls

    I planned the scope and designed and audited every epic and ticket before implementing them with AI assistance. A second model reviewed each change, and a senior developer specialised in the stack reviewed the result and pointed out 13 improvements, which were merged into the main branch. I discarded generating code without a plan or review: what matters is making good decisions and testing them.

03

Technical Challenges

  • Showing that it holds under simultaneous requests. An end-to-end test against a real PostgreSQL fires 10 simultaneous confirmations for the same unit and dates: exactly one wins, the other nine get a 409 and there is never a server error. The /demo playground shows it with five parallel confirmations: one confirmed, four rejected.
  • Making the decisions checkable. The repository documents 36 architecture decisions (ADR), two of them superseded by later ones, with their context, discarded alternatives and consequences.
  • Putting the requirement to the test with a real case. A web channel lets in-store and online rentals hit the same inventory at once, which is where the no-overlap requirement would break. The API documentation uses Scalar instead of Swagger UI because it is easier for reviewers (ADR 0017).
  • What happens when equipment comes back late. A maintenance job or a return that exceeds the reserved margin is rejected with a 409 when the order is prepared, and swapping the unit is the way out. It is documented in ADR 0028 and 0029.
  • Getting the demo ready to be shared. In demo mode, the data returns to a known state after 12 hours or on demand, so one visitor cannot leave it broken for the next. Requests are limited in two layers: per IP before authentication, to stop floods, and per user after it, so an office sharing one connection is not blocked as a single visitor.

04

Scope and next steps

  • The web channel uses a single shared API key and has no customer accounts, because it is a demonstration. The next step is one key per customer and a more complete security structure.
  • Access tokens are checked without querying the database, which keeps every request cheap. The trade-off is that after logging out a token stays valid until it expires, at most 15 minutes, while the session behind it is revoked at once. In a multi-instance deployment, the next step would be moving to shared state (for example, Redis) so they can be revoked on logout.
  • The request rate limit lives in memory: it works per instance and resets with it. In a multi-instance deployment, it would also move to shared state (for example, Redis).

05

Takeaways

What added the most value was discussing the product and its decisions before writing a line of code. Deciding well means questioning every option, and a senior developer’s review taught me what to look for from now on.

NEXT PROJECT — 03

Hnos. Peláez