Introduce to GraphQL


Problem: Traditional RESTful web services are not so efficient in some use case:

  1. Sometimes we want to fetch part of an entity’s data. But web service only returns a complete set of data.
  2. Sometimes we want to fetch many related entities. But web service only accesses a single entity. So we have to make many round trips.
  3. If web service (endpoint, resources’ schema) changes, client code has to change as well.

And vice-versa, if the client requires a different set of data, we should change web service to support that, or at least to improve the outcome.

GraphQL solution:

  1. Allows clients to define the structure of the data required, and exactly the same structure of the data is returned from the server. Therefore it prevents the excessively large amounts of data from being returned.
  2. GraphQL is not dealing with dedicated resources. Instead, everything is regarded as a graph and connected.

You can combine different entities in one query and you are able to specify which attributes should be included in the response on every level.

  1. Single endpoint.

Client controls the query part – the query matches exactly the response. You do not need to read the documentation or run the request to know the response structure. Webservice and client can be developed parallel and independently at some extends.

About GraphQL: (more details)

  1. GraphQL is an open-source data query and manipulation language, and a runtime for fulfilling queries with existing data.
  2. Developed by Facebook.
  3. On 9th February 2018, the Schema Definition Language (SDL) was made part of the specification


1. Server

We need to install a GraphQL server to serve data “graphQL way”. It’s available for multiple languages, including Haskell, JavaScript, Python,[10] Ruby, Java, C#, Scala, Go, Elixir,[11] Erlang, PHP, R, and Clojure
  1. PHP: or
  2. Nodejs: or (for working with express.js)
  1. In order to describe the data that available to be queried, in the server above, we need to define our schema (types system).
  2. GraphQL has its own language to write Schemas: The Schema Definition Language (SDL). It’s language-agnostic, so you can use the same set of definition in GraphQL server written by PHP, Nodejs, Python…
  3. If you want to quickly build & test a schema with Nodejs, go to this in-browser GraphQL server playground
  4. Schema SDL example:
# hero is an object type
 type hero {
 ID: ID! # ! mean server will always return a non-null value for ID and name when fetching hero
 name: String! # ID and name are fields of scalar type
 appearsIn: [movie]! # these fields return a non-null list of movie objects
 # movie is an object type
 type movie {
 ID: ID! # ID is a special scalar type
 name: String!
 character(OrderOfAppearance: Int): [hero] # id argument for nested fields
 # one query object type is required for a schema, that describe what data can be fetched from client
 type queryRootType {
 # Get one hero item
 hero(id: ID!): hero # accept id argument
 # Get all hero items
 allHeros: [hero!]!
 #get movie
 movie(id: ID!): [movie]
 # one mutation object type, optional for a schema, that describes what data can be sent from the client
 type mutationRootType {
 addHero(id: ID!, name: String!, appearsIn: movie): hero! # this's the required field
 removeHero(id: ID!): hero!
 # only one schema definition for each schema
 schema {
 query: queryRootType
 mutation: mutationRootType
In the server above, write “resolver” to map schema types to actually code that gets data.

Please see PHP tutorial here

  1. GraphQL is typically served over HTTP via a single endpoint which expresses the full set of capabilities of the service
  2. Return JSON (with gzip)

2. Clients:

There are many clients writing in many languages.

Below is some examples using curl, in order to show the most basic form of GraphQL query:

  1. Search a single hero by id:
     curl <your-endpoint> -d '{"query": "query { hero(id: 1) }" }'
  2. Fetch all hero names:
     curl <your-endpoint> -d '{"query": "query { allHeros{name} }" }'
  3. There are special types “__schema” and “__type” that enable introspection of the schema:
     curl <your-endpoint> -d '{"query": "query { __schema{types{kind, name, possibleTypes{name}}}}" }'
     curl <your-endpoint> -d '{"query": "query { __type(name:\"hero\"){name, fields{name} } }" }
  4. Allows send variables in “variables” field of our payload:
     curl <your-endpoint> -d '{"query": "query($id:ID) { hero(id: $id) }", "variables": {"id":1} }'

Check out our demo here

Comment down below if you have any question or contact us via email for free consultation. Don’t forget to share & subscribe to our blog!

Chuong Nguyen           




Opportunities in PropTech – Is this a robust area?

PropTech (Property Technology) refers to a small part of digital transformation in Real Estate industry, using technology innovations to tackle challenges in the Property sector (Dearsley, 2017). PropTech comprises of companies/startups offering IT solutions or innovative business model to make Real Estate transactions more fruitful and efficient (Lecamus, 2017).

For the new business model, PropTech organizations target the traditional inefficiency and obsolete procedures of the Real Estate area. For innovative products, PropTech organizations develop innovative hardware, software, as well as other core technologies in building fittings, fixtures, materials, and systems. (Maarbani, 2017)

PropTech products fall into 4 main categories:

  • Urban Planning: Companies in this vertical focus on various aspects of urban, rural and community planning, including improving processes related to the land release, planning approvals, protection, and use of the environment, and the enhanced design of the urban environment.


  • Satellite technology
  • Mapping platforms
  • Beacon technology
  • Design & Construction: Including tools and processes used for the design, development, and construction of residential, commercial and industrial Real Estate projects.


  • Project and cost management tools
  • Enhanced architecture and design software
  • Smart building platforms and artificial intelligence
  • Search, Sales & Acquisition: Including tools, processes and business models for searching, marketing and acquiring new and existing residential, commercial and industrial Real Estate.


  • CRM and lead management solutions
  • Online brokerage, sales, and auctions
  • Buyer search and discovery tools including listing portals
  • Leasing & Management: Including tools, processes and business models used for the leasing and management of residential, commercial or industrial Real Estate, from single properties through to solutions designed for complex property portfolios.


  • Lease and revenue management software
  • Transaction management software

Above all, Data & Analytics companies identify, collate and analyze relevant big data to enhance operational efficiency, inform decision making and improve the experience of participants (Maarbani, 2017).

According to a survey of KPMG in 2017, the most influential PropTech innovations over the next 5 years are Big Data Analytics, IoT and AI. However, those technologies are immature and will have more substantial impacts over longer 5, 10 or 15-year period. Though now this is an early stage, companies should consider a gradual transformation plan to avoid being left behind with obsolete systems. This is a great opportunity for PropTech startups and innovative ideas to be invested and implemented before the saturation.

(KPMG, 2017)

Over the last 5 years, TwentyCi Asia has successfully developed PropTech products for a number of clients with high-standard delivery quality and high customer satisfaction.

CoVESTA is a fractional property investment platform that provides the opportunity to invest in any available property, anywhere in Australia. Their mission is to help ordinary Australians to get into property investment and build their future wealth.

TwentyEA comprises of experts in the UK home mover market with a team made up of property industry veterans, data scientists and start up technologists. They are well known for quarterly Property & Home mover Report which produces a comprehensive review of the UK property market.

View My Chain sheds new light on the complex home-buying process, allowing users to track every step from Sold Subject to Contract (SSTC) to exchange. Clear, honest, up-to-the-minute information on what’s happening in the chain empowers proactive agents to complete faster than ever before.

Romans is in top 5 largest property groups in the UK. With a full range of property services, Romans helps everyone interested in buying or selling, renting or letting, town planning or mortgage advice.

Comment down below if you have any question or contact us via email for free consultation. Don’t forget to share & subscribe to our blog! See you in the next post!

                                                                                                                                                                                                                                                                                                                                         Olivia Dang                           


Dearsley, J., 2017. WHAT IS PROPTECH?. [Online]
Available at:
[Accessed 24 10 2018].

KPMG, 2017. Proptech – Bridging the gap, UK: KPMG LLP.

Lecamus, V., 2017. PropTech: What is it and how to address the new wave of real estate startups?. [Online]
Available at:
[Accessed 24 10 2018].

Maarbani, S., 2017. Real Estate Technology – Threat or Opportunity?, s.l.: KPMG.