Don't forget to set env variable for postgres database

DATABASE_URL=postgres://[email protected]/airtable npm start

or in docker-compose.yml

let airql = require('airtable-postgres-graphql');
let app = express();

const baseId = 'some base id';
const apiKey = 'some api key';

let {router, airtable} = airql.airtableRestRouter({apiKey: apiKey, base: baseId, tables: ['Property', 'Feature']});

app.use(`/v0/${baseId}`, router); // for drop-in replacement usage with Airtable.js, just change host

airtable.onChange((event, entity) => {
        case 'insert':
        case 'update':
        case 'delete':

airtable.onChange((type, event, old, new) => {
    if (event=='update' && old['Approve status']!=new['Approve status'])
        checkApproval(JSON.parse(new['Approve status']), json);

airtable.onSelect((user, table, entity) => {
    // user select info about himself
    if (user.airtableId ===
        return entity;
    switch(table) {
        // don't return personal information, prefer Whitelist approach because field names in Airtable can be easily changed
        case 'Landlord':
            return _.pick(entity, ['Name', 'Type']);
        case 'Agent':
            return _.pick(entity, ['Name', 'MobilePhone']);

airtable.onAssignUser((req, res) => req.local.user);



Airtable Rest Graphql Postgres

Drop-in replacement for Airtable API with two-way sync backed by PostgreSQL. Graphql included.

Airtable Rest Graphql Postgres Info

⭐ Stars 15
🔗 Homepage
🔗 Source Code
🕒 Last Update a year ago
🕒 Created 3 years ago
🐞 Open Issues 0
➗ Star-Issue Ratio Infinity
😎 Author FreshcodeIT