{"id":14957132,"url":"https://github.com/diegothucao/react-native-typescript-mobx-realm-template","last_synced_at":"2026-02-21T04:02:05.330Z","repository":{"id":123749635,"uuid":"182281449","full_name":"diegothucao/react-native-typescript-mobx-realm-template","owner":"diegothucao","description":"This is an essential example to build react-native app using Typescript, Mobx and Realm","archived":false,"fork":false,"pushed_at":"2019-06-24T10:39:24.000Z","size":35,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T23:51:42.450Z","etag":null,"topics":["best-practices","boilerplate","boilerplate-template","cache","es6","mobx","react-js","react-native","react-native-app","realm-js","template-project","typescript"],"latest_commit_sha":null,"homepage":"http://www.linkedin.com/in/diegothucao","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/diegothucao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-19T14:58:53.000Z","updated_at":"2023-01-26T12:14:47.000Z","dependencies_parsed_at":"2023-05-02T20:22:09.075Z","dependency_job_id":null,"html_url":"https://github.com/diegothucao/react-native-typescript-mobx-realm-template","commit_stats":{"total_commits":17,"total_committers":1,"mean_commits":17.0,"dds":0.0,"last_synced_commit":"f6381f3c95fc97e4991d56529fc7721cfd153ced"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/diegothucao/react-native-typescript-mobx-realm-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diegothucao%2Freact-native-typescript-mobx-realm-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diegothucao%2Freact-native-typescript-mobx-realm-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diegothucao%2Freact-native-typescript-mobx-realm-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diegothucao%2Freact-native-typescript-mobx-realm-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diegothucao","download_url":"https://codeload.github.com/diegothucao/react-native-typescript-mobx-realm-template/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diegothucao%2Freact-native-typescript-mobx-realm-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29672756,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T03:11:15.450Z","status":"ssl_error","status_checked_at":"2026-02-21T03:10:34.920Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["best-practices","boilerplate","boilerplate-template","cache","es6","mobx","react-js","react-native","react-native-app","realm-js","template-project","typescript"],"created_at":"2024-09-24T13:14:07.530Z","updated_at":"2026-02-21T04:02:05.305Z","avatar_url":"https://github.com/diegothucao.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Native, Typescript, Mobx and Realm\nThis is an essential example to build React-native app using Typescript, Mobx and Realm.\n\n1. Clone the [repo](https://github.com/diegothucao/react-native-typescript-mobx-realm-template)\n2. `yarn install` OR `npm install`(Please check Node version support for realm [Realm-JS](https://realm.io/docs/javascript/latest/#getting-started))\n3. `react-native eject`\n4. `react-native link realm`\n5. `react-native run-ios` OR `react-native run-android`\n\nDefine store \n```typescript \nimport Realm, {ObjectSchema} from 'realm'\nexport const CauseName = \"Cause\"\nexport const UserName = \"User\"\nexport const DealObjectName = \"Deal\"\n\nexport const CauseSchema: ObjectSchema = {\n    name: CauseName,\n    properties: {\n      name: {type: 'string'}\n    }\n  }\n\n  export const UserSchema: ObjectSchema = {\n    name: UserName,\n    properties: {\n      avatar:  {type: 'string'},\n      name: {type: 'string'}\n    }\n  } \n\n  export const DealSchema: ObjectSchema = {\n    name: DealObjectName,\n    primaryKey: 'key',\n    properties: {\n        key: {type: 'string', default: \"\"},\n        dealType: {type: 'string', default: \"\"},\n        title: {type: 'string', default: \"\"},\n        price: {type: 'double', default: 0.00},\n        makerPercentage: {type: 'double', default: 0.00},\n        description: {type: 'string', default: \"\"},\n        tags: {type: 'string', default: \"\"},\n        url: {type: 'string', default: \"\"},\n        media: {type: 'string[]', default: []},\n        user: {type: UserName, default: undefined},\n        cause: {type: CauseName, default: undefined}\n    }\n  }\n\nexport const realmMain = new Realm({schema: [DealSchema]})\n```\n\nDefine a store \n```typescript \nimport { observable, action, runInAction, computed, IObservableValue } from 'mobx'\nimport { realmMain, DealObjectName } from './../models/RealmFactory'\nimport { dealService } from '../services/deal/DealService'\nimport Deal from '../models/Deal'\n\nexport default class AppStore {\n    @observable isLoading: boolean = true\n    @observable isFailure: boolean = false\n    @observable searchTerm: IObservableValue\u003cstring\u003e = observable.box(\"\")\n    @observable deals?: Realm.Results\u003cDeal\u003e\n    @observable currentDealId: string | null = null\n\n    constructor() {\n        this.searchTerm.observe(() =\u003e {\n            this.fetchDeals()\n        }, true)\n    }\n\n    async fetchDeals() {\n        dealService.searchData(this.searchTerm.get()).then(data =\u003e {\n            runInAction(() =\u003e {\n                this.isLoading = false\n                data.forEach(item =\u003e {\n                    realmMain.write(() =\u003e {\n                        realmMain.create(DealObjectName, item, true)\n                      })\n                  })\n\n                  if (this.searchTerm.get().length \u003e 0) {\n                    this.deals = realmMain.objects\u003cDeal\u003e(DealObjectName).filtered('title CONTAINS[c] \"' + this.searchTerm.get() + '\"')\n                }else {\n                    this.deals = realmMain.objects\u003cDeal\u003e(DealObjectName)\n                }\n            })\n        })\n    }\n\n    @action setSearchTerm(searchStr: string) {\n        this.searchTerm.set(searchStr)\n    }\n\n    @action\n    setCurrentDeal(dealId: string) {\n        this.currentDealId = dealId\n    }\n\n    @action\n    unsetCurrentDeal() {\n        this.currentDealId = null\n    }\n}\n```\nIf you see any issue, please do not hesitate to create an issue here or can contact me via email cao.trung.thu@gmail.com or [Linkedin](https://www.linkedin.com/in/diegothucao/)\n\nThanks\n\nreferences\n1. https://facebook.github.io/react-native/docs/tutorial\n2. https://github.com/jscomplete/react-native-essential-training\n3. https://mobx.js.org\n4. https://www.tutorialspoint.com/typescript/\n5. https://www.tutorialspoint.com/es6\n6. https://realm.io/docs/javascript/latest/#filtering\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiegothucao%2Freact-native-typescript-mobx-realm-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiegothucao%2Freact-native-typescript-mobx-realm-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiegothucao%2Freact-native-typescript-mobx-realm-template/lists"}