Back to work

CMS, PostgreSQL, and GTFS data

Flarrea Postgre

Flarrea Postgre turns a corporate site into an editable platform with living transport data. The CMS manages pages, alerts, media, SEO, and forms, while PostgreSQL supports routes, stops, journey patterns, timetables, and metadata imported from GTFS.

Abstract transport system with routes, timetables, CMS, and data layers.

Year

2026

Duration

Iterative product

Budget range

Mid-high scope custom platform

Service

Advanced CMS with structured data

Case notes

What had to be solved and how it was shaped.

Challenge

The challenge was connecting two worlds that usually live apart: an easy-to-edit public website and a technical transport data layer with GTFS data, directions, stops, special schedules, maps, fares, and alerts.

Solution

I built the platform on Payload CMS 3, Next.js 15, React 19, and PostgreSQL. I modeled specific collections for routes, stops, and journey patterns, created GTFS importers, added reusable blocks, and prepared the admin for content, preview, SEO, search, forms, and revalidation.

Outcome

A product foundation where the team can edit content, publish alerts, manage pages, and show real transport information without relying on static structures.

Results

  • Editorial CMS with pages, posts, alerts, media, SEO, forms, and reusable blocks
  • PostgreSQL data model for routes, stops, journey patterns, timetables, directions, and special dates
  • GTFS import, public timetable view, maps, CRTM fares, search, redirects, and live preview

Scope

Payload CMSPostgreSQLGTFSEditorial blocksPublic timetables

Technology

A stack chosen for the job, not for decoration.

Payload CMS 3Next.js 15React 19PostgreSQLGTFSTypeScriptTailwind CSSshadcn/uiRadix UILexicalPayload SEOPayload SearchPayload RedirectsPayload FormsNested DocsLive PreviewNodemailerTurnstilenext-sitemapDocker

Capability map

Every layer that makes this project substantial.

CMS + transport platform

The project is not just an editable website: it combines public content, technical transport data, and an admin experience built for daily operation.

  • Payload CMS 3 as the central panel for pages, posts, alerts, media, forms, SEO, and navigation
  • Next.js App Router serving the public website and admin inside the same application
  • PostgreSQL as the structured foundation for editorial and transport data

Payload 3 architecture

The Payload configuration was adapted for a real client, with branding, languages, preview, email, search, and productivity commands.

  • Custom Francisco Larrea admin with logos, metadata, BeforeLogin, and BeforeDashboard
  • Spanish/English CMS language support, with Spanish as fallback
  • Live preview with mobile, tablet, and desktop breakpoints before publishing

Route model

Lines are modeled as editable entities with visual, operational, and relational data pointing to stops and journey patterns.

  • Routes collection with lineCode, title, slug, colors, badgeTheme, maps, and direction names
  • Support for circular lines where the interface hides outbound/inbound and shows a single flow
  • Schedules by day, direction, season, special dates, and ordered departures

Stops and geodata

Stops are not plain text: they become reusable documents with code, town, category, and coordinates.

  • Stops collection with name, code, zone, externalStopId, description, town, category, latitude, and longitude
  • Associated post IDs to preserve operational source details
  • Raw field to keep imported source information and allow data auditing

Journey patterns

The system separates the line from the concrete route pattern so real service variants can be represented.

  • Trayects collection with route, direction, name, code, notes, externalTripId, serviceId, shapeId, and headsign
  • Ordered stops with sequence, start, end, and posteId
  • Pattern deduplication by stop sequence so one journey is not created for every GTFS trip

GTFS import

The importer converts GTFS files into relational content ready for Payload and PostgreSQL.

  • Reads stops, routes, trips, stop_times, calendar, and calendar_dates
  • CSV parser that handles quotes, BOM, and real transport rows
  • Stable-field upserts for routes and stops, plus controlled cleanup before reimport

Grouped timetables

The system avoids the classic one-schedule-per-trip problem by grouping departures through operational keys.

  • Grouping by route, direction, regular/special type, and day combination
  • Departures deduplicated by time and journey pattern
  • Special date support imported from calendar_dates

Public timetable view

The timetable interface is designed for real users who want to know which bus comes next, in which direction, and with which stops.

  • RouteTimetableView with Spain time and next-departure calculation
  • Day, season, direction, upcoming-only, and intelligent weekend-merge controls
  • Stops shown from the journey pattern attached to the next departure

Editorial timetable block

Timetables are integrated into the layout builder as a reusable block any editor can insert.

  • LineTimetableBlock connected to the routes collection
  • Options to show the next-bus card and map
  • Server-side render that resolves the route from Payload before rendering the public view

CRTM fares

The website includes transport-specific blocks that go beyond text and photos.

  • Fare block with zones, single ticket, and 10-trip ticket
  • EUR currency formatting with Intl for local consistency
  • Responsive table ready for administrative content

Alerts and public communication

The client can publish operational alerts with rich content, documents, and dedicated SEO.

  • Alerts collection with drafts, scheduled publish, preview, and revalidation
  • Lexical content with banners, code, media blocks, hero image, and optional PDF
  • Clean slug URLs and SEO metadata per alert

Premium blocks and layout builder

The editorial layer combines Payload-native blocks with visual sections specific to a transport brand.

  • Content, Media, CTA, Archive, Banner, Code, Contact, Download, Testimonial, and Services blocks
  • Custom Feature221 and Feature222 blocks for high-impact visual sections
  • Centralized RenderBlocks composition so pages can be built without code edits

SEO, search, and redirects

The platform includes real tools for growth, maintenance, and URL migrations.

  • Payload SEO plugin with title, description, image, overview, and preview fields
  • Payload Search with beforeSync and overrides to index relevant content
  • Payload Redirects with revalidation and next-sitemap for post-build sitemap generation

Protected forms

Forms are built from the CMS and are not exposed to basic spam.

  • Payload Form Builder with custom fields and payments disabled
  • Cloudflare Turnstile validation before saving submissions
  • Email delivery with Nodemailer and SMTP configuration

Media and editorial experience

The admin is prepared to work with real images without degrading the public experience.

  • Media collection with sizes, focal point, uploads, and reuse across blocks
  • Blur data URLs for smoother visual placeholders
  • Image search plugin available for authenticated users

Migrations, Docker, and production

The project is prepared to evolve with PostgreSQL without depending on fragile manual changes.

  • Versioned Payload/PostgreSQL migrations for schema changes
  • Dockerfile, docker-compose, and nixpacks for deployment environments
  • Scripts for types, import map, build, start, GTFS import, and postbuild sitemap

Next project

If your website no longer represents what you do, it is time to rebuild it with intention.

Start a conversation