@nextlyhq/adapter-mysql 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 NextlyHQ <info@nextlyhq.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # @nextlyhq/adapter-mysql
2
+
3
+ MySQL database adapter for Nextly. Built on `mysql2` with connection pooling and transactions.
4
+
5
+ <p align="center">
6
+ <a href="https://www.npmjs.com/package/@nextlyhq/adapter-mysql"><img alt="npm" src="https://img.shields.io/npm/v/@nextlyhq/adapter-mysql?style=flat-square&label=npm&color=cb3837" /></a>
7
+ <a href="https://github.com/nextlyhq/nextly/blob/main/LICENSE.md"><img alt="License" src="https://img.shields.io/github/license/nextlyhq/nextly?style=flat-square&color=blue" /></a>
8
+ <a href="https://nextlyhq.com/docs"><img alt="Status" src="https://img.shields.io/badge/status-alpha-orange?style=flat-square" /></a>
9
+ </p>
10
+
11
+ > [!IMPORTANT]
12
+ > Nextly is in alpha. APIs may change before 1.0. Pin exact versions in production.
13
+
14
+ ## What it is
15
+
16
+ The MySQL adapter for Nextly. Use this if your database is MySQL or a MySQL-compatible cloud database (MariaDB, TiDB, Aurora MySQL, PlanetScale, Vitess work on best-effort).
17
+
18
+ > [!NOTE]
19
+ > **PostgreSQL is the recommended dialect for new Nextly projects.** MySQL works, but it lacks several features Nextly leans on natively in PostgreSQL. The adapter emulates or works around the gaps (see [Dialect notes](#dialect-notes) below). Choose MySQL only if you already standardize on it; choose [`@nextlyhq/adapter-postgres`](../adapter-postgres) for new builds.
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ pnpm add @nextlyhq/adapter-mysql mysql2
25
+ ```
26
+
27
+ ## Quick usage
28
+
29
+ Nextly selects the adapter from your `.env` file. Install the package and set:
30
+
31
+ ```bash
32
+ DB_DIALECT=mysql
33
+ DATABASE_URL=mysql://user:password@localhost:3306/mydb
34
+ ```
35
+
36
+ That is it. Nextly's runtime instantiates the adapter on boot.
37
+
38
+ ## Required environment variables
39
+
40
+ | Variable | Required? | Default | Notes |
41
+ | -------------- | ----------- | ------------------------ | --------------------------------------- |
42
+ | `DATABASE_URL` | yes | (none) | Standard `mysql://...` URL. |
43
+ | `DB_DIALECT` | recommended | (auto-detected from URL) | One of `postgresql`, `mysql`, `sqlite`. |
44
+
45
+ For SSL on managed providers (PlanetScale, Aurora MySQL), include the SSL params in the URL or set `MYSQL_SSL=true`.
46
+
47
+ ## Programmatic usage (advanced)
48
+
49
+ For custom bootstrap such as test harnesses or scripts:
50
+
51
+ ```ts
52
+ import { createMySqlAdapter } from "@nextlyhq/adapter-mysql";
53
+
54
+ const adapter = createMySqlAdapter({
55
+ url: process.env.DATABASE_URL!,
56
+ });
57
+
58
+ await adapter.connect();
59
+ ```
60
+
61
+ Most users do not need this.
62
+
63
+ ## Supported MySQL versions
64
+
65
+ - MySQL 8.0 or newer required
66
+ - MySQL-compatible variants (MariaDB, TiDB, Aurora MySQL, PlanetScale, Vitess) work on best-effort. The adapter detects the variant at connect time and warns when behavior may diverge.
67
+
68
+ ## Dialect notes
69
+
70
+ MySQL lacks a few features Nextly uses natively in PostgreSQL. The adapter emulates or works around them:
71
+
72
+ - **`RETURNING` clause:** emulated with an extra `SELECT` after writes.
73
+ - **`ILIKE`:** emulated as `LOWER(...) LIKE LOWER(...)`.
74
+ - **Savepoints:** disabled by the adapter.
75
+ - **`JSONB`:** not available; `JSON` columns are used instead.
76
+
77
+ ## Main exports
78
+
79
+ - `MySqlAdapter`: the adapter class
80
+ - `createMySqlAdapter`: factory for programmatic use
81
+ - `isMySqlAdapter`: type guard
82
+ - Type exports: `MySqlAdapterConfig`
83
+
84
+ ## Compatibility
85
+
86
+ | Tool | Version |
87
+ | -------- | ------- |
88
+ | Node.js | 20+ |
89
+ | `mysql2` | 3+ |
90
+ | `nextly` | 0.0.x |
91
+
92
+ ## Documentation
93
+
94
+ - [**MySQL adapter docs**](https://nextlyhq.com/docs/database/mysql)
95
+ - [**Database support and version policy**](https://nextlyhq.com/docs/database/support)
96
+
97
+ ## Related packages
98
+
99
+ - [`@nextlyhq/adapter-postgres`](../adapter-postgres): recommended for new projects
100
+ - [`@nextlyhq/adapter-sqlite`](../adapter-sqlite)
101
+
102
+ ## License
103
+
104
+ [MIT](../../LICENSE.md)