{"id":13452499,"url":"https://github.com/infinum/datx","last_synced_at":"2025-03-23T19:34:27.529Z","repository":{"id":38706027,"uuid":"115407379","full_name":"infinum/datx","owner":"infinum","description":"DatX is an opinionated JS/TS data store. It features support for simple property definition, references to other models and first-class TypeScript support.","archived":false,"fork":false,"pushed_at":"2024-08-12T20:16:18.000Z","size":32083,"stargazers_count":142,"open_issues_count":30,"forks_count":7,"subscribers_count":6,"default_branch":"release/v3","last_synced_at":"2025-03-16T00:34:55.721Z","etag":null,"topics":["collection","data","data-store","hacktoberfest","javascript","mobx","model","open-source","prop","state-management"],"latest_commit_sha":null,"homepage":"https://datx.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/infinum.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-26T09:25:43.000Z","updated_at":"2025-03-14T01:26:40.000Z","dependencies_parsed_at":"2023-09-22T10:56:35.393Z","dependency_job_id":"503c4120-5303-4486-acd5-09ed3c925eab","html_url":"https://github.com/infinum/datx","commit_stats":{"total_commits":1431,"total_committers":25,"mean_commits":57.24,"dds":0.5918937805730258,"last_synced_commit":"455a7419c3ddffcc4796336b6ce42d0858dc50ad"},"previous_names":[],"tags_count":106,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinum%2Fdatx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinum%2Fdatx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinum%2Fdatx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinum%2Fdatx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/infinum","download_url":"https://codeload.github.com/infinum/datx/tar.gz/refs/heads/release/v3","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245056909,"owners_count":20553855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["collection","data","data-store","hacktoberfest","javascript","mobx","model","open-source","prop","state-management"],"created_at":"2024-07-31T07:01:25.861Z","updated_at":"2025-03-23T19:34:26.197Z","avatar_url":"https://github.com/infinum.png","language":"TypeScript","funding_links":[],"categories":["open-source","TypeScript"],"sub_categories":[],"readme":"# DatX\n\n![Unit tests](https://github.com/infinum/datx/workflows/Unit%20tests/badge.svg)\n\nDatX is an opinionated JS/TS data store. It features support for simple property definition, references to other models and first-class TypeScript support.\n\n---\n\n## Basic usage\n\n```typescript\nimport { Collection, Model, Field } from '@datx/core';\n\nclass Person extends Model {\n  public static type = 'person'; // Unique name of the model class\n\n  @Field()\n  public name!: string; // A normal property without a default value\n\n  @Field()\n  public surname!: string;\n\n  @Field({ toOne: Person })\n  public spouse?: Person; // A reference to a Person model\n\n  public get fullName() {\n    // Standard JS getter\n    return `${this.name} ${this.surname}`;\n  }\n}\n\nclass AppData extends Collection {\n  public static types = [Person]; // A list of models available in the collection\n}\n\nconst store = new AppData();\nconst john = store.add(new Person({ name: 'John', surname: 'Smith' })); // Add a model instance to the store\nconst jane = store.add({ name: 'Jane', surname: 'Smith', spouse: john }, Person); // Add a model to the store\n```\n\n## Getting started\n\n```bash\nnpm install --save @datx/core\n```\n\n- [Installation](https://datx.dev/docs/getting-started/installation)\n- [Defining models](https://datx.dev/docs/getting-started/defining-models)\n- [References](https://datx.dev/docs/getting-started/references)\n- [Configuring the collection](https://datx.dev/docs/getting-started/configuring-the-collection)\n- [Using the collection](https://datx.dev/docs/getting-started/using-the-collection)\n- [Persisting data locally](https://datx.dev/docs/getting-started/persisting-data-locally)\n\n### Polyfilling\n\nThe lib makes use of the following features that are not yet available everywhere. Based on your browser support, you might want to polyfill them:\n\n- [Symbol.for](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol)\n- [Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)\n- [Array.prototype.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)\n\n[How to add the polyfills](https://datx.dev/docs/troubleshooting/known-issues#the-library-doesnt-work-in-internet-explorer-11).\n\n## Concepts\n\nThe library contains two main classes - [`Model`](https://datx.dev/docs/api-reference/model) and [`Collection`](https://datx.dev/docs/api-reference/collection).\n\nA collection contains models of any kind (they should however be listed in the `types` property), while a model can be in a single collection (but doesn't need to be in any).\n\nModels also include some useful [methods](https://datx.dev/docs/mixins/with-actions) and [properties](https://datx.dev/docs/mixins/with-meta), but if they're in collision with your data/logic, you can use a [`PureModel`](https://datx.dev/docs/api-reference/pure-model) class.\n\n## Mixins\n\nMixins are additional plugins that can enhance the regular models and collections. Available mixins:\n\n- [`withActions`](https://datx.dev/docs/mixins/with-actions) (model) - Adds some helper methods to the model - already included in the `Model` class, but not in the `PureModel` class\n- [`withMeta`](https://datx.dev/docs/mixins/with-meta) (model) - Adds some helpful meta data to the model - already included in the `Model` class, but not in the `PureModel` class\n- [`withPatches`](https://datx.dev/docs/mixins/with-patches) (model, collection) - Adds patch support to models and collections\n- [`datx-jsonapi`](https://datx.dev/docs/mixins/jsonapi-mixin) (model, collection and view) - Adds the [JSON API](https://jsonapi.org/) features to the model, collection and view\n\nTo check out what are the planed future mixins, check out [the issues](https://github.com/infinum/datx/labels/mixins).\n\nWant to make your own mixin? Check out [the guide](https://datx.dev/docs/mixins/building-your-own-mixin).\n\n## API reference\n\n- [Collection](https://datx.dev/docs/api-reference/collection)\n- [Model](https://datx.dev/docs/api-reference/model)\n- [View](https://datx.dev/docs/api-reference/view)\n- [prop](https://datx.dev/docs/api-reference/prop)\n- [PureModel](https://datx.dev/docs/api-reference/pure-model)\n- [CompatModel](https://datx.dev/docs/migration-guide/compat-model)\n- [CompatCollection](https://datx.dev/docs/migration-guide/compat-collection)\n- [Model utils](https://datx.dev/docs/api-reference/model-utils)\n- [Lib utils](https://datx.dev/docs/api-reference/lib-utils)\n- [TypeScript interfaces](https://datx.dev/docs/api-reference/typescript-interfaces)\n\n## Troubleshooting\n\nHaving issues with the library? Check out the [troubleshooting](https://datx.dev/docs/troubleshooting/known-issues) page or [open](https://github.com/infinum/datx/issues/new/choose) an issue.\n\n---\n\n[![Build Status](https://travis-ci.org/infinum/datx.svg?branch=master)](https://travis-ci.org/infinum/datx)\n\n## License\n\nThe [MIT License](LICENSE)\n\n## Credits\n\ndatx is maintained and sponsored by\n[Infinum](https://www.infinum.com).\n\n\u003cp align=\"center\"\u003e\n  \u003ca href='https://infinum.com'\u003e\n    \u003cpicture\u003e\n        \u003csource srcset=\"https://assets.infinum.com/brand/logo/static/white.svg\" media=\"(prefers-color-scheme: dark)\"\u003e\n        \u003cimg src=\"https://assets.infinum.com/brand/logo/static/default.svg\"\u003e\n    \u003c/picture\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfinum%2Fdatx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfinum%2Fdatx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfinum%2Fdatx/lists"}