Rent a Car Mars
A car rental company in Prishtinë running its fleet on phone calls and a paper diary — given a public site and a staff back office that share one database, so a date booked online is unavailable everywhere the same second.
Overview
Mars rents cars in Prishtinë, mostly to locals and to diaspora flying in for a few weeks. The fleet was booked the way small rental firms everywhere book them: a phone call, a name in a diary, and someone's memory of whether the Tiguan is back on Friday. It works until two people ask for the same week.
A brochure website would not have helped — it would have been a fourth place the truth lives. So we built the site and the back office as one system on one database: the customer sees the same calendar the staff see, a submitted reservation takes its dates immediately, and nothing about availability is ever typed in twice.
A fleet page that reads from the fleet.
Every car on the site comes out of the cars table. Adding one in the back office publishes it immediately; retiring one removes it from the site while keeping its booking history intact. Even the filter pills are generated from the types the fleet actually contains — so a filter can never return an empty page.
The pages are server-rendered, which is the point: a rental firm competing for “makina me qira Prishtinë” needs Google to see the fleet, not an empty shell waiting on JavaScript. All copy is in Albanian, because that is who is renting.
Rendered on the server
Every car is in the HTML before a line of JavaScript runs, so search engines index the fleet and the page is useful on a slow connection.
Filters built from the data
The type pills are derived from the fleet, not hardcoded in the markup. Add the first convertible and its filter appears; retire the last SUV and that filter goes.
Photography that fits the pipe
Each car ships at two sizes and the card advertises the smaller one to phones — but only once the file is verified on disk, because a srcset naming a missing image renders as broken.
The dates are taken before anyone picks up the phone.
This is the part that changes the business. Submitting the form does not send an email and hope — it takes the dates immediately, as a hold that lasts 30 minutes. For that half hour nobody else can book them. Staff confirm or cancel from the back office; if nobody acts, the hold expires and the dates free themselves.
Two people can submit the same dates in the same instant. Both requests check availability, both see the car is free, and both insert — one car, two customers, one very bad Friday.
So the hold locks the car's row before it checks, forcing the second request to wait for the first to finish. This is not theoretical: with the lock removed, a concurrency test double-booked 2 rounds out of 8. With it, zero.
One definition of "free"
Confirmed bookings, live holds and dates blocked by staff all fall out of a single query. The customer calendar and the office calendar are literally the same code.
Holds that clean up after themselves
Expiry is a filter on every read, not a scheduled job. There is no cron to forget, and nothing rots if the host kills background tasks.
A row lock, not a race
The car's row is locked before availability is checked, so two simultaneous submits are serialised. The second one is told the dates went, rather than quietly taking them too.
Holding costs the visitor nothing
Which is exactly why one script could block the whole fleet. Each address is capped at three live holds and six submissions an hour — over the cap the enquiry still reaches the office, it just reserves nothing.
Kosovo time, not server time
The host runs UTC. The database session is pinned to Prishtinë time on every connection — without it a 30-minute hold expires two hours before it was created.
The enquiry survives the email
Shared hosting drops mail silently. Every reservation and contact message is written to the database first, so a failed send loses the notification, never the customer.
The diary, replaced by the thing it was tracking.
Staff log in at /admin and land on Porositë — orders, holds first, because those are the ones on a clock. The list refreshes every five seconds and counts each hold down live, so a reservation that arrived while the page was open appears without anyone reloading anything.
The calendar in the back office is the customer's calendar — the same widget, the same query, the same shading. That is deliberate: “is the T-Roc free on the 24th?” has one answer in this business, and two screens that could render it differently would eventually do so.
Sessions that expire, logins that throttle
Staff sessions carry CSRF tokens on every state change, and repeated failed logins are rate limited per account and address.
Confirming can fail, and says so
A hold can expire while staff are reading it. Confirm re-checks the dates and refuses with a plain explanation rather than writing a booking over someone else's.
Nothing is deleted
Cars are hidden, not removed, and cancelled bookings keep their record and who decided it — so the history survives a change of mind.
Credentials live outside the site
The database config sits one level above the web root. If PHP ever breaks on a shared host, the file cannot be served as plain text.
Engineering
The whole thing is PHP, MySQL and vanilla JavaScript with no build step — and that is a design decision, not a shortcut. The client is on HostGator shared hosting: Apache, PHP, MySQL, no Node, no container, no deploy pipeline they would have to pay someone to maintain.
A framework here would have bought abstractions and cost them the ability to hand the site to anyone else. Instead: files upload, schema imports, site runs. The header and footer live in one file, every colour and radius is a custom property in one :root block, and the entire front end is one stylesheet and one script.
The customer is on a phone. So is the owner.
Most of this traffic is a phone — someone comparing cars on the way to the airport. The booking calendar reflows to a single month, the fleet stacks, and the filter pills wrap instead of scrolling off the edge. The back office is responsive too, which matters more than it sounds: it means a hold can be confirmed from behind the counter, or from the car park, without finding a desk.
Everything else earns the reservation.
Mars went from a fleet tracked in someone's head to a fleet tracked in one place, visible to the customer and the office at the same time. The site sells the cars; the platform behind it makes sure it can only sell the ones that are actually free.