Skip to content

Case study · E-commerce & Retail

Cocotel: Moving a Philippine Hotel Booking Platform from Laravel to Next.js

Cocotel lists 300+ hotels and resorts across the Philippines. We rebuilt its Laravel front end in Next.js and Tailwind CSS, keeping payments, hotel PMS availability, email and SEO working throughout the move.

2 December 20263 min read

Cocotel logo: Rooms, Hotels and Resorts
300+
Hotels and resorts listed across the Philippines
7
Migration risks identified and planned for
2
Critical areas: payments and hotel PMS availability
4
Integration areas kept working: payments, PMS, email, SEO

Client

Cocotel: hotel and resort booking platform in the Philippines

Technologies

  • Next.js
  • Tailwind CSS
  • MongoDB
  • REST APIs
  • Payment gateway integration
  • Hotel PMS integration

01 · The challenge

Cocotel lists more than 300 hotels and resorts across the Philippines, and guests search, book and manage their stays on its website. The existing site was a Laravel application: Blade templates, HTML, CSS and JavaScript on the front, and a MySQL database behind it. Controllers, routes, middleware, models and services held years of booking rules, so the screens and the logic were tightly knit together.

The goal was a faster, more modern front end in Next.js and Tailwind CSS without disturbing what already worked: payments, room availability from hotel PMS systems, confirmation emails and search rankings. Seven risks stood out, two of them critical, because a mistake in payments or availability would cost real bookings.

The business logic was the biggest unknown. Some rules were undocumented, several features shared the same functions, and calculations were hard to identify. The existing routes were built for server-rendered pages, not for a separate front end, so request formats, authentication and validation needed rework. Sessions, cookies and tokens also had to behave the same way for logged-in guests and bookings in progress.

02 · The solution

Before rewriting anything, we wrote a feature-by-feature business logic document covering search, pricing, availability, booking and account flows. Every rule in the Laravel code was known before it was rebuilt, so nothing depended on guesswork.

We identified the existing endpoints, documented their payloads and built an API integration layer in Next.js. The new front end talks to the backend through that layer, with a clear authentication strategy and secure cookie and token handling, so logins and booking sessions stay consistent.

The existing database was kept initially wherever possible, which avoided unnecessary restructuring during the front-end migration and the data inconsistencies that can come with it. MongoDB is part of the new stack behind the API.

Payments and availability were treated as critical. Payment workflows keep idempotency, transaction records and webhook verification, and were tested end to end, including duplicate booking prevention, failed payments and refunds. Hotel PMS communication sits behind a service layer, with a separate adapter for each provider.

For search, the existing URL structure was preserved wherever possible, with redirects where URLs had to change. Metadata, canonical URLs, structured data and sitemaps were verified against the old site before release.

Highlights

What made it work

  1. 01

    Business logic documented before any rewrite

    A feature-by-feature document of the Laravel rules came first, so hidden calculations and shared functions were found before they could break in the new build.

    Business logic documented before any rewrite
  2. 02

    An API integration layer in Next.js

    Existing endpoints were identified and their payloads documented, then wrapped in an integration layer so the new front end works with the current backend and its authentication.

    An API integration layer in Next.js
  3. 03

    Payment flows preserved and tested end to end

    Idempotency, transaction records and webhook verification were kept and tested, including duplicate booking prevention, payment status sync, failed payments and refunds.

    Payment flows preserved and tested end to end
  4. 04

    Hotel PMS behind a service layer

    Availability and booking confirmation go through a defined service layer with a separate adapter for each PMS provider, so providers with different APIs do not leak into the rest of the app.

    Hotel PMS behind a service layer
  5. 05

    SEO and URLs carried over intact

    Existing URL structures were kept where possible and redirected where not, and meta titles, descriptions, canonical URLs, structured data and sitemaps were checked before launch.

    SEO and URLs carried over intact

Before and after

How the work changed

Before

  • Blade templates, HTML, CSS and JavaScript rendered by Laravel
  • Business rules spread across controllers, models, middleware and services
  • Pages and booking logic tied together in one application
  • A MySQL database coupled to Laravel models

After

  • A Next.js and Tailwind CSS front end
  • Business logic documented feature by feature before rebuilding
  • An API integration layer between the front end and the backend
  • Payments, PMS, email, SEO and analytics integrations preserved and tested

Technologies

The stack behind the project

  • Next.js
  • Tailwind CSS
  • MongoDB
  • REST APIs
  • Payment gateway integration
  • Hotel PMS integration
  • Email services
  • SEO and analytics

Results

What changed

Outcomes are published only once confirmed with the client. They describe this project and are not a guarantee for others.

Measured outcomes for this project are being confirmed with the client and will be published here.

FAQ

About this project

Next.js with Tailwind CSS gives a faster, more flexible front end that is easier to maintain and to tune for search. The proven booking logic is documented and carried over carefully, instead of being rewritten blindly.

Payment workflows are preserved and tested before anything else: callbacks and webhooks are verified, bookings are protected against duplicates, and payment status, failed transactions and refunds are checked end to end.

We keep the existing URL structure wherever possible, add redirects where a URL has to change, and verify meta titles, descriptions, canonical URLs, structured data and sitemaps before the new site goes live.

Yes. PMS communication sits behind a defined service layer with a separate adapter for each provider, so a provider with a different API changes one adapter and not the booking flow.

Planning something similar?

Tell us about your goals. We'll share how we approached comparable projects and what a first release could look like.