{"id":42740,"library":"farstorm","title":"Farstorm","description":"Farstorm (v1.1.2) is a TypeScript-first ORM for PostgreSQL leveraging structural typing and providing first-access retrieval patterns for efficient querying. It relies on @electric-sql/pglite for PostgreSQL connectivity. Released on npm, it is designed for Node.js 20+ environments with a focus on type safety and developer experience. Differentiators include its unique 'first access' retrieval strategy that minimizes roundtrips and its full TypeScript support with strong type inference for database schemas and queries.","status":"active","version":"1.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/Atrocit/Farstorm","tags":["javascript","typescript"],"install":[{"cmd":"npm install farstorm","lang":"bash","label":"npm"},{"cmd":"yarn add farstorm","lang":"bash","label":"yarn"},{"cmd":"pnpm add farstorm","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides PostgreSQL client and connection management for Farstorm","package":"@electric-sql/pglite","optional":false}],"imports":[{"note":"ESM-only package; CommonJS require is not supported. Use import statements.","wrong":"const Farstorm = require('farstorm')","symbol":"Farstorm","correct":"import { Farstorm } from 'farstorm'"},{"note":"Model is exported from the main entry point, not a submodule.","wrong":"import { Model } from 'farstorm/model'","symbol":"Model","correct":"import { Model } from 'farstorm'"},{"note":"Type-only import is optional if not used at runtime.","symbol":"QueryResult","correct":"import { QueryResult } from 'farstorm'"}],"quickstart":{"code":"import { Farstorm, Model } from 'farstorm';\nimport { PGlite } from '@electric-sql/pglite';\n\nconst client = new PGlite(process.env.PG_URL ?? 'postgresql://localhost:5432/mydb');\nconst farstorm = new Farstorm({ client });\n\nclass User extends Model {\n  static table = 'users';\n  static fields = {\n    id: { type: 'integer', primary: true },\n    name: { type: 'string', required: true },\n    email: { type: 'string', unique: true },\n  };\n}\n\nasync function main() {\n  const users = await User.query().where({ email: 'example@test.com' }).first();\n  console.log(users);\n}\nmain();","lang":"typescript","description":"Initializes Farstorm with a PGlite client and defines a simple model to query the first matching user by email."},"warnings":[{"fix":"Upgrade Node.js to version 20 or later.","message":"Farstorm requires Node.js 20 or later. Older versions are not supported and may cause runtime errors.","severity":"breaking","affected_versions":">=1.0"},{"fix":"Use 'import' statements instead of require(). Ensure your project is configured for ESM (e.g., 'type': 'module' in package.json).","message":"The package is ESM-only. Attempting to import using CommonJS require() will throw an error.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Replace 'pool' with 'client' and use PGlite: new Farstorm({ client: new PGlite(...) }).","message":"The 'Farstorm' constructor previously accepted a configuration object with a 'pool' property (from pg). In v1.1, 'client' is required and must be a PGlite instance.","severity":"deprecated","affected_versions":">=1.1"},{"fix":"Manually add UNIQUE constraints or indexes to your database tables.","message":"Model fields with 'unique: true' are not automatically indexed; you must create indexes separately in PostgreSQL.","severity":"gotcha","affected_versions":">=1.0"}],"env_vars":null,"search_vec":"'/pglite':31 '20':43 'access':19,59 'connect':34 'databas':75 'design':40 'develop':52 'differenti':54 'effici':23 'electr':29 'electric-sql':28 'environ':44 'experi':53 'farstorm':1,2 'first':8,18,58 'first-access':17 'focus':47 'full':67 'includ':55 'infer':73 'javascript':79 'leverag':12 'minim':63 'node.js':42 'npm':37 'orm':9 'pattern':21 'postgresql':11,33 'provid':16 'queri':24,78 'releas':35 'reli':26 'retriev':20,60 'roundtrip':64 'safeti':50 'schema':76 'sql':30 'strategi':61 'strong':71 'structur':13 'support':69 'type':14,49,72 'typescript':7,68,80 'typescript-first':6 'uniqu':57 'v1.1.2':3","created_at":"2026-06-05T16:56:25.887034+00:00","updated_at":"2026-06-05T16:56:25.887034+00:00","problems":[{"fix":"Install the peer dependency: npm install @electric-sql/pglite","cause":"Missing peer dependency @electric-sql/pglite","error":"Cannot find module '@electric-sql/pglite'"},{"fix":"Use named import: import { Farstorm } from 'farstorm'","cause":"Using default import instead of named import or incorrect require usage","error":"TypeError: Farstorm is not a constructor"},{"fix":"Add 'static table = 'your_table_name';' to your model class.","cause":"Model class definition missing 'table' static field","error":"Error: Model must have a static 'table' property"}],"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":"https://github.com/Atrocit/Farstorm#readme","github":"https://github.com/Atrocit/Farstorm","docs":null,"changelog":null,"pypi":null,"npm":"farstorm","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-05","next_check":"2026-09-03","install_tag":null}}