-
-
tidb-cluster-lorciebot-chat2query-schema-data
-
lorciebot-architecture
-
tidb-cluster-lorciebot-prisma-client-migrate-dev
-
tidb-cluster-prisma-reset-database
-
lorciebot-prisma-client-insert-request-data
-
lorciebot-prisma-client-insert-prompts-data
-
lorcidebot-prisma-client-find-prompts
-
lorciebot-prisma-studio
-
lorciebot-prisma-integration-nextJS-codebase
-
lorciebot-vercel-deployment
-
lorciebot-vercel-environment-variables
-
lorciebot-vercel-run
-
DBeaver-Tidb-lorciebot-database
Inspiration
I have discovered TiDb cloud database product after browsing latest Devpost online summer hackathons, hence this hackathon is an opportunity to showcase some use case about TiDb Cloud database and is also an opportunity to learn this technology.
What it does
I have developed a few months ago a Minimum Viable Product (MVP) about OpenAI generative AI technology on Next JS application, where Open AI prompts were stored on static json file as illustrated in following screenshot

So i think that it will be helpful to store and manage dynamically these prompts on TiDB cloud serverless database.
How we built it
- Create an account on TiDb website
- Create a new TiDb Cluster serverless type, in order to get special accesses (login, password) for MySQL Database server => a new test database is automatically created
- Design a Prisma MySQL schema
- Develop migration script to guarantee the synchronisation of Prisma schema model with the TiDb database => this creates automatically schema in the database
- Develop also some utility Javascript scripts to insert some prompts records data in the TiDb database using Prisma client library.
- Integrate call to search dynamically the prompts list from TiDb cloud database on NextJS project main page load, using Prisma client library
- Deploy Next JS application, based on github repository, on Vercel to enable public access to users
The prompts are now externalized offering more flexibility, scalability, being stored and managed dynamically in a TiDb cloud serverless database ( requests and PromptList Tables), as illustrated in following screenshot

Another very interesting (hence has confirmed my choice) feature of TiDb Database is the support of JSON data type as stated on this link : https://docs.pingcap.com/tidbcloud/data-type-json
Since I am familiar with Dbeaver cross platform database tool, I have decided to test the integration of TiDb database to benefit of interactive edition of data in future weeks.
In addition, lorciebot web application can take into account dynamically Prompts data base updates and also enables end users to search Prompts based on Prompt name criteria
Challenges we ran into
MySQL Schema (Fields,..) errors during development have required to modify it iteratively => Fortunately, Prisma tool enables to reset the Database and to take into account the updated schema
Vercel project build error => fix by adding prisma generate command at first build action in package.json file
DBeaver Tool fails to start after configuration with Tidb host/login/pwd parameters on Windows OS => fix after deploying Dbeaver version 23.1..3 version, then setting Mozilla certificate root as indicated in this page https://docs.pingcap.com/tidbcloud/secure-connections-to-serverless-clusters, and activating SSL tab without server verification
Accomplishments that we're proud of
- a working Minimum Viable Product of OpenAI GPT application with dynamic prompts fetched automatically on load from TiDb Cloud serverless Database. These prompts list can be also automatically updated using search criteria. The development has been performed using Prisma ORM tool which has facilitated the integration of TiDb Cloud MySQL database in Next JS application,
What we learned
TiDb Cloud Cluster + Database Management
Prisma (Client) Tool to facilitate the schema design, data insertion, edition and integration inside NextJS
What's next for lorciebot
complete with more prompts
evaluate local and/or on premise Tidb installation
Built With
- dbeaver
- mysql
- nextjs
- openai
- prisma
- tidb
- vercel
Log in or sign up for Devpost to join the conversation.