Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self-hosted KV - PR from TinaCMS #1596

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e198e7a
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jun 30, 2023
8a7b1d9
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jun 30, 2023
a2e4aa8
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jun 30, 2023
4f2494a
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jun 30, 2023
b5c9eb4
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jun 30, 2023
fc0a72e
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jun 30, 2023
4aa9bb6
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jun 30, 2023
fb20324
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jun 30, 2023
2d6e5a3
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jun 30, 2023
b6e25ac
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jun 30, 2023
6cdb430
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jun 30, 2023
4865f72
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jun 30, 2023
8837165
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jun 30, 2023
f316855
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jun 30, 2023
a06c70d
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jul 3, 2023
530c5aa
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jul 3, 2023
dadec38
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jul 3, 2023
3836b7e
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jul 3, 2023
0b5497f
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jul 3, 2023
8241780
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jul 3, 2023
c86523c
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jul 3, 2023
970a3f5
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jul 3, 2023
5dd7e46
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jul 4, 2023
7331728
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jul 5, 2023
e177885
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jul 5, 2023
4bbdd31
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jul 6, 2023
d538c0b
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jul 7, 2023
3c04e63
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jul 7, 2023
465e2af
update tina lock
kldavis4 Jul 12, 2023
b337093
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jul 12, 2023
21f4d30
TinaCMS content update by Kelly Davis
tina-cloud-app[bot] Jul 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions content/blog/Self-hosted-TinaCMS-powered-by-Vercel-KV.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: Using Vercel KV & NextAuth to Self-host TinaCMS
date: '2023-06-30T04:00:00.000Z'
last_edited: '2023-07-12T04:00:00.000Z'
author: Kelly Davis
prev: content/blog/self-hosted-datalayer.md
---

Earlier this year, we [released](/blog/self-hosted-datalayer/ "released") the first iteration of self-hosted TinaCMS. The initial [demo](https://github.com/tinacms/tina-self-hosted-demo/tree/274c0d9ee004629ff0cef2539b56c88324abd8f8) relied on Tina Cloud for auth and used MongoDB for the data layer. That was the first step in helping our users avoid vendor lock-in.

Since then, we've been hard at work on improving our self-hosted offering to make it easier to get started and less dependent on other vendor services (including our own). Today we are excited to share the next iteration of our Tina self-hosted demo site, leveraging [Vercel KV](https://vercel.com/docs/storage/vercel-kv) for the data layer and [NextAuth.js](NextAuth.js) for auth. It is now possible to set up an open-source [Next.js](https://nextjs.org/) & TinaCMS site only relying on GitHub and Vercel.

## What is Vercel KV?

Vercel KV is a durable Redis database that enables you to store and retrieve JSON data and is available on both hobby (free) and paid plans. The service is provided in partnership with [Upstash](https://upstash.com/about) and does not require a separate Upstash account. Because of its flexibility and performance, Vercel KV is a great fit for powering the self-hosted TinaCMS data layer.

## Using Vercel KV in the TinaCMS data layer

When you build your site with TinaCMS, the ultimate source of truth for your content is your Markdown files. However, features like search and filtering content require a data layer on top of those Markdown files. Virtually any database can be adapted for use with TinaCMS. To enable Vercel KV data layer, we have implemented a new Upstash Redis LevelDB [implementation](https://www.npmjs.com/package/upstash-redis-level). This provides all the data functionality needed by TinaCMS entirely within the Vercel ecosystem.

## Using NextAuth.js in TinaCMS

Tina Cloud provides user & role management, but TinaCMS also supports custom auth solutions that can be adapted for a wide variety of situations. The latest iteration of the Tina self-hosted demo site takes this a step further by integrating with [NextAuth.js](https://next-auth.js.org/). By leveraging NextAuth.js, any of the [available auth providers](https://next-auth.js.org/providers/) (e.g Github, Twitter, Google, etc...) can easily be integrated with TinaCMS. It also features customizable login screens, allowing your site to be fully branded. Lastly, the Tina self-hosted demo site provides a simple auth provider that leverages the same Vercel KV store to immediately enable auth without any additional configuration.

## Future Plans

Repo-based media is not currently available for self-hosted TinaCMS. We currently recommend one of our other media manager solutions when self-hosting, such as Cloudinary, AWS S3 or Digital Oceans. This is something that we are exploring and hope to make available. Additionally our new search capability currently requires Tina Cloud but is something we expect to add soon to self-hosting.

## Getting Started

Visit the self-hosted [demo](https://github.com/tinacms/tina-self-hosted-demo#deploy-this-repository-to-vercel) repo and click the Deploy button to launch the demo on Vercel.

<Youtube embedSrc="https://www.youtube.com/embed/Y_ACBtzf0gs" />
2 changes: 1 addition & 1 deletion tina/tina-lock.json

Large diffs are not rendered by default.