
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
unified-sql-client
Advanced tools
Universal SQL + fetcher client supporting MySQL, MariaDB, PostgreSQL and Neon, including React hook support
unified-sql-client is a universal SQL and data-fetching library for Node.js and React applications. It supports MySQL, MariaDB, PostgreSQL, and Neon serverless, making it suitable for both traditional and serverless environments. It also includes a built-in useFetcher React hook for easy data fetching from REST APIs.
npm install unified-sql-client
Make sure your .env file is configured correctly to support dynamic environment-based connections.
DATABASE_URL=postgres://user:password@hostname:port/database
USE_NEON_DRIVER=true
The USE_NEON_DRIVER flag can also be automatically detected if your URL includes .neon.tech.
# Production
DB_HOST=your-production-host
DB_USER=your-production-user
DB_PASSWORD=your-production-password
DB_NAME=your-production-db
# Development (fallback)
DEV_DB_HOST=localhost
DEV_DB_USER=root
DEV_DB_PASSWORD=
DEV_DB_NAME=local_db
The driver is auto-configured depending on NODE_ENV.
useDb)queryEx – safe result + error return:import { useEnvConnection, queryEx } from "unified-sql-client/useDb";
useEnvConnection("pg"); // or "mysql"
const [result, error] = await queryEx("SELECT * FROM users WHERE id = $1", [1]);
if (error) {
console.error("DB Error:", error);
} else {
console.log("Data:", result);
}
query – direct result:import { query } from "unified-sql-client/useDb";
const users = await query("SELECT * FROM users");
console.log(users);
useFetcher)import { useFetcher, HttpMethod } from "unified-sql-client/useFetcher";
const { data, error, isLoading } = useFetcher({
method: HttpMethod.GET,
url: "/api/posts",
});
const { trigger } = useFetcher({
method: HttpMethod.POST,
url: "/api/post",
payload: { title: "Hello", content: "World" },
});
await trigger();
You can also manually set a custom connection:
import { setConnection } from "unified-sql-client/useDb";
setConnection({
host: "localhost",
user: "admin",
password: "secret",
database: "mydb",
driver: "pg",
});
.env config based on environmentqueryEx<T>()useFetcher hook for API fetchesuseDb (server-side)query(query: string, args: any[]): Promise<any>queryEx<T>(query: string, args: any[]): Promise<[T | null, DbError | null]>useEnvConnection(driver?: "mysql" | "pg")setConnection(config: DbConnectionConfig)beginTransaction(), commit(), rollback() (MySQL only)useFetcher (client-side)useFetcher<T>(options: { method, url, payload? })
{ data, error, isLoading }{ trigger }.env (for Neon)DATABASE_URL=postgres://user:pass@ep-xyz.neon.tech/dbname?sslmode=require
USE_NEON_DRIVER=true
MIT License © 2025 slynxcz
FAQs
Universal SQL + fetcher client supporting MySQL, MariaDB, PostgreSQL and Neon, including React hook support
The npm package unified-sql-client receives a total of 0 weekly downloads. As such, unified-sql-client popularity was classified as not popular.
We found that unified-sql-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.