{"id":18648773,"url":"https://github.com/mitchmac/tina-starter-test2","last_synced_at":"2025-11-05T08:30:29.118Z","repository":{"id":145859315,"uuid":"386035726","full_name":"mitchmac/tina-starter-test2","owner":"mitchmac","description":null,"archived":false,"fork":false,"pushed_at":"2021-07-14T18:18:49.000Z","size":10169,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-12-27T12:29:47.947Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/mitchmac.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-14T18:15:55.000Z","updated_at":"2023-03-07T15:37:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"805e4448-5f79-4684-a3a4-1de751948f4a","html_url":"https://github.com/mitchmac/tina-starter-test2","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/mitchmac%2Ftina-starter-test2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchmac%2Ftina-starter-test2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchmac%2Ftina-starter-test2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchmac%2Ftina-starter-test2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mitchmac","download_url":"https://codeload.github.com/mitchmac/tina-starter-test2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239451000,"owners_count":19640847,"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-11-07T06:33:47.741Z","updated_at":"2025-11-05T08:30:29.086Z","avatar_url":"https://github.com/mitchmac.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tina Cloud Starter 🦙\n\nBasic TinaCMS starter based on [Next.js](https://nextjs.org) and [TinaCMS](https://tina.io) that connects to Tina Cloud Content API.\n\n![Starter Homepage Preview](public/uploads/tina-cloud-starter-preview.png)\n\n## Video Tour\n\nWatch our video guide to get started in less than 10 minutes.\n\n[![Getting Started with Tina Cloud](http://img.youtube.com/vi/Y-fG7qzoHKw/0.jpg)](http://www.youtube.com/watch?v=Y-fG7qzoHKw \"Getting Started with Tina Cloud\")\n\n## Lighthouse Scores\n\n![Performance: 100%](assets/img/scores/lighthouse_performance.svg) ![Accessibility: 100%](assets/img/scores/lighthouse_accessibility.svg) ![Best Practices: 100%](assets/img/scores/lighthouse_best-practices.svg) ![SEO: 100%](assets/img/scores/lighthouse_seo.svg)\n\nTina doesn't impact your website performance. This starter comes with default perfect [Lighthouse scores](https://lighthouse-dot-webdotdevsite.appspot.com//lh/html?url=https%3A%2F%2Ftina-cloud-starter-orcin.vercel.app%2F) 🚀\n\n\n\n## Table of contents\n\n- ❓ [What is this?](#what-is-this)\n- 🍴 [Fork and Clone](#fork-this-repository)   \n- ⬇️ [Install](#install)\n- 🌎 [Run the project locally](#run-the-project-locally)\n- 📝 [Edit content locally](#edit-content-locally)\n- 🦙 [Connect to Tina Cloud](#connect-to-tina-cloud)\n  - ☁️ [Register your local application with Tina Cloud](#register-your-local-application-with-tina-cloud)\n  - 🔌 [Connect your local project with Tina Cloud](#connect-your-local-project-with-tina-cloud)\n  - 📝 [Edit content](#edit-content)\n- ⬆️ [Deploy](#deploy)\n  - ▲ [Vercel](#vercel)\n  - [Netlify](#netlify)\n- 🗂 [Starter structure](#starter-structure)\n- 📐 [Content Modeling](#content-modeling)\n- 💡 [Local development workflow tips](#local-development-workflow-tips)\n- 🆘 [Getting Help](#getting-help)\n\n## What is this?\n\nThis is a [TinaCMS](https://tina.io)-enabled Next.js app, so you can edit your content on a live page. In this project the Tina file-based CMS is used via GraphQL: it's powered by a schema that _you_ define. It not only serves content from Markdown files in your repository, but it also generates TinaCMS forms for you automatically ✨.\n\n### Scope\n\n- Run this project locally using local content within this repository.\n- Connect to Tina Cloud to benefit from its GraphQL Content API.\n- Deploy the site to visually edit your site.\n- Invite collaborators.\n\n## Requirements\n\n- Git\n- [Node.js Active LTS](https://nodejs.org/en/about/releases/)\n- Yarn\n\n## Fork this repository\n\n ⚠️⚠️ Start by **forking** the repository and then pull it down to your computer. ⚠️⚠️\n\n## Install\n\n\u003e ℹ️ This project uses `yarn` as a package manager, if `yarn` isn't installed on your machine, open a terminal and run `npm install -g yarn`\n\nInstall the project's dependencies:\n\n```\nyarn install\n```\n\n\u003e ⚠️ If you'd like to use `npm` beware that there is no `package-lock.json` so we can't guarantee the dependencies are the same for you.\n\n## Run the project locally\n\nTo run the local development server:\n\n```\nyarn dev\n```\n\nThis command starts the GraphQL server and the Next.js application in development mode. It also regenerates your schema types for TypeScript and GraphQL so changes to your `.tina` config are reflected immediately.\n\nOne of the most interesting aspects of the Tina Cloud Content API is that it doesn't actually require anything from the Cloud to work locally. Since Tina is by default a Git-backed CMS, everything can be run from your local filesystem via the CLI. :sunglasses:\n\nThis is ideal for development workflows and the API is identical to the one used in the cloud, so once you're ready to deploy your application you won't face any challenges there.\n\nOpen [`http://localhost:3000`](http://localhost:3000) in your browser to see your file-based content being loaded from the GraphQL API.\n\n## Edit content locally\n\nWe need to define some local environment variables in order to edit content with Tina.\n\nCopy `.env.local.sample` to `.env.local`:\n```sh\ncp .env.local.sample .env.local\n\n```\n\n`NEXT_PUBLIC_USE_LOCAL_CLIENT` should be set to `1`, other values can be ignored for now.\n\nRestart your server and visit [`http://localhost:3000/`](http://localhost:3000/`), and click \"enter edit mode\" in the top right hand corner, the same page is displayed but you can notice a pencil icon at the bottom left corner.\n\nClick to open Tina's sidebar which displays a form with fields you can edit and see update live on the page.\nSince we're working locally, saving results in changes to your local filesystem.\n\nFrom here, you're ready to start building your own project, to read a little bit about how this project is structured, and how to modify it to make it your own,\nread the [folder structure](#starter-structure) section below.\n\nWhen you're ready to deploy your site, read on about how you can connect to Tina Cloud and make authenticated changes via our Cloud API.\n\n\u003e **NOTE:** In this project there are two way to enter edit mode. You can click the \"enter edit mode button\" or visit [`/admin`](http://localhost/admin). You can also disable the edit button by setting `NEXT_PUBLIC_SHOW_EDIT_BTN=0` in `.env.local`\n\n## Connect to Tina Cloud\n\nWhile the fully-local development workflow is the recommended way for developers to work,\nyou'll obviously want other editors and collaborators to be able to make changes on a hosted website with authentication.\n\n\u003e ℹ️ Changes in edit mode show up on your home page after your site finishes a rebuild.\n\n## Register your local application with Tina Cloud\n\n1. Visit [auth.tina.io](https://auth.tina.io/register), create an organization, and sign in. Make a note of your organization name.\n2. Create a Tina Cloud app which connects to the GitHub repository you've just forked. Once your app is created, click on the app to get to the app settings and copy the client ID.\n\n## Connect your local project with Tina Cloud\n\nIn the `env.local` file set:\n\n- `NEXT_PUBLIC_USE_LOCAL_CLIENT` to `0`.\n- `NEXT_PUBLIC_ORGANIZATION_NAME` to your Tina Cloud organization name\n- `NEXT_PUBLIC_TINA_CLIENT_ID` to the Client ID displayed in your Tina Cloud App.\n- `NEXT_PUBLIC_SHOW_EDIT_BTN` to `0` or `1`, `0` means there is no \"enter edit mode\" and you will have to visit [`/admin`](http://localhost/admin)  to enter edit mode.\n\nRestart your server and run `yarn dev` again.\n\nOpen [`http://localhost:3000/`](http://localhost:3000/`) and click \"enter edit mode\"\n\n![](public/uploads/tina-cloud-authorization.png)\n\nThis time a modal asks you to authenticate through Tina Cloud. Upon success, your edits will be sent to the cloud server (and subsequently to GitHub).\n\n#### Edit content\n\nMake some edits through the sidebar and click save.\nChanges are saved in your GitHub repository.\n\nNow that Tina Cloud editing is working correctly, we can deploy the site so that other team members can make edits too.\n\n\u003e ℹ️ Gotcha: since your changes are being synced directly to Github, you'll notice that when your in non-\"edit\" mode your page still receive the unedited data from your local filesystem. This is mostly fine since editing with Tina Cloud is designed for hosted environments. But beware that changes to your schema may result in a mismatch between the Tina Cloud API and your local client.\n\n## Deploy\n\n### Vercel\n\n[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/)\n\nConnect to your GitHub repository and set the same environment variables as the ones in your `env.local` file:\n\n```\nNEXT_PUBLIC_ORGANIZATION_NAME= \u003cYOUR_ORGANIZATION\u003e\nNEXT_PUBLIC_TINA_CLIENT_ID= \u003cYOUR_CLIENT_ID\u003e\n```\n\n![](public/uploads/vercel-congratulations.png)\n\n🎉 Congratulations, your site is now live!\n\nYou can test that everything is configured correctly by navigating to `[your deployment URL]/`, click \"edit this site\",\nlog in to Tina Cloud, and making some edits. Your changes should be saved to your GitHub repository.\n\n### Netlify\n\n[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/)\n\nConnect to your GitHub repository, then:\n\n- set the **build command** to `yarn build`,\n- set the **publish directory**. To `.next/` .\n\n![](public/uploads/netlify-build-settings.png)\n\nClick on **advanced** to add the same environment variables as the ones in your `env.local` file:\n\n```\nNEXT_PUBLIC_ORGANIZATION_NAME= \u003cYOUR_ORGANIZATION\u003e\nNEXT_PUBLIC_TINA_CLIENT_ID= \u003cYOUR_CLIENT_ID\u003e\n```\n\n![](public/uploads/netlify-advanced-build-settings.png)\n\nCopy-paste your Organization ID and Client ID.\n\nOnce you're done, click \"Deploy site\".\n\nInstall the [\"Next on Netlify\" plugin](https://www.netlify.com/blog/2020/12/07/announcing-one-click-install-next.js-build-plugin-on-netlify/)\nin order to take advantage of server-side rendering and Next.js preview features.\n\nTrigger a new deploy for changes to take effect.\n\nYou can test that everything is configured correctly by navigating to `[your deployment URL]/`, click \"edit this site\",\nlog in to Tina Cloud, and making some edits. Your changes should be saved to your GitHub repository.\n\n---\n\n## Starter structure\n\nTina Cloud Starter is a [Next.js](https://nextjs.org) application. The file-based routing happens through the `pages` directory. To edit this site click the \"edit this site\" button. This will causes you to go into edit mode where Tina is loaded. Tina is only loaded in edit mode so it will not effect the production bundle size.\n\n### `pages/index.tsx`\n\nThis page can be seen at `http://localhost:3000/`, it loads the content from a markdown file which can be found in this repository at `/content/marketing-pages/index.md`. You can edit this page at by clicking the \"enter edit mode\" button in the top right hand corner\n\n\nWe wrap the site in a small `EditProvider` component, that stores whether or not we are in edit mode in React state and localstorage. When we are in edit mode it triggers authentication when needed, and then one is in edit mode. \n\nWhat makes this possible is `getStaticProps`: you can notice that every editable page exports a `query` prop and a data prop from `getStaticProps`. When we are not in `editMode` we use the data prop to render the site. When we are in edit mode we use the query to fetch the latest data from Tina Cloud and create the sidebar form.\n\n### `pages/posts/[filename].tsx`\n\nThe posts are stored in the `content/posts` directory of this repository, and their routes are built with `getStaticPaths` dynamically at build time. To go in edit mode, click the \"edit this site\" button. This  re-renders your site  by wrapping it when a `TinaProvider` component, this only happens in edit mode to make sure Tina is not added to your production bundle.\n\n### `components`\n\nMost of the components in this project are very basic and are for demonstration purposes, feel free to replace them with something of your own!\n\n## Content Modeling\n\nWith Tina Cloud there's no need to build forms manually like you would with TinaCMS. Instead, you're required to define a schema which acts as the single source of truth for the shape and structure of your content.\n\nThis is set up for you in `./.tina/schema.ts`, let's break down what this function is doing:\n\n```ts\nimport { defineSchema } from \"tina-graphql-gateway-cli\";\n\nexport default defineSchema({\n  collections: [\n    {\n      label: \"Blog Posts\",\n      name: \"posts\",\n      path: \"content/posts\",\n      templates: [\n        {\n          label: \"Article\",\n          name: \"article\",\n          fields: [\n            {\n              type: \"text\",\n              label: \"Title\",\n              name: \"title\",\n            },\n            {\n              type: \"reference\",\n              label: \"Author\",\n              name: \"author\",\n              collection: \"authors\",\n            },\n          ],\n        },\n      ],\n    },\n  ]\n}\n```\n\n### `defineSchema`\n\nBe sure this is your default export from this file, we'll validate the schema and build out the GraphQL API with it.\n\n### `collections`\n\nThe top-level key in the schema is an array of _collections_, a `collection` informs the API about _where_ to save content. You can see from the example that a `posts` document would be stored in `content/posts`, and it can be the shape of any `template` from the `templates` key.\n\n### `templates`\n\nTemplates are responsible for defining the shape of your content, you'll see in the schema for this starter that we use `templates` for `collections` as well as `blocks`. If you look at the `landingPage` template, you'll notice that it has a set of `blocks`, which are also templates.\n\n## Local development workflow tips\n\n### Typescript\n\nA good way to ensure your components match the shape of your data is to leverage the auto-generated TypeScript types.\nThese are rebuilt when your `.tina` config changes.\n\n### Visual Studio Code\n\n#### GraphQL extension\n\nTina Cloud generates your GraphQL schema automatically. 🪄\n\n[Install GraphQL extension](https://marketplace.visualstudio.com/items?itemName=GraphQL.vscode-graphql) to benefit from type auto-completion.\n\n#### Forestry Schema extension\n\n[Install Forestry extension](https://marketplace.visualstudio.com/items?itemName=jeffsee55.forestry-schema) to lint your YAML-based content models.\n\n### Explore the GraphQL API\n\nIf you have a GraphQL client like [Altair](https://altair.sirmuel.design/) go to `http://localhost:4001/graphql` to learn more about our GraphQL API.\n\n## Getting Help\n\nTina Cloud is in public alpha, you might face issues, to provide feedback or get help with any challenges you may have:\n\n-   Read the [Tina Cloud documentation](https://tina.io/docs/tina-cloud/).\n-   [Join our Discord](https://discord.gg/zumN63Ybpf).\n-   Visit the [community forum](https://community.tinacms.org/) to ask questions.\n-   Reach out to us on Twitter at [@tina_cms](https://twitter.com/tina_cms).\n-   [Email us](mailto:support@tina.io) to schedule a call with our team and share more about your context and what you're trying to achieve.\n-   Get support through the chat widget on the Tina Cloud Dashboard\n\n## LICENSE\n\nLicensed under the [Apache 2.0 license](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchmac%2Ftina-starter-test2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitchmac%2Ftina-starter-test2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchmac%2Ftina-starter-test2/lists"}