TypeScript SQL libraries for Node.js that prevent SQL injection with support for Postgres, MySQL, SQLite, and WebSQL.
@databases is a suite of TypeScript libraries for Node.js that provide secure, type-safe database clients. It solves the problem of SQL injection by enforcing a tagged template literal API that separates SQL queries from user input, making it virtually impossible to write vulnerable code accidentally. The libraries support multiple databases including PostgreSQL, MySQL, SQLite, and WebSQL.
TypeScript/Node.js developers building applications that require secure database access, particularly those concerned with preventing SQL injection and leveraging type safety for database operations.
Developers choose @databases for its uncompromising focus on security through its enforced API, combined with first-class TypeScript support for type-safe queries. Its modular design allows picking only the needed database drivers and utilities.
TypeScript clients for databases that prevent SQL Injection
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Enforces the use of tagged template literals (sql) for all queries, separating SQL from values to prevent injection attacks, as shown in the README example db.query(sql`SELECT * FROM users WHERE id=${userID}`).
Built with TypeScript, providing full type safety and compile-time error catching across all modules, ensuring robust database operations.
Each database driver and utility is a separate npm package, allowing minimal installations and reduced bundle size, as listed in the modular table.
Supports PostgreSQL, MySQL, SQLite, BigQuery, and WebSQL/Expo through dedicated packages, enabling a unified approach for diverse database needs.
Several packages, such as @databases/migrations-base and @databases/mock-db, are marked as 'Not documented yet' in the README, hindering usability and learning.
The highly modular design requires managing multiple dependencies, which can complicate setup and maintenance compared to all-in-one libraries.
Has fewer community resources, plugins, and integrations compared to mainstream options like node-postgres or mysql2, limiting extensibility.