{"id":16482481,"url":"https://github.com/f/kreal","last_synced_at":"2025-02-28T19:42:11.024Z","repository":{"id":140370652,"uuid":"54403293","full_name":"f/kreal","owner":"f","description":"Kreal is a model sharing \u0026 RPC library built on and works with Kemal seamlessly.","archived":false,"fork":false,"pushed_at":"2017-03-28T03:15:26.000Z","size":17,"stargazers_count":44,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-11T11:48:02.400Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","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/f.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2016-03-21T16:02:51.000Z","updated_at":"2021-08-29T07:09:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"9e5d00ce-3166-4bb5-81a9-41bb581eac24","html_url":"https://github.com/f/kreal","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f%2Fkreal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f%2Fkreal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f%2Fkreal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f%2Fkreal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/f","download_url":"https://codeload.github.com/f/kreal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241214279,"owners_count":19928293,"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":[],"created_at":"2024-10-11T13:10:56.012Z","updated_at":"2025-02-28T19:42:11.002Z","avatar_url":"https://github.com/f.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://cdn.rawgit.com/f/kreal/master/assets/logo.svg\" width=\"90\"\u003e\n\n# Kreal\n\nKreal is a model sharing \u0026 RPC library built on and works with [Kemal](http://github.com/sdogruyol/kemal) seamlessly with slick debugging interface.\n\n## Simple Tutorial\n\n### 1. Create your remote models.\n\n```crystal\n# 1. Load Kreal!\nrequire \"kreal\"\n\n# 2. Create your class\nclass Maths\n  # Share your method to call remotely\n  share :square\n\n  # Remote method must have arguments.\n  def self.square(args)\n    args[0] * args[0]\n  end\nend\n\n# Register your remote procedure\nkreal Maths\n\n# Rest of your Kemal app...\nget \"/\" do\n  # do not forget to load scripts/kreal.js\nend\n\n# Do not forget to run Kemal.\nKemal.run\n```\n\n### 2. Use your models via JavaScript API.\n\nAdd this to your scripts:\n```html\n\u003cscript src=\"/scripts/kreal.js\"\u003e\u003c/script\u003e\n```\n\nCall your remote methods via **Kreal** magically.\n```js\n(new Kreal).connect(function (KR) {\n\n  // Call your function with a callback!\n  KR.Maths.square(2, function (result) {\n    console.log(result); // \"4\"\n  });\n\n});\n```\n\n## Example App\n\n```\ncrystal run ./example/example.cr\n```\n\nOpen [localhost:3000/kreal](http://localhost:3000/kreal)\n\n## Kreal Debugger\n\nKreal debugger enables itself when Kemal is on debug mode.\n\n![Debug](http://i.imgur.com/mNWxlg5.png)\n\n```\ncrystal build src/yourapp.cr\n\n# Use the parameters of Kemal since it's built on Kemal.\nyourapp -e development\n[development] Kemal is ready to lead at http://0.0.0.0:3000\n```\n\nNow you have a debugging view at [http://0.0.0.0:3000/kreal](http://0.0.0.0:3000/kreal)\n\n### Let's build a simple example\n\nLet's build a simple **OS bridge**!\n\n```crystal\nclass OSBridge\n  share :run\n\n  def self.run(args)\n    # Run command at os.\n    `#{args[0]}`\n  end\nend\n\nkreal OSBridge\n```\n\nDone!\n\nNow use it from your JavaScript! 👌\n\n\u003cimg src=\"http://i.imgur.com/GxTatWD.png\" width=\"550\"\u003e\n\n## Installation\n\nAdd this to your application's `shard.yml`:\n\n```yaml\ndependencies:\n  kreal:\n    github: f/kreal\n```\n\n## Contributing\n\n1. Fork it ( https://github.com/f/kreal/fork )\n2. Create your feature branch (git checkout -b my-new-feature)\n3. Commit your changes (git commit -am 'Add some feature')\n4. Push to the branch (git push origin my-new-feature)\n5. Create a new Pull Request\n\n## Contributors\n\n- [@f](https://github.com/f) Fatih Kadir Akın - creator, maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff%2Fkreal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ff%2Fkreal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff%2Fkreal/lists"}