{"id":29213882,"url":"https://github.com/climatemargo/margoapi.jl","last_synced_at":"2025-08-01T05:04:46.005Z","repository":{"id":56042547,"uuid":"272107994","full_name":"ClimateMARGO/MargoAPI.jl","owner":"ClimateMARGO","description":null,"archived":false,"fork":false,"pushed_at":"2021-01-20T13:25:50.000Z","size":109,"stargazers_count":6,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-26T13:53:51.413Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Julia","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/ClimateMARGO.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}},"created_at":"2020-06-14T00:36:31.000Z","updated_at":"2022-06-02T21:03:55.000Z","dependencies_parsed_at":"2022-08-15T12:00:59.888Z","dependency_job_id":null,"html_url":"https://github.com/ClimateMARGO/MargoAPI.jl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ClimateMARGO/MargoAPI.jl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClimateMARGO%2FMargoAPI.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClimateMARGO%2FMargoAPI.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClimateMARGO%2FMargoAPI.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClimateMARGO%2FMargoAPI.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ClimateMARGO","download_url":"https://codeload.github.com/ClimateMARGO/MargoAPI.jl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClimateMARGO%2FMargoAPI.jl/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263229087,"owners_count":23434003,"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":"2025-07-02T23:05:31.562Z","updated_at":"2025-07-02T23:05:35.718Z","avatar_url":"https://github.com/ClimateMARGO.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MargoAPI.jl\n\n## _Interactive web-based articles for [ClimateMARGO.jl](https://github.com/ClimateMARGO/ClimateMARGO.jl)_\n\nHave a look at our [Observable page](https://observablehq.com/@margo)!\n\n![margo](https://user-images.githubusercontent.com/6933510/100540548-37c5c080-323e-11eb-9a0c-aab28772792d.gif)\n\n## Backend\n\nThis repository contains the \"backend\" for our interactive articles written in [Observable](https://observablehq.com/@margo). It imports the ClimateMARGO.jl package, and wraps its important functionality in API functions.\n\nThis repository is deployed online using heroku. See [the API client notebook](https://observablehq.com/@margo/api) to learn more.\n\n## Technology\n\nPowering this API is a _super fast \u0026 simple_ web framework for Julia. Write functions that take _keyword arguments_ and return _simple objects_.\n\n```julia\n@expose function wow(;a, b)\n    Dict(\n        :sum =\u003e a + b,\n        :diff =\u003e a - b,\n    )\nend\n```\n\nYou can then use them inside JavaScript:\n\n```js\nsendreceive(\"wow\", {\n    a: 7,\n    b: 6,\n}).then((val) =\u003e {\n    console.log(val.sum)\n    console.log(val.diff)\n})\n```\n\nIt was created by stripping down [Pluto.jl](https://github.com/fonsp/Pluto.jl) to just its communication code.\n\n#### Features\n\nIt uses _WebSockets_ for optimal ping time (2ms on `localhost`) and _MessagePack_ for minimal (de)serialization overhead and minimal bandwidth usage. (A round trip to a Julia function returning a 1M-element `Array{UInt8}` is about 20ms - you could stream uncompressed 512x512 images at 60fps 😮.) We also have automatic timeout and reconnect.\n\n## Heroku deployment\n\n### Updating the deployment\n\nWe currently have two deployments:\n\n-   **master** ([link to app](https://margo-api-test-1.herokuapp.com/)), [link to heroku for Fons \u0026 Henri](https://dashboard.heroku.com/apps/margo-api-test-1));\n-   **staging** for the WIP latest updates ([link to app](https://margo-api-staging.herokuapp.com/), [link to heroku for Fons \u0026 Henri](https://dashboard.heroku.com/apps/margo-api-staging)).\n\nThese correspond to two branches of this repository with the same names.\n\nTo update the web app at heroku, we simply _push a commit to the branch_. The\n\n_For more background on deploying Julia apps on heroku, I wrote this guide, intended for a more general audience: [fonsp/How to put Julia on heroku.md ](https://gist.github.com/fonsp/38965d7595a5d1060e27d6ca2084778d)._\n\n### Creating a new deployment\n\nRead the guide above for some basics. Some notes specific for this project:\n\n-   You need to set a \"Config Var\" in the _Settings_ page of your heroku app: `JULIA_MARGO_LOAD_PYPLOT` with value `nothanks`. Trigger a rebuild afterwards by committing. [more info](https://github.com/ClimateMARGO/ClimateMARGO.jl/pull/53)\n-   We tried to minimize Julia's compile time for the first request, but you will still benefit from using a \"Hobby Dyno\" (7$/month) instead of a free dyno.\n\n## Running locally\n\nClone the repository, navigate to this folder, and then:\n\n```\njulia --project run_server.jl 127.0.0.1 2345\n```\n\nThen go to `http://localhost:2345/index.html` in your browser. This is only really useful to check for errors, since it does not include the visualisations. To connect an observable notebook to a local running instance of the server, you can use `ngrok`. In a second terminal, install ngrok and run:\n\n```\n./ngrok http 2345\n```\n\nYou can then change the cell `margo_url` in the notebook to the https url that gave you, instead of the default. Contact me (fons) for more info.\n\n# Contact\n\nIf any of this is interesting to you, get in touch!\n\n— Henri Drake ([hdrake](https://github.com/hdrake)) \u0026 Fons van der Plas ([fonsp](https://github.com/fonsp))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclimatemargo%2Fmargoapi.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclimatemargo%2Fmargoapi.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclimatemargo%2Fmargoapi.jl/lists"}