{"id":24385599,"url":"https://github.com/icp-hub-it/ic-sanity","last_synced_at":"2025-09-29T15:30:33.273Z","repository":{"id":273075512,"uuid":"918627108","full_name":"ICP-HUB-Italy-Ticino/ic-sanity","owner":"ICP-HUB-Italy-Ticino","description":"Deploy Astro + Sanity websites on the Internet Computer","archived":false,"fork":false,"pushed_at":"2025-01-18T13:25:44.000Z","size":345,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-18T14:42:32.823Z","etag":null,"topics":["astro","internet-computer","juno","sanity"],"latest_commit_sha":null,"homepage":"","language":"Astro","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/ICP-HUB-Italy-Ticino.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-18T12:42:47.000Z","updated_at":"2025-01-18T13:27:27.000Z","dependencies_parsed_at":"2025-01-18T14:44:11.593Z","dependency_job_id":"01d4eb34-b680-4b20-a95b-2b491f683a12","html_url":"https://github.com/ICP-HUB-Italy-Ticino/ic-sanity","commit_stats":null,"previous_names":["icp-hub-italy-ticino/ic-sanity"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ICP-HUB-Italy-Ticino%2Fic-sanity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ICP-HUB-Italy-Ticino%2Fic-sanity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ICP-HUB-Italy-Ticino%2Fic-sanity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ICP-HUB-Italy-Ticino%2Fic-sanity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ICP-HUB-Italy-Ticino","download_url":"https://codeload.github.com/ICP-HUB-Italy-Ticino/ic-sanity/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234631204,"owners_count":18863286,"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":["astro","internet-computer","juno","sanity"],"created_at":"2025-01-19T11:19:35.140Z","updated_at":"2025-09-29T15:30:33.267Z","avatar_url":"https://github.com/ICP-HUB-Italy-Ticino.png","language":"Astro","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ic-sanity\n\nThis template enables you to deploy an Astro + Sanity website on the Internet Computer. The deployment is done through [Juno](https://juno.build/).\n\n\u003e 🌟 **New to Juno?** Check it out at [juno.build](https://juno.build/)\n\n\u003e 🚀 **New to Astro?** Check it out at [astro.build](https://astro.build/)\n\n\u003e 🎯 **New to Sanity?** Check it out at [sanity.io](https://sanity.io/)\n\n## Usage\n\n### Requirements\n\nMake sure you have the following installed:\n\n- [Node.js](https://nodejs.org/en/download/)\n- [pnpm](https://pnpm.io/)\n- [Juno CLI](https://juno.build/docs/miscellaneous/cli)\n\n### Local development\n\n1. Clone this repository (or use it as a template for your own project) and install dependencies:\n\n   ```bash\n   git clone https://github.com/ICP-HUB-Italy-Ticino/ic-sanity.git\n   cd ic-sanity\n   pnpm install\n   ```\n\n2. Create a satellite on Juno ([guide](https://juno.build/docs/create-a-satellite)). Copy the satellite ID once done.\n3. Login to the Juno console and link the new satellite once asked:\n\n   ```bash\n   juno login\n   ```\n\n4. Update the `\u003cyour-satellite-id\u003e` in the [`juno.config.ts`](./juno.config.ts) file with the new satellite ID.\n5. Create a new project with a dataset on Sanity ([guide](https://www.sanity.io/docs/getting-started-with-sanity)). Copy the project ID and the dataset name once done.\n6. Set the environment variables in the `.env` file, following the [.env.example](./.env.example) template.\n7. Deploy your project on Juno:\n   ```bash\n   pnpm run deploy\n   ```\n\nYou can now access your website at `https://\u003cyour-satellite-id\u003e.icp0.io` and the [Sanity Studio](https://www.sanity.io/studio) at `https://\u003cyour-satellite-id\u003e.icp0.io/studio`.\n\nEvery time you make a change, you have to deploy your project again with the Juno CLI:\n\n```bash\npnpm run deploy\n```\n\nHave a look at the [Set up the GitHub Action](#set-up-the-github-action) and/or [Set up Sanity deployments](#set-up-sanity-deployments) to configure automatic deployments.\n\nYou can run the local preview with:\n\n```bash\npnpm dev\n```\n\n### Set up the GitHub Action\n\nIn order to deploy your website to production every time you push to the `main` branch, you need to set up a GitHub Action. There's already a GitHub Action set up for this repository, check it out at [deploy.yaml](./.github/workflows/deploy.yaml).\n\nYou need to configure the same environment variables of your `.env` file as GitHub Action variables ([guide](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables)):\n\n- `JUNO_TOKEN` ([guide](https://juno.build/docs/guides/github-actions))\n- `SANITY_STUDIO_PROJECT_ID`\n- `SANITY_STUDIO_DATASET`\n\n\u003e We recommend you to set up GitHub variables instead of secrets for the `SANITY_STUDIO_*` variables, so that you can always lookup the values of these variables at any time. If you choose to set up secrets instead, make sure you update the [deploy.yaml](./.github/workflows/deploy.yaml) action to read the values from the secrets.\n\nThe [deploy.yaml](./.github/workflows/deploy.yaml) action is configured to run:\n\n- when commits are pushed to the `main` branch\n- when dispatched [manually](https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/manually-running-a-workflow)\n- when triggered from a webhook, see [Set up Sanity deployments](#set-up-sanity-deployments) and the [GitHub docs](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#repository_dispatch)\n\n### Set up Sanity deployments\n\nIn order to update the content of the website every time you save a document on Sanity, you need to set up Sanity to trigger a deployment on GitHub.\n\nBefore configuring the Sanity webhook, you need to obtain a GitHub token. See [Authenticating with a personal access token](https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api?apiVersion=2022-11-28#authenticating-with-a-personal-access-token) and make sure you give **Read** and **Write** permissions for [Contents](https://docs.github.com/en/rest/authentication/permissions-required-for-fine-grained-personal-access-tokens?apiVersion=2022-11-28#repository-permissions-for-contents).\n\n1. Go to the API settings of your Sanity project and click on _+ Create webhook_\n2. Configure the webhook with the following settings:\n\n   - **Name**: a custom name like \"Deploy Website on Juno\" or so\n   - **URL**: `https://api.github.com/repos/\u003cyour-github-username\u003e/\u003cyour-repo\u003e/dispatches`\n   - **Dataset**: choose on which datasets you want to trigger the deployment\n   - **Trigger on**: Select all the available options: _Create_, _Update_, _Delete_\n   - **Projection**:\n\n     ```json\n     {\n       \"event_type\": \"website-deploy: sanity update\"\n     }\n     ```\n\n     The content of the `event_type` field is arbitrary and can be whatever you want. It will appear as the workflow run name in the GitHub Actions section of the repository.\n\n   - **HTTP method**: POST\n   - **HTTP headers**:\n     | Name | Value |\n     | --- | --- |\n     | `Content-Type` | `application/vnd.github+json` |\n     | `Authorization` | `Bearer \u003cyour-github-token\u003e` |\n     | `X-GitHub-Api-Version` | `2022-11-28` (change this if needed) |\n\n   Leave all the other fields empty/with default values.\n\n   The configuration should look like this:\n   ![](./docs/sanity-webhook-config.png)\n\n3. Save the webhook\n\nAfter saving the webhook, you should see the workflow run in the GitHub Actions section of the repository every time you publish some content on Sanity.\n\n### Set up Analytics\n\nWe integrate [Juno Analytics](https://juno.build/docs/build/analytics) to track the traffic of the website.\n\n1. Create an Orbiter on Juno ([guide](https://juno.build/docs/build/analytics/setup#getting-started)). Copy the Orbiter ID once done.\n2. Uncomment the `orbiter` configuration in the [`juno.config.ts`](./juno.config.ts) file and update the `\u003cyour-orbiter-id\u003e` with the new orbiter ID.\n3. (optional) Update the configuration of the analytics you want to track in the [`src/analytics.ts`](./src/analytics.ts) file (see Juno Analytics's [Optional Features](https://juno.build/docs/build/analytics/setup#optional-features)).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficp-hub-it%2Fic-sanity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficp-hub-it%2Fic-sanity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficp-hub-it%2Fic-sanity/lists"}