The SQL API provides a node.js based API for running SQL queries against CartoDB.

Like the other components of CartoDB is Open Source and you can find the source code at CartoDB/CartoDB-SQL-API

You can find usage documentation at https://docs.carto.com/cartodb-platform/sql-api.html.

Although you can chechout any branch of the repository most of them are usually work in progress that is not guaranteed to work. In order to run a production ready SQL API service you need to use master branch.