Node.js Adoption and Evolution in Ctrip Flight Ticket Team: From Front‑Back Separation to GraphQL

The article details how Ctrip's flight ticket front‑end team introduced Node.js for front‑back separation, built a Vue‑based H5 architecture with PM2, Express and standard RESTful APIs, then migrated many services to GraphQL, achieving modularity, performance under 50 ms and handling millions of daily requests.

Ctrip Technology
Ctrip Technology
Ctrip Technology
Node.js Adoption and Evolution in Ctrip Flight Ticket Team: From Front‑Back Separation to GraphQL

Author Fu Wenping, former Front‑End Development Director of Ctrip Flight Ticket R&D, shares the team’s journey of adopting Node.js since its inception and its evolution into a core technology for both front‑end and back‑end services.

Node.js, released in 2009 and now at version 10.13, quickly became popular among front‑end engineers due to its JavaScript runtime, event‑driven non‑blocking I/O, rich ecosystem, and shared code between client and server.

In Ctrip’s early web 1.0 era, the front‑end and back‑end were tightly coupled in a traditional MVC model, leading to high maintenance cost, unclear responsibilities, and low scalability. The team decoupled the layers by letting the server expose standard RESTful APIs while the client handled rendering.

The new H5 architecture uses PM2, Node.js (8.9.4), Express (4.0) on the server side, and Vue.js with Vuex, Vue‑Router, and the internal Lizard.lite framework on the client side. Build tools include webpack, ESLint/TSlint for code quality, and Mocha for unit testing. Key features of the rebuilt system are modular ES6 imports, single‑page routing, shared business models, Vuex state management, and automated builds with webpack and npm scripts.

To provide standard RESTful APIs, the Node.js layer (PM2 + Express + CtripUtil) registers endpoints automatically, integrates with Ctrip’s logging (cat/clog), and wraps backend calls for convenience.

After several iterations, the team faced challenges such as version‑specific client requirements, differing data contracts, and the need for flexible aggregation. GraphQL was introduced as a solution, offering on‑demand data fetching, strong type checking, a single endpoint, and reduced network overhead.

Example GraphQL request and response:

{
  city: getCityInfo(id: 1) {
    ID
    name: Name
    Code
  }
}
{
  "data": {
    "city": {
      "ID": 1,
      "name": "北京",
      "Code": "BJS"
    }
  }
}

Corresponding GraphQL schema definition:

module.exports = new GraphQLObjectType({
  name: 'CityInfo',
  description: '城市实体',
  fields: {
    Code: { description: '城市三字码', type: GraphQLString },
    ID:   { description: '城市ID', type: GraphQLInt },
    Name: { description: '城市名称', type: GraphQLString }
  }
});

Compared with traditional RESTful APIs, GraphQL enables selective data retrieval, strong type validation, a single URL endpoint, and the ability to combine multiple queries into one request, thus reducing network traffic.

The team adopted Express‑GraphQL as the core middleware, exposing a unified /graphql?query= endpoint. The Node.js + GraphQL stack now powers over 20 interfaces, handling roughly 2 million daily requests with response times consistently under 50 ms.

In summary, Node.js has progressed from enabling front‑back separation to becoming the backbone of Ctrip’s flight ticket front‑end services, with GraphQL further enhancing flexibility and performance.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendVuenodejsRESTful API
Ctrip Technology
Written by

Ctrip Technology

Official Ctrip Technology account, sharing and discussing growth.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.