TiDB Cloud Starter

R
Renaudil y a 2 jours
0

Description

A bookstore demo built on TiDB Cloud and Next.js.

npx boilerapp tidb-cloud-starter

文档

Bookshop Demo

Bookshop is a virtual online bookstore application through which you can find books of various categories and rate the books.

You can perform CRUD operations such as viewing book details, adding and deleting ratings, editing book inventory, etc.

Powered by TiDB Cloud, Prisma and Vercel.

🔥 Visit Live Demo

👉 Click here to visit

image

Deploy on Vercel

🧑‍🍳 Before We Start

Create a TiDB Cloud account and get your free trial cluster.

🚀 One Click Deploy

You can click the button to quickly deploy this demo if already has an TiDB Cloud cluster.

Deploy with Vercel

Integration will guide you connect your TiDB Cloud cluster to Vercel.

<details> <summary><h3>Manually Deploy (Not recommended)</h3></summary>

1. Get connection details

You can get the connection details by clicking the Connect button.

image

Get User and Host field from the dialog.

Note: For importing initial data from local, you can set an Allow All traffic filter here by entering an IP address of 0.0.0.0/0.

image

Your DATABASE_URL should look like mysql://<User>:<Password>@<Host>:4000/bookshop

2. Deploy on Vercel

Deploy with Vercel

image

</details>

Deploy on AWS Linux

Install git and nodejs pkgs

sudo yum install -y git

# Ref: https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-up-node-on-ec2-instance.html
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash;
source ~/.bashrc;
nvm install --lts;
node -e "console.log('Running Node.js ' + process.version)"

Clone the repository

git clone https://github.com/pingcap/tidb-prisma-vercel-demo.git;
cd tidb-prisma-vercel-demo;

Install dependencies

corepack enable;
corepack yarn install;
yarn;

Connect to TiDB Cloud and create a database

mysql -h gateway01.us-west-2.prod.aws.tidbcloud.com -P 4000 -u user -p
mysql> create database tidb_labs_bookshop;

Set environment variables

export DATABASE_URL=mysql://user:pass@gateway01.us-west-2.prod.aws.tidbcloud.com:4000/tidb_labs_bookshop

Build the project

yarn run prisma:deploy && yarn run setup && yarn run build

Start the server

yarn start

Open the browser

Open the browser and visit http://<ip>:3000.

📖 Development Reference

Prisma

Prisma Deployment Guide

Bookshop Schema

Bookshop Schema Design

Prix

Gratuit

FREE

评论 (0)

常见问题

常见问题解答 (FAQ)

有问题?我们有答案。如果您找不到想要的答案,请随时联络我们。

Boilerapp 是一个专门用于分享 Boilerplates、入门套件(Starter Kits)和项目模版的开发者社区平台。我们的目标很简单:为您节省初始配置(Setup)的时间,让您可以专注于真正重要的代码。无论您是在寻找简单的代码库还是完整的 SaaS 项目,都能在这里找到。

还有其他问题?

我们的团队随时为您提供帮助。联络我们,我们将尽快回复。