Overview
TuPatriSeguro advises people who want to buy, sell or invest in property, vehicles and other assets. The site presents the service, publishes a catalog the business manages itself from a password-protected panel, and turns every enquiry into a WhatsApp conversation that carries a reference to a stored consent record.
Problem
The business needed to publish and edit listings without a developer, across categories that describe very different things — a house is not a car — and to collect personal data under Colombian data-protection rules with evidence it could produce later.
What it is
A Next.js site with a public side and a private one. The public side tells the service's story in order — services, process, catalog, guarantees, team, questions, location, contact — and gives each category its own page with search and sorting, and each listing a page with a gallery, an optional video and a WhatsApp button.
The private side is a panel where the owner creates, edits, features, hides and deletes listings, uploads photos, and reviews and exports the consent records.
One catalog for different kinds of assets
The four categories — property, vehicles, products and other — are fixed in one file that the routes, menus and admin all read. Listings live in a single Postgres table; the features specific to each kind (area and bedrooms for a house, mileage for a car) are stored as a JSON list of label and value, so a new kind of feature needs no migration.
Photos go to Vercel Blob from a Server Action and the listing keeps their URLs. After every write the affected pages are revalidated, and listing pages render on each request, so an edit or a deletion shows at once.
- Search ignores accents and case and also looks inside attribute values; listings without a price sort last in either direction.
- Each listing generates its own share preview with title, price and cover photo.
- Favorites and recently viewed are kept in the visitor's browser as ids only; the data always comes fresh from the database.
The admin panel
Access uses a single password from an environment variable, compared in constant time. A successful login sets an HttpOnly cookie holding an expiry and its HMAC-SHA256 signature, valid for seven days, so the server needs no session table.
The proxy redirects any /admin request without a valid session to the login. That check is only the fast path: every Server Action that writes, and the CSV export, verifies the signature again before doing anything.
Consent that can be shown later
The contact form does not send an email. It builds a WhatsApp message from the visitor's choices and opens it, and it can only be sent after the visitor accepts the terms and the privacy policy. That acceptance is stored with a short reference code, which also travels inside the WhatsApp message, so a conversation can be matched to its record.
Cookie choices are stored the same way. Third-party embeds — Google Maps and YouTube — stay behind a placeholder until the visitor allows them, and recently viewed listings are only recorded with permission. Raising the cookie policy's version shows the notice again.
- Document versions come from the server, never from what the browser sends.
- Each record keeps the page, IP address and browser, as evidence of the context.
- The panel filters and searches the records and exports them as CSV, with cells that could run as spreadsheet formulas neutralized.
Architecture
Technical decisions
- Flexible attributes instead of a table per category
- A house, a car and a product share title, price, photos and location, and differ in everything else. Keeping the differences as label–value pairs lets the owner describe anything from the same form, at the cost of not being able to filter by a typed field like bedrooms.
- A signed cookie instead of a session store
- There is one administrator. An expiry signed with a server secret is enough to prove the session, needs no table, and is verified again by every action that writes.
- An append-only consent log
- A change of preference is a new row, not an update. The log shows what was accepted at each moment, with the document version, instead of only the latest state.
- WhatsApp opens within the click
- Browsers block a window opened after waiting for the server, so the consent is recorded in the background while WhatsApp opens. The reference code in the message ties the two together.
- Neutralize formulas in the export
- Visitors type their own name, and the records are opened in Excel. A cell starting with =, +, - or @ is prefixed so it is read as text.
Evidence
4
Catalog categories served by a single table
Source: data/categories.ts · lib/db/schema.ts
3
Legal documents with their own version, stored with each consent
Source: data/legal.ts
3 of 3
Admin writes that re-verify the session
Source: app/admin/actions.ts
Limitations
- There are no automated tests and no CI.
- The admin has one shared password and the login has no attempt limit.
- A signed session cannot be revoked before it expires, short of changing the secret.
- Consent is recorded without waiting for the server; if that write fails, the WhatsApp message still opens and its reference has no row.
- Catalog search runs in the browser over the listings already loaded, which suits a small catalog.
