{"id":17934,"library":"ronin","title":"RONIN Data Platform TypeScript Client","description":"The `ronin` package provides a robust, TypeScript-first client for interacting with the RONIN data platform. Currently at version 6.8.0, it offers an intuitive ORM-like interface designed for efficient data access, particularly optimized for serverless and edge environments. This library abstracts common database operations, enabling developers to seamlessly query, mutate, and manage records through a fluent API. It prioritizes type safety and developer experience, shipping with comprehensive TypeScript definitions. While a precise release cadence isn't published, the versioning suggests regular updates that align with new platform features and bug fixes. Key differentiators include its native TypeScript integration, performance optimization for modern deployment patterns like serverless functions, and direct, secure connectivity to the RONIN backend services.","status":"active","version":"6.8.0","language":"javascript","source_language":"en","source_url":"https://github.com/ronin-co/client","tags":["javascript","ronin","client","database","orm","edge","serverless","typescript"],"install":[{"cmd":"npm install ronin","lang":"bash","label":"npm"},{"cmd":"yarn add ronin","lang":"bash","label":"yarn"},{"cmd":"pnpm add ronin","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The primary client class is a named export, not a default export, for better tree-shaking and type inference.","wrong":"import Ronin from 'ronin'","symbol":"Ronin","correct":"import { Ronin } from 'ronin'"},{"note":"Import types using `import type` for clarity and to ensure they are stripped from the JavaScript bundle.","wrong":"import { RoninRecord } from 'ronin'","symbol":"RoninRecord","correct":"import type { RoninRecord } from 'ronin'"},{"note":"The package is primarily designed for ES Modules. While CommonJS might work via transpilation, direct `require` syntax is not officially supported or recommended since Node.js 18.17.0 is the minimum engine.","wrong":"const RoninError = require('ronin').RoninError","symbol":"RoninError","correct":"import { RoninError } from 'ronin'"}],"quickstart":{"code":"import { Ronin } from 'ronin';\n\ninterface Product extends RoninRecord {\n  id: string;\n  name: string;\n  price: number;\n  inStock: boolean;\n}\n\nasync function main() {\n  // Ensure RONIN_TOKEN is set as an environment variable\n  const roninClient = new Ronin({ token: process.env.RONIN_TOKEN ?? '' });\n\n  try {\n    // Create a new product record\n    const newProduct = await roninClient.create<Product>('products', {\n      name: 'Smart Coffee Maker',\n      price: 149.99,\n      inStock: true,\n    });\n    console.log('Created product:', newProduct.name, newProduct.id);\n\n    // Fetch all products\n    const allProducts = await roninClient.get<Product[]>('products');\n    console.log(`Found ${allProducts.length} products.`);\n\n    // Fetch a specific product by ID\n    if (newProduct.id) {\n      const fetchedProduct = await roninClient.getById<Product>('products', newProduct.id);\n      console.log('Fetched product by ID:', fetchedProduct?.name);\n    }\n\n    // Update a product\n    const updatedProduct = await roninClient.update<Product>('products', newProduct.id, { inStock: false });\n    console.log('Updated product status:', updatedProduct.name, 'inStock:', updatedProduct.inStock);\n\n    // Delete a product (example, uncomment to run)\n    // await roninClient.delete('products', newProduct.id);\n    // console.log('Deleted product:', newProduct.id);\n\n  } catch (error) {\n    console.error('Error interacting with RONIN database:', error);\n  }\n}\n\nmain();","lang":"typescript","description":"Initializes the Ronin client, creates a new product, fetches all products, retrieves a specific product by ID, and updates a product's status."},"warnings":[{"fix":"Review the official migration guide for v6.x. Ensure your client initialization now passes configuration directly to the `new Ronin()` constructor. Adapt any custom query logic to the new fluent API.","message":"Version 6.0 introduced breaking changes related to the client initialization and API surface, simplifying some methods and consolidating others. Direct access to some internal utilities was removed in favor of the public API.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Always ensure `process.env.RONIN_TOKEN` (or equivalent for your runtime) is correctly set before initializing the `Ronin` client. For production, use secure environment management; for local development, consider a `.env` file with `dotenv`.","message":"The `ronin` package relies heavily on environment variables for API tokens (e.g., `RONIN_TOKEN`). Failing to provide these, or providing an invalid one, will result in authentication errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure your project is configured for ES Modules (e.g., `\"type\": \"module\"` in `package.json`) and you are using a compatible Node.js version. If using CommonJS, configure a bundler like Webpack or Rollup, or a transpiler like Babel, to handle ESM imports.","message":"The library is ESM-first, requiring Node.js >=18.17.0. Older Node.js versions or pure CommonJS environments might encounter issues with import/export syntax without proper transpilation.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Regularly synchronize your local TypeScript interfaces with your RONIN database schema. Leverage the type inference capabilities of the `Ronin` client's methods and define precise interfaces for your data models.","message":"Schema enforcement and type definitions were significantly tightened in version 5.0. If your local TypeScript types do not align with the backend RONIN database schema, you may encounter runtime errors or type mismatches during compilation.","severity":"breaking","affected_versions":">=5.0.0"}],"env_vars":null,"last_verified":"2026-04-23T00:00:00.000Z","next_check":"2026-07-22T00:00:00.000Z","problems":[{"fix":"Verify the correct import style (`import { Ronin } from 'ronin'` or `import Ronin from 'ronin'`) against the version's documentation. Ensure `package.json` has `\"type\": \"module\"` if you're using ESM imports in a non-transpiled Node.js environment.","cause":"Attempting to import `Ronin` as a named export when it might have been default in an older version, or vice-versa, or due to incorrect `package.json` `type` field.","error":"TypeError: Cannot destructure property 'Ronin' of 'ronin' as it is undefined."},{"fix":"Set the `RONIN_TOKEN` environment variable with a valid API token obtained from your RONIN dashboard before running your application. Double-check for typos or accidental whitespace.","cause":"The `RONIN_TOKEN` environment variable was not provided, or the token is invalid/expired.","error":"RoninError: Authentication failed. Invalid or missing API token."},{"fix":"Run `npm install ronin` (or `yarn add ronin`). Ensure your `tsconfig.json` includes `\"moduleResolution\": \"Bundler\"` or `\"NodeNext\"` for modern Node.js projects, and that `\"skipLibCheck\": true` is not masking other issues.","cause":"TypeScript cannot find the package or its types. This can happen if the package isn't installed, or if `tsconfig.json` isn't configured correctly.","error":"TS2307: Cannot find module 'ronin' or its corresponding type declarations."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}