Gestión de Loteos — Panel municipalLand Lots Management — Municipal panel
Aplicación fullstack que reemplaza un sistema municipal legado de loteos, con permisos por área, bitácora auditada y mapa de lotes.Fullstack app that replaces a legacy municipal land-lots system, with per-department permissions, an audited log and a lots map.
El desafío
El municipio consultaba y gestionaba sus loteos (nomenclatura, titular, uso, mensura, estado de construcción) en un sistema ASP.NET WebForms de hace una década. Antes de escribir código hice un diagnóstico del sistema en producción, en modo solo lectura:
- El inicio estaba roto: cargaba un mapa dentro de un iframe que respondía 404, y si el mapa vivía en otro servidor obligaba a un segundo login.
- No se podía usar en el celular: el viewport estaba mal escrito, los submenús se abrían fuera de la pantalla y la grilla de 8 columnas en 12 px se desbordaba.
- La búsqueda tapaba el resultado: 12 filtros siempre desplegados, sin contador, sin “limpiar” y sin filtros activos visibles.
- Accesibilidad: botones de acción sin texto ni
aria-label, color institucional con contraste 3.1:1 (no cumple WCAG AA) y modales con doble scroll. - Seguridad: encontré varios problemas de manejo de credenciales y sesión, que documenté en un anexo para el área de Sistemas.
La solución
Una aplicación nueva, no un skin sobre el sistema viejo. Cada área (Obras, Gobierno, Juzgado, Hacienda) ve todo el padrón pero edita solo su información, y cada cambio queda registrado.
- Login único con DNI, contraseña segura, cambio de clave obligatorio en el primer ingreso, recuperación y “Mi perfil”.
- Shell por rol: cada usuario ve un menú distinto según sea superadmin, admin o área.
- Padrón con búsqueda real: filtros progresivos, chips de filtros activos, contador, filtros guardados en la URL y tarjetas en móvil.
- Ficha del lote con la bitácora de actuaciones por área: la última destacada, el resto de la más reciente a la más antigua, con fotos por actuación.
- Mapa de lotes a pantalla completa sobre fondo satelital, con cada lote coloreado por la última área que actuó y un panel lateral con la información del lote.
- Usuarios y auditoría: alta de usuarios por el admin, sin registro público, y un registro inmutable de quién cambió qué y cuándo.
- Migración de datos: importador que lee el KML del GIS (114 lotes con su polígono), normaliza los campos, detecta fechas dentro del texto y genera el SQL de carga.
Lo técnico
- Next.js 15 con App Router, Server Actions y validación con Zod del lado del servidor.
- Supabase (Postgres + PostGIS). Los permisos por área se aplican con Row Level Security: aunque alguien manipule el front, la base no le deja escribir fuera de su área.
- Historial append-only y auditoría con triggers; control de versión para ediciones simultáneas.
- MapLibre GL con GeoJSON, sin iframes ni segundo login.
- Tests de las políticas RLS y migraciones SQL versionadas.
- Sin CDNs externos, porque la red municipal los bloquea.
The challenge
The municipality looked up and managed its land lots (cadastral ID, owner, land use, survey plan, construction status) in a decade-old ASP.NET WebForms system. Before writing any code I audited the production system in read-only mode:
- The home page was broken: it loaded a map inside an iframe that returned 404, and when the map lived on another server it forced a second login.
- It didn’t work on phones: a malformed viewport, submenus opening off-screen and an 8-column, 12px grid that overflowed.
- Search buried the results: 12 filters always expanded, no result count, no “clear” and no visible active filters.
- Accessibility: action buttons with no text or
aria-label, a brand color with 3.1:1 contrast (fails WCAG AA) and modals with double scroll. - Security: I found several credential and session-handling issues and documented them in an appendix for the IT department.
The solution
A brand-new application, not a reskin of the old one. Each department (Public Works, Government, Court, Treasury) sees the whole registry but only edits its own data, and every change is recorded.
- Single sign-on with national ID, strong passwords, forced password change on first login, recovery and a profile page.
- Role-based shell: superadmins, admins and department users each get a different menu.
- Real search over the registry: progressive filters, active-filter chips, result count, filters stored in the URL and cards on mobile.
- Lot detail page with a per-department log of actions: the latest one highlighted, the rest from newest to oldest, with photos per entry.
- Full-screen lots map over satellite imagery, each lot colored by the last department that acted on it, with a side panel showing its details.
- Users and audit: admins create users (no public sign-up) and an immutable log records who changed what and when.
- Data migration: an importer that reads the GIS KML (114 lots with their polygons), normalizes fields, detects dates inside free text and generates the load SQL.
Under the hood
- Next.js 15 with the App Router, Server Actions and server-side Zod validation.
- Supabase (Postgres + PostGIS). Per-department permissions are enforced with Row Level Security: even if someone tampers with the frontend, the database won’t let them write outside their department.
- Append-only history and audit through triggers; version checks for concurrent edits.
- MapLibre GL with GeoJSON, no iframes and no second login.
- Tests for the RLS policies and versioned SQL migrations.
- No external CDNs, because the municipal network blocks them.
Versión mobile