Home

Awesome

Airtable Proxy Cloudflare Worker

A Cloudflare Worker that allows you to make secure requests to the Airtable API from your frontend.

Travis Build Status Coverage Status Code Style: Prettier GitHub stars License

Features

Usage

Prerequisites

Building Locally

The easiest way to see this project in action is to build your Worker locally and copy/paste it into Cloudflare's UI:

Your Airtable's tables will be available via the table name. For example, if my Airtable base has a table name posts, it would be available at https://tutorial.cloudflareworkers.com/posts.

In order to deploy the worker to your own personal worker, upload it via the web UI and click "Deploy".

Routing

By default, the routes for each of your tables are available at YOUR_CLOUDFLARE_DOMAIN/RESOURCE_NAME. For example, if my custom domain is http://api.example.com and the table I want to access is called users, I would access the API at http://api.example.com/users.

You can change this routing using a PROXY_PREFIX as described in the Configuration section below.

Automated Deployment

You can also use Travis to automatically deploy updates to your Worker. Just add the following environment variables to your Travis settings:

The deploy block in the .travis.yml file will automatically update your worker in Cloudflare when the master branch is built using the script at scripts/deploy.

Configuration

In addition to the required AIRTABLE_API_KEY and AIRTABLE_API_BASE_ID variables, you can also set the following configuration options as ENV vars:

Contributing

Contributions are welcome and encouraged! When contributing to this repository, please first discuss the change you wish to make via the issues on Github.

Testing

Before you make a pull request, please add or update any relevant tests. You can run the test suite (uses Jest): npm run test:local

Also run Prettier to ensure that code styling is consistent: npm run prettier.

Pull Request Process

  1. Make sure tests are running and linting passes before you submit a PR.
  2. Update any relevant parts of the documentation in the readme.md file.
  3. Update the changelog.md file with any new updates, breaking changes, or important notes.
  4. Run the build process to make sure it passes too: npm run build.
  5. Include a link to any relevant issues in the PR on Github. If there are problems with your PR, we will discuss them in Github before merging.

Releases

This library uses semantic versioning to inform users of breaking and non-breaking changes. When a new release is ready, the following steps will be taken:

This will create a new Tag in Github.

License

The MIT License (MIT)

Copyright (c) 2018 Portable CTO, LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.