{"id":13631510,"url":"https://github.com/simonw/datasette-publish-vercel","last_synced_at":"2025-04-13T18:14:34.622Z","repository":{"id":42034001,"uuid":"253632948","full_name":"simonw/datasette-publish-vercel","owner":"simonw","description":"Datasette plugin for publishing data using Vercel","archived":false,"fork":false,"pushed_at":"2022-08-24T17:43:41.000Z","size":55,"stargazers_count":44,"open_issues_count":21,"forks_count":7,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-10-18T07:53:41.888Z","etag":null,"topics":["datasette","datasette-io","datasette-plugin","vercel","zeit-now"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-06T22:47:13.000Z","updated_at":"2024-09-04T07:35:06.000Z","dependencies_parsed_at":"2022-07-13T21:34:10.512Z","dependency_job_id":null,"html_url":"https://github.com/simonw/datasette-publish-vercel","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fdatasette-publish-vercel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fdatasette-publish-vercel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fdatasette-publish-vercel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fdatasette-publish-vercel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonw","download_url":"https://codeload.github.com/simonw/datasette-publish-vercel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248758418,"owners_count":21156957,"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":["datasette","datasette-io","datasette-plugin","vercel","zeit-now"],"created_at":"2024-08-01T22:02:28.324Z","updated_at":"2025-04-13T18:14:34.599Z","avatar_url":"https://github.com/simonw.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# datasette-publish-vercel\n\n[![PyPI](https://img.shields.io/pypi/v/datasette-publish-vercel.svg)](https://pypi.org/project/datasette-publish-vercel/)\n[![Changelog](https://img.shields.io/github/v/release/simonw/datasette-publish-vercel?include_prereleases\u0026label=changelog)](https://github.com/simonw/datasette-publish-vercel/releases)\n[![Tests](https://github.com/simonw/datasette-publish-vercel/workflows/Test/badge.svg)](https://github.com/simonw/datasette-publish-vercel/actions?query=workflow%3ATest)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-publish-vercel/blob/main/LICENSE)\n\nDatasette plugin for publishing data using [Vercel](https://vercel.com/).\n\n## Installation\n\nInstall this plugin in the same environment as Datasette.\n\n    $ datasette install datasette-publish-vercel\n\n## Usage\n\nFirst, install the Vercel CLI tool by [following their instructions](https://vercel.com/download).\n\nRun `vercel login` to login to (or create) an account.\n\nNow you can use `datasette publish vercel` to publish your data:\n\n    datasette publish vercel my-database.db --project=my-database\n\nThe `--project` argument is required - it specifies the project name that should be used for your deployment. This will be used as part of the deployment's URL.\n\n### Other options\n\n* `--no-prod` deploys to the project without updating the \"production\" URL alias to point to that new deployment. Without that option all deploys go directly to production.\n* `--debug` enables the Vercel CLI debug output.\n* `--token` allows you to pass a Now authentication token, rather than needing to first run `now login` to configure the tool. Tokens can be created in the Vercel web dashboard under Account Settings -\u003e Tokens.\n* `--public` runs `vercel --public` to publish the application source code at `/_src` e.g. https://datasette-public.now.sh/_src and make recent logs visible at `/_logs` e.g. https://datasette-public.now.sh/_logs\n* `--generate-dir` - by default this tool generates a new Vercel app in a temporary directory, deploys it and then deletes the directory. Use `--generate-dir=my-app` to output the generated application files to a new directory of your choice instead. You can then deploy it by running `vercel` in that directory.\n* `--setting default_page_size 10` - use this to set Datasette settings, as described in [the documentation](https://docs.datasette.io/en/stable/settings.html). This is a replacement for the unsupported `--extra-options` option.\n\n### Full help\n\n**Warning:** Some of these options are not yet implemented by this plugin. In particular, the following do not yet work:\n\n* `--extra-options` - use `--setting` described above instead.\n* `--plugin-secret`\n* `--version-note`\n\n```\n$ datasette publish vercel --help\n\nUsage: datasette publish vercel [OPTIONS] [FILES]...\n\n  Publish to https://vercel.com/\n\nOptions:\n  -m, --metadata FILENAME         Path to JSON/YAML file containing metadata to publish\n  --extra-options TEXT            Extra options to pass to datasette serve\n  --branch TEXT                   Install datasette from a GitHub branch e.g. main\n  --template-dir DIRECTORY        Path to directory containing custom templates\n  --plugins-dir DIRECTORY         Path to directory containing custom plugins\n  --static MOUNT:DIRECTORY        Serve static files from this directory at /MOUNT/...\n  --install TEXT                  Additional packages (e.g. plugins) to install\n  --plugin-secret \u003cTEXT TEXT TEXT\u003e...\n                                  Secrets to pass to plugins, e.g. --plugin-secret\n                                  datasette-auth-github client_id xxx\n  --version-note TEXT             Additional note to show on /-/versions\n  --secret TEXT                   Secret used for signing secure values, such as signed\n                                  cookies\n  --title TEXT                    Title for metadata\n  --license TEXT                  License label for metadata\n  --license_url TEXT              License URL for metadata\n  --source TEXT                   Source label for metadata\n  --source_url TEXT               Source URL for metadata\n  --about TEXT                    About label for metadata\n  --about_url TEXT                About URL for metadata\n  --token TEXT                    Auth token to use for deploy\n  --project PROJECT               Vercel project name to use  [required]\n  --scope TEXT                    Optional Vercel scope (e.g. a team name)\n  --no-prod                       Don't deploy directly to production\n  --debug                         Enable Vercel CLI debug output\n  --public                        Publish source with Vercel CLI --public\n  --generate-dir DIRECTORY        Output generated application files and stop without\n                                  deploying\n  --generate-vercel-json          Output generated vercel.json file and stop without\n                                  deploying\n  --vercel-json FILENAME          Custom vercel.json file to use instead of generating\n                                  one\n  --setting SETTING...            Setting, see docs.datasette.io/en/stable/settings.html\n  --crossdb                       Enable cross-database SQL queries\n  --help                          Show this message and exit.\n```\n## Using a custom `vercel.json` file\n\nIf you want to add additional redirects or similar to your Vercel configuration you may want to provide a custom `vercel.json` file.\n\nTo do this, first generate a configuration file (without running a deploy) using the `--generate-vercel-json` option:\n\n    datasette publish vercel my-database.db \\\n      --project=my-database \\\n      --generate-vercel-json \u003e vercel.json\n\nYou can now edit the `vercel.json` file that this creates to add your custom options.\n\nThen run the deploy using:\n\n    datasette publish vercel my-database.db \\\n      --project=my-database \\\n      --vercel-json=vercel.json\n\n## Setting a `DATASETTE_SECRET`\n\nDatasette uses [a secret string](https://docs.datasette.io/en/stable/settings.html#configuring-the-secret) for purposes such as signing authentication cookies. This secret is reset when the server restarts, which will sign out any users who are authenticated using a signed cookie.\n\nYou can avoid this by generating a `DATASETTE_SECRET` secret string and setting that as a [Vercel environment variable](https://vercel.com/docs/concepts/projects/environment-variables). If you do this the secret will stay consistent and your users will not be signed out.\n\n## Using this with GitHub Actions\n\nThis plugin can be used together with [GitHub Actions](https://github.com/features/actions) to deploy Datasette instances automatically on new pushes to a repo, or on a schedule.\n\nThe GitHub Actions runners already have the Vercel deployment tool installed. You'll need to create an API token for your account at [vercel.com/account/tokens](https://vercel.com/account/tokens), and store that as a secret in your GitHub repository called `VERCEL_TOKEN`.\n\nMake sure your workflow has installed `datasette` and `datasette-publish-vercel` using `pip`, then add the following step to your GitHub Actions workflow:\n```\n    - name: Deploy Datasette using Vercel\n      env:\n        VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}\n      run: |-\n        datasette publish vercel mydb.db \\\n          --token $VERCEL_TOKEN \\\n          --project my-vercel-project\n```\nYou can see a full example of a workflow that uses Vercel in this way [in the simonw/til repository](https://github.com/simonw/til/blob/12b3f0d3679320cbeafa5df164bbc08ba703625d/.github/workflows/build.yml).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fdatasette-publish-vercel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonw%2Fdatasette-publish-vercel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fdatasette-publish-vercel/lists"}