The project is built using Next.js, a React framework for server-side rendering and static site generation. It uses TypeScript for type safety and incorporates various libraries for state management, UI components, and data fetching.
Key components of the architecture include:
- Next.js for the frontend and API routes
- TiDB Cloud for database management
- Redux for state management
- tRPC for type-safe API calls
- Mantine UI for styling
/components
: React components used throughout the application/pages
: Next.js pages and API routes/public
: Static assets/server
: Server-side code, including tRPC router and database schema/styles
: Global CSS styles/utils
: Utility functions and helpers/store
: Redux store configuration and slices
pages/_app.tsx
: Main application componentpages/api/gateway/[trpc].ts
: tRPC API handlerserver/trpc.ts
: tRPC router configurationserver/schema.ts
: Database schema definitionscomponents/App.tsx
: Main application layoututils/env.ts
: Environment variable management
The project is configured for deployment on Vercel, as evidenced by the Vercel-specific environment variables and configurations.
To deploy:
- Set up a Vercel account and link it to your GitHub repository
- Configure the required environment variables in Vercel's dashboard
- Push your changes to the main branch, which will trigger an automatic deployment
The project requires several environment variables to be set. These can be found in the utils/env.ts
file:
export const PrivateEnvVariables = {
TiInsightDatabase: process.env.TIINSIGHT_DB_URI!,
OpenApiDoc: `${process.env.DOC_HOST}/eda/apidocs/swagger.json`,
ReuseDataSummary: process.env.REUSE_DATA_SUMMARY,
NodeEnv: process.env.NODE_ENV,
VercelEnv: process.env.VERCEL_ENV,
MasterKeyV0: process.env.MASTER_KEY_V0!,
TidbCloudDataAppEndpointHost: process.env.TIDBCLOUD_DATA_APP_ENDPOINT_HOST!,
TidbCloudOauthClientId: process.env.TIDBCLOUD_OAUTH_CLIENT_ID!,
TidbCloudOauthClientSecret: process.env.TIDBCLOUD_OAUTH_CLIENT_SECRET!,
TidbCloudOauthHost: process.env.TIDBCLOUD_OAUTH_HOST!,
TidbCloudOpenApiHost: process.env.TIDBCLOUD_OPEN_API_HOST!,
};
export const SampleDatasetConfig = {
dataAppHost: `${process.env.SAMPLE_DB_DATA_APP_BASE_URL}/${process.env.SAMPLE_DB_DATA_APP_ID}/endpoint`,
auth: `${process.env.SAMPLE_DB_PUBLIC_KEY}:${process.env.SAMPLE_DB_PRIVATE_KEY}`,
dbUri: process.env.SAMPLE_DB_URI!,
};
Ensure these environment variables are properly set in your development environment and in your deployment platform.
A template for the environment variables can be found in .env.example
.
- Clone the repository
- Install dependencies:
pnpm install
- Set up the required environment variables in a
.env
file - Run the development server:
pnpm dev
The project uses TiDB Cloud as its database. The schema is defined in server/schema.ts
. To update the database schema:
- Modify the schema in
server/schema.ts
- Run the database migration:
pnpm db:generate pnpm db:push
The project provides an OpenAPI documentation, which can be accessed at /doc.html
when the application is running.
The project uses Vitest for testing. Run tests with:
pnpm test
The project uses Biome for linting and formatting. The configuration can be found in biome.json
.
Sentry is integrated for error tracking and monitoring. The configuration can be found in the following files:
sentry.client.config.ts
sentry.server.config.ts
sentry.edge.config.ts
- Natural language querying of databases
- Data visualization
- Database schema exploration
- Task breakdown for complex queries
- Canvas mode for visual representation of data relationships
- Fork the repository
- Create a new branch for your feature
- Make your changes
- Run tests and ensure linting passes
- Create a pull request