A TypeScript framework that uses ES/TS decorators to query MySQL databases with minimal boilerplate. Version 1.0.21 is the latest, with an unknown release cadence. It provides decorators like @Select, @Insert, @Update, @Delete to map SQL queries directly to class methods, returning typed results. Unlike ORMs such as TypeORM or Sequelize, it offers a lighter, annotation-driven approach without entity definitions, suitable for simple SQL-heavy projects. Ships TypeScript types and requires Node >=16.
npm install decorator-mysqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to initialize a MySQL connection pool and use the @Select decorator to query users by ID.
Upgrade Node.js to version 16 or later.
Use arrow function syntax for decorated methods: methodName: () => any
Use named placeholders like :id in SQL, and pass an object literal as the method argument.
Change method definition to arrow function: findById: (params: any) => any;
Run 'npm install decorator-mysql' and ensure tsconfig.json includes 'node_modules/@types' or has 'strict' enabled.
Set MYSQL_USER, MYSQL_PASSWORD, etc. environment variables, or update the pool config with correct credentials.