The Problem

Developers need a single UI that can query PostgreSQL, MySQL, MSSQL or ClickHouse and get AI‑generated assistance, while keeping connection credentials encrypted. Maintaining separate tooling for each database and for prompt‑based query help creates friction and security risk.

What This Does

conar ships a desktop + web app built with React/TypeScript that talks to a backend (apps/api) exposing oRPC endpoints such as apps/api/orpc/routers/ai/* and apps/api/orpc/routers/connections/*. The UI layer lives under apps/app/src and renders components like components/connection-details.tsx and components/table/cell/*. Database schema handling is generated by the Drizzle ORM files in apps/app/src/drizzle/ and the connection‑specific query logic lives in apps/app/src/entities/connection/ (e.g., query.ts, generators/*). AI assistance is wired through the apps/api/orpc/routers/ai/* handlers, which call the OpenAI/Anthropic SDKs defined in apps/api/lib/*.

How It Is Wired

Execution starts in the API server entry point apps/api/index.ts, which loads environment variables from apps/api/.env.example (or the committed apps/api/.env.test) and registers the oRPC router tree (apps/api/orpc/index.ts). The router exposes createQuery (apps/app/src/entities/connection/query.ts) – this is the most fan‑in function, called from six places and reaching run → database client (client.query).

  • Key call chain: execute (in apps/app/src/entities/connection/dialects/clickhouse/index.ts:63) → connectionResourceToQueryParamsclient.query({ query, format: 'JSONEachRow' }). This is the only path that writes/reads the DB detected by the analysis.
  • AI path: apps/api/orpc/routers/ai/generate-title.tscreateAnswer (used 14 times) → external LLM SDK (apps/api/lib/openai.ts not listed but implied).
  • State hubs: useSubscription (apps/app/src/entities/user/hooks/use-subscription.ts) is imported by 45 modules, making it a high‑blast‑radius module. The connection/query.ts module is a hub with 22 inbound imports and participates in an import cycle.
  • Import cycles: 38 files, e.g., apps/app/src/entities/connection/query.tsapps/app/src/routes/_protected/connection/$resourceId/table/index.tsx. These cycles increase cognitive load and risk accidental side‑effects when refactoring.
  • Deep nesting: Functions in cell-menu.tsx, cell-table.tsx, and connections-list.tsx reach eight levels of indentation, making them hard to follow.

No additional external call graph beyond the listed functions was resolved; many UI callbacks (framework‑provided) are not represented.

How To Use It

# clone the repo
git clone https://github.com/moses-y/conar
cd conar

# install dependencies (pnpm is the lockfile manager)
pnpm install

# start supporting services
pnpm run docker:start   # brings up PostgreSQL and Redis per README

# run database migrations
pnpm run drizzle:migrate

# launch all dev servers (Turbo monorepo)
pnpm run dev

Configuration files: copy the examples to real env files and fill in your keys.

cp apps/api/.env.example apps/api/.env
# edit apps/api/.env with your Stripe, Resend, OpenAI, etc. keys

The API server runs on the port defined in apps/api/.env.example; the desktop client (apps/desktop) and web client (apps/app) connect to it automatically.

Real‑World Use

A SaaS platform can embed the desktop client in an internal admin dashboard. An engineer runs pnpm run dev, opens the UI, adds a PostgreSQL connection (encrypted via the API), and asks the AI “Give me a query that returns the top 10 customers by revenue”. The request travels through apps/api/orpc/routers/ai/fix-sql.ts, hits the OpenAI SDK, receives a generated SQL string, and createQuery executes it against the live DB, returning results to the UI.

Code Health & Issues

  • Critical – Rotate credentials in apps/api/.env.test (contains live keys).
  • High – Pin GitHub Action versions to commit SHAs; remove committed .env.test; add a test step to CI; both are missing from the four workflows.
  • Medium – Declare least‑privilege GITHUB_TOKEN permissions; enable Dependabot; add a dependency‑vulnerability scan; add a pre‑commit secret gate; set persist-credentials: false on the checkout step; expand test coverage (currently 18 test files for ~590 source files).

All findings are from deterministic static analysis; no additional subjective issues are reported.

The Bottom Line

conar provides a functional, AI‑augmented UI for multi‑database querying, with a clear separation between API, UI, and dialect modules. However, the codebase suffers from import cycles, deep nesting, and several security/CI hygiene problems that should be addressed before production use. It is suitable for teams comfortable working in a monorepo of TypeScript/React and willing to remediate the identified health issues.