Modified form Prisma Examples
This example shows how to implement a fullstack app in TypeScript with Next.js using React and Prisma Client.
- Create a TiDB Cloud account and get your free trial cluster.
- Navigate to your TiDB Cloud Serverless cluster's dashboard.
- Get Endpoint, Port and User field from the Connection tab.
- Build your DATABASE_URL string:
mysql://<User>:<Password>@<Endpoint>:<Port>/rest_nextjs?sslaccept=strict
You will use this DATABASE_URL string to connect to TiDB Cloud Serverless cluster later.
- Clone the code.
git clone https://github.com/tidbcloud/nextjs-prisma-example.git cd nextjs-prisma-example
- Set DATABASE_URL environment variables.
export DATABASE_URL=${your_DATABASE_URL_string}
- Install dependence.
npm install .
- Migrate your database.
npx prisma migrate dev
- Start the app.
npm run dev
🎉 Mission Completes.
The app is now running, navigate to http://localhost:3000/ in your browser to explore its UI.
- Create a TiDB Cloud account and get your free trial cluster.
- Create a Netlify account.
- Navigate to your TiDB Serverless cluster's dashboard.
- Get Endpoint, Port and User field from the Connection tab.
- Build your DATABASE_URL string:
mysql://<User>:<Password>@<Endpoint>:<Port>/rest_nextjs?sslaccept=strict
You will use this DATABASE_URL string to connect to TiDB Cloud Serverless cluster later.
The Deploy to Netlify button will take you to Netlify's deployment page. Then Netlify will help to clone this job to your own GitHub repository and automatically deploy it.
- Click the Deploy to Netlify button.
- Click Connect to GitHub and authenticate GitHub account.
- Fill in Repository name for your own GitHub repository.
- Enter the DATABASE_URL string, get in the previous step, in the Set database URL field.
- Click Save & Deploy.
🎉 Mission Completes.
Now wait for the deployment to complete, then you can view your site on the default domain generated by Netlify.
- Create a TiDB Cloud account and get your free trial cluster.
- Create a Vercel account.
- Navigate to your TiDB Serverless cluster's dashboard.
- Get Endpoint, Port and User field from the Connection tab.
- Build your DATABASE_URL string:
mysql://<User>:<Password>@<Endpoint>:<Port>/rest_nextjs?sslaccept=strict
You will use this DATABASE_URL string to connect to TiDB Cloud Serverless cluster later.
The Deploy button will take you through Vercel's project creation flow. Vercel will help to clone this job to your own GitHub repository and automatically deploy it.
- Click the Deploy button.
- Click GitHub button and authenticate GitHub account.
- Select your Git Scope and fill in Repository Name for your own GitHub repository.
- Click Create to create the git repository.
- Enter the DATABASE_URL string, get in the previous step, in the Value field.
- Click Deploy.
🎉 Mission Completes.
Now wait for the deployment to complete, then you can view your site on the default domain generated by Vercel.