Skip to content

About

A collection of examples demonstrating how to connect and use TiDB Cloud.

Topics

Resources

Stars

18 stars

Watchers

7 watching

Forks

Repository files navigation

TiDB Cloud Examples

A collection of examples demonstrating how to connect and use TiDB Cloud.

Local Usage

Run the examples locally with your own test database and API credentials. Each example's README includes a screenshot and setup instructions.

These are learning examples without user authentication, per-user data isolation, or abuse controls. Use test data and credentials with limited permissions. Add the appropriate protections before making an example publicly accessible.

Getting Started

These examples are built with modern web development tools and practices. Before you begin, make sure you have the following prepared:

Prerequisites

  • Node.js 20.x or later
  • pnpm 9.x or later (we use pnpm workspaces to manage multiple examples)
  • A TiDB Cloud account (free tier available, no credit card required)

Installation

  1. Clone the repository:
git clone https://github.com/tidbcloud/examples-projects.git
cd examples-projects
  1. Install dependencies:
pnpm install
  1. Each example has its own environment variables that need to be configured. Check the README in each example directory for specific setup instructions.

After configuring an example, start it from the repository root:

pnpm --dir examples/with-nextjs-todo dev --hostname 127.0.0.1

Replace with-nextjs-todo with the example you want to run, then open http://localhost:3000. Run one example at a time, or pass --port 3001 to use another port.

  1. If you only want to clone a single example, you can use the following command:
pnpm dlx degit tidbcloud/examples-projects/examples/with-chat2query-api my-example

Then cd into that example directory and run pnpm install.

You can also replace with-chat2query-api with the name of the example you want to clone, for example:

pnpm dlx degit tidbcloud/examples-projects/examples/with-data-api my-example
pnpm dlx degit tidbcloud/examples-projects/examples/with-nextjs-todo my-example
pnpm dlx degit tidbcloud/examples-projects/examples/with-vector-search my-example

Each project requires a .env file to be created in the root of the example directory. You can refer to the README in each example directory for more details.

Examples

Next.js Todo App

A full-stack todo application built with Next.js, demonstrating how to connect and use TiDB Cloud Serverless with Drizzle ORM. Learn more

Data Service Dashboard

A dashboard application showcasing TiDB Cloud Data Service for building APIs without backend code. Learn more

Chat2Query Interface

An AI-powered SQL chat interface using TiDB Cloud's Chat2Query API to generate and execute queries. Learn more

Vector Search RAG

A RAG (Retrieval Augmented Generation) application demonstrating TiDB's vector search capabilities. Learn more

Features Demonstrated

  • TiDB Cloud Serverless database connection
  • Data Service for serverless APIs
  • Chat2Query for natural language SQL queries
  • Vector search for semantic search and RAG applications
  • TypeScript & Next.js integration
  • tRPC for type-safe APIs
  • Drizzle ORM for database operations

Need Help?

Run into issues or have questions? We're here to help!

  • Open an issue in our GitHub repository
  • Include details about:
    • Which example you're using
    • What you're trying to do
    • Any error messages you're seeing
    • Your environment (Node.js version, OS, etc.)

Our team actively monitors issues and will help you get up and running.

About

A collection of examples demonstrating how to connect and use TiDB Cloud.

Topics

Resources

Stars

18 stars

Watchers

7 watching

Forks

Releases

Packages

Used by

Contributors