I'm having trouble finding a section in the official Node.js documentation that explains how to connect to and work with databases. Is database integration covered in the Node.js API docs, or should I be looking somewhere else for guidance?
4 Answers
Think of Node.js as the runtime that provides things like networking, streams, and the event loop. The database driver is the part that actually speaks the database protocol. Start with the driver’s README and try a simple parameterized query; that’s also important for avoiding SQL injection. Add an ORM later if your project needs models, migrations, or a larger data-access layer.
For learning the basics, use the documentation for the specific database package rather than searching the Node.js API docs. For a new MySQL project, mysql2 is generally a better choice than the older mysql package because it has stronger promise support and is more actively used.
Node.js itself doesn’t provide a universal database API, so the core documentation doesn’t have a general database-integration section. You normally install a client library for the database you use and follow its documentation—for example, pg for PostgreSQL, mysql2 for MySQL, or a SQLite library for local databases.
The usual options are a low-level driver such as pg or mysql2, a query builder such as Knex or Kysely, or an ORM like Prisma, Drizzle, or Sequelize. Drivers give you the most control and expose the SQL directly, while query builders and ORMs provide more abstraction and may include migrations or typed models.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically