{"id":15504322,"url":"https://github.com/kentcdodds/airtable-netlify-short-urls","last_synced_at":"2025-07-18T03:07:37.798Z","repository":{"id":38984019,"uuid":"160411619","full_name":"kentcdodds/airtable-netlify-short-urls","owner":"kentcdodds","description":"There's a simpler version using Netlify redirects instead of Airtable here","archived":false,"fork":false,"pushed_at":"2021-01-25T23:11:42.000Z","size":219,"stargazers_count":59,"open_issues_count":0,"forks_count":21,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-19T18:27:53.479Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/kentcdodds/netlify-shortener","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kentcdodds.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-04T19:58:41.000Z","updated_at":"2024-07-08T14:23:02.000Z","dependencies_parsed_at":"2022-09-19T17:20:47.846Z","dependency_job_id":null,"html_url":"https://github.com/kentcdodds/airtable-netlify-short-urls","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentcdodds%2Fairtable-netlify-short-urls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentcdodds%2Fairtable-netlify-short-urls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentcdodds%2Fairtable-netlify-short-urls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentcdodds%2Fairtable-netlify-short-urls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kentcdodds","download_url":"https://codeload.github.com/kentcdodds/airtable-netlify-short-urls/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250343948,"owners_count":21415040,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T09:17:12.465Z","updated_at":"2025-04-23T00:11:11.245Z","avatar_url":"https://github.com/kentcdodds.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# airtable-netlify-short-urls\n\n:warning: **There's a simpler version using [Netlify redirects](https://www.netlify.com/docs/redirects/) instead of Airtable [here](https://github.com/kentcdodds/netlify-shortener)** \n\nThis is a simple short-url service that works with\n[netlify functions](https://www.netlify.com/docs/functions/) and uses\n[airtable](https://airtable.com).\n\nIt's recommended to use this with\n[CloudFlare caching](https://support.cloudflare.com/hc/en-us/articles/200168326-Are-301-and-302-redirects-cached-by-Cloudflare-)\nbecause airtable has a limit of 5 requests per second. Also, CloudFlare can give\nyou nice analytics for free.\n\n## Usage\n\nFirst, setup an airtable account with a base and table. The table should have\na column for the short code and one for the long link.\n\nNext deploy this github repo to netlify:\n\n[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/kentcdodds/airtable-netlify-short-urls)\n\nThen set the following environment variables in netlify:\n\n```\nDEFAULT_REDIRECT_URL -\u003e https://example.com\nAIRTABLE_KEY -\u003e *****************\nAIRTABLE_BASE -\u003e *****************\nAIRTABLE_TABLE -\u003e URLs\nAIRTABLE_SHORT_CODE_FIELD -\u003e Short Code\nAIRTABLE_LONG_LINK_FIELD -\u003e Long Link\nENABLE_CACHE -\u003e false\n```\n\n\u003e Note: `AIRTABLE_TABLE`, `AIRTABLE_SHORT_CODE_FIELD`,\n\u003e `AIRTABLE_LONG_LINK_FIELD`, and `ENABLE_CACHE` are showing the default values\n\u003e above. If that's what you call your table and fields then you don't need to\n\u003e set those variables.\n\n\u003e Note also that you can use a `.env` file instead, just don't commit this to\n\u003e source control :) (this is useful for local development as `.env` is in the\n\u003e `.gitignore`).\n\nRedirects should be setup automatically for you in the `netlify.toml`, so you\nshouldn't have to do anything there.\n\nNow go ahead and test that your redirects are working as expected. Just go to\nthe short URL version of your netlify app and it should redirect you like so:\nhttp://jsair.netlify.com/first -\u003e https://javascriptair.com/episodes/2015-12-09/\n\nIf that works you're on the right track!\n\nNext, [set up Netlify with a custom domain](https://www.netlify.com/docs/custom-domains/)\nthen verify that the redirect works with the custom domain.\n\nNow, go get CloudFlare setup with your custom domain to prevent your function\nfrom being called more than airtable's rate limiting can handle.\n\nIf you're not using CloudFlare, then set `ENABLE_CACHE` to `true` so you can get\nsome caching from Netlify. That always seemed to not work very well for me\nthough (which is one reason I use CloudFlare instead) so good luck.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkentcdodds%2Fairtable-netlify-short-urls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkentcdodds%2Fairtable-netlify-short-urls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkentcdodds%2Fairtable-netlify-short-urls/lists"}