{"id":45251,"library":"kysely-expo","title":"kysely-expo","description":"Expo SQLite dialect and provider for Kysely, the TypeScript SQL query builder. Current stable version is 56.0.0, compatible with Expo SDK 56+. Provides a KyselyProvider React context to initialize and expose the database, with automatic STRICT table creation, type converters (auto affinity and column-name-based), and blob support. Key differentiator: simplifies Kysely integration with Expo's SQLite module, handling connection lifecycle and type conversions for booleans, dates, JSON, and binary data without raw SQL.","status":"active","version":"56.0.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","kysely","sqlite","expo","react-native","typescript","database","sql","query builder"],"install":[{"cmd":"npm install kysely-expo","lang":"bash","label":"npm"},{"cmd":"yarn add kysely-expo","lang":"bash","label":"yarn"},{"cmd":"pnpm add kysely-expo","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides the underlying SQLite database API for Expo","package":"expo-sqlite","optional":false},{"reason":"Core query builder library; this package provides a dialect for it","package":"kysely","optional":false},{"reason":"Required for KyselyProvider component used in React/Expo apps","package":"react","optional":false}],"imports":[{"note":"Named export; default export does not exist.","wrong":"import KyselyProvider from 'kysely-expo'","symbol":"KyselyProvider","correct":"import { KyselyProvider } from 'kysely-expo'"},{"note":"Hook provided by kysely-expo, not by Kysely itself.","wrong":"import { useKysely } from 'kysely'","symbol":"useKysely","correct":"import { useKysely } from 'kysely-expo'"},{"note":"Enum defined in kysely-expo for type converter configuration.","wrong":"import { SQLiteType } from 'expo-sqlite'","symbol":"SQLiteType","correct":"import { SQLiteType } from 'kysely-expo'"},{"note":"Type for column-name-based conversion rules.","wrong":"import { ColumnNameBasedConverter } from 'kysely'","symbol":"ColumnNameBasedConverter","correct":"import { ColumnNameBasedConverter } from 'kysely-expo'"}],"quickstart":{"code":"import { KyselyProvider, useKysely } from 'kysely-expo';\nimport { Generated, type Kysely } from 'kysely';\n\ninterface LogTable {\n  id: Generated<number>;\n  message: string;\n  created_at: Date;\n}\n\ninterface Database {\n  logs: LogTable;\n}\n\nfunction InnerComponent() {\n  const db = useKysely<Database>();\n\n  const addLog = async () => {\n    await db.insertInto('logs').values({ message: 'Hello', created_at: new Date() }).execute();\n  };\n\n  return <button onClick={addLog}>Add Log</button>;\n}\n\nexport default function App() {\n  return (\n    <KyselyProvider<Database>\n      database=\"logs.db\"\n      autoAffinityConversion\n      debug\n      onInit={async (db: Kysely<Database>) => {\n        await db.schema.createTable('logs')\n          .addColumn('id', 'integer', col => col.autoIncrement().primaryKey())\n          .addColumn('message', 'text')\n          .addColumn('created_at', 'text')\n          .execute();\n      }}\n    >\n      <InnerComponent />\n    </KyselyProvider>\n  );\n}","lang":"typescript","description":"Complete example of setting up KyselyProvider with Expo SQLite, defining a database schema, and using useKysely hook inside a component."},"warnings":[{"fix":"Remove one converter from KyselyProvider options.","message":"Only one converter can be used at a time: specify either autoAffinityConversion OR columnNameBasedConversion, not both.","severity":"breaking","affected_versions":">=56.0.0"},{"fix":"Set disableStrictMode: true in KyselyProvider options to disable STRICT tables.","message":"STRICT mode is enabled by default for all tables; this restricts column types to INT, INTEGER, REAL, TEXT, BLOB, ANY only.","severity":"gotcha","affected_versions":">=56.0.0"},{"fix":"Ensure string columns never contain 'true' or 'false' or use columnNameBasedConversion instead.","message":"Auto affinity conversion stores booleans as 'true'/'false' TEXT; cannot distinguish from actual strings.","severity":"gotcha","affected_versions":">=56.0.0"},{"fix":"Check compatibility with your Expo SDK version before upgrading.","message":"Version 56.0.0 is tied to Expo SDK 56; future versions may require different Expo SDK major versions.","severity":"deprecated","affected_versions":"56.0.0"}],"env_vars":null,"search_vec":"'56':25 '56.0.0':20 'affin':45 'auto':44 'automat':38 'base':50 'binari':75 'blob':52 'boolean':71 'builder':15,91 'column':48 'column-name-bas':47 'compat':21 'connect':65 'context':30 'convers':69 'convert':43 'creation':41 'current':16 'data':76 'databas':36,88 'date':72 'dialect':6 'differenti':55 'expo':3,4,23,60,83 'expos':34 'handl':64 'initi':32 'integr':58 'javascript':80 'json':73 'key':54 'kyse':2,10,57,81 'kysely-expo':1 'kyselyprovid':28 'lifecycl':66 'modul':63 'name':49 'nativ':86 'provid':8,26 'queri':14,90 'raw':78 'react':29,85 'react-nat':84 'sdk':24 'simplifi':56 'sql':13,79,89 'sqlite':5,62,82 'stabl':17 'strict':39 'support':53 'tabl':40 'type':42,68 'typescript':12,87 'version':18 'without':77","created_at":"2026-06-07T12:54:05.813773+00:00","updated_at":"2026-06-07T12:54:05.813773+00:00","problems":[{"fix":"Run `npm install kysely-expo expo-sqlite kysely react`","cause":"Package not installed or peer dependencies not met.","error":"Cannot find module 'kysely-expo'"},{"fix":"Set only one converter: either autoAffinityConversion: true or columnNameBasedConversion: [...], not both.","cause":"Using both autoAffinityConversion and columnNameBasedConversion simultaneously.","error":"Type 'false' is not assignable to type 'true'"},{"fix":"Use SQLite type keywords: 'text', 'integer', 'real', 'blob', 'any' instead of TypeScript type names.","cause":"Attempting to use a type alias like 'string' instead of 'text' in schema definition with STRICT mode enabled.","error":"Invalid type 'string' for column 'id'. STRICT mode only allows: INT, INTEGER, REAL, TEXT, BLOB, ANY"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"kysely-expo","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}