{"id":21451195,"url":"https://github.com/lenra-io/template-elixir","last_synced_at":"2026-05-19T00:35:20.966Z","repository":{"id":115590418,"uuid":"544912789","full_name":"lenra-io/template-elixir","owner":"lenra-io","description":"Elixir template to start your Lenra app","archived":false,"fork":false,"pushed_at":"2023-07-31T08:10:21.000Z","size":27,"stargazers_count":0,"open_issues_count":9,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-17T02:44:39.236Z","etag":null,"topics":["app","cloud-computing","data-management","elixir","ui"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/lenra-io.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},"funding":{"github":["lenra-io"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2022-10-03T13:03:28.000Z","updated_at":"2022-12-16T13:15:56.000Z","dependencies_parsed_at":"2025-01-23T12:36:19.616Z","dependency_job_id":null,"html_url":"https://github.com/lenra-io/template-elixir","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lenra-io/template-elixir","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenra-io%2Ftemplate-elixir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenra-io%2Ftemplate-elixir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenra-io%2Ftemplate-elixir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenra-io%2Ftemplate-elixir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lenra-io","download_url":"https://codeload.github.com/lenra-io/template-elixir/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenra-io%2Ftemplate-elixir/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33196185,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T09:27:30.708Z","status":"ssl_error","status_checked_at":"2026-05-18T09:27:28.300Z","response_time":71,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["app","cloud-computing","data-management","elixir","ui"],"created_at":"2024-11-23T04:19:07.591Z","updated_at":"2026-05-19T00:35:20.951Z","avatar_url":"https://github.com/lenra-io.png","language":"Elixir","funding_links":["https://github.com/sponsors/lenra-io"],"categories":[],"sub_categories":[],"readme":"# template-elixir\n[Elixir](https://github.com/elixir-lang/elixir) template to boostrap Lenra app\n\n## Get Started !\n\n### Requirements*\n\n- [x] docker\n- [x] docker-compose\n- [ ] buildkit\n- [x] lenra_cli\n\n_*Unchecked value is optional_\n\n\n### How to install `lenra_cli`\n\nYou need to install the Lenra CLI to start the devtools that will show your app.\n\nTo download it, you can use cargo or download the binary via the [latest github release assets](https://github.com/lenra-io/lenra_cli/releases)\n\nFrom cargo you need to run the following command :\n\n```bash\ncargo install lenra_cli --version=1.0.0-beta.5\n# or `cargo install lenra_cli@1.0.0-beta.5`\n```\n\nWhen installed you can run the binary file\n\n```bash\nlenra --version\n```\n\n### Building and debugging your app\n\nTo build your app, you can run the `lenra build` command that will build the docker container\n```bash\nlenra build\n```\n\nThe `lenra start` command will start all needed services to make your app ready and then open your browser so you can start debugging.\n\n```bash\nlenra start\n```\n\nWhen everything is fine, you can stop your app by running the `lenra stop` command. That will interrupt all current running services about your app. And delete all data from your app to be able to keep your test clean.\n\n```bash\nlenra stop\n```\n\n\n## Using the Elixir template\n\nThe `server` directory is where all the boilerplate is stored. It creates and start the server that will serve your widget and listeners. You don't need to understand/change the code in this directory.\nThe `app` directory is where your app lives. You can add/remove/update files the way you want in this directory with some exceptions : \n- The `Manifest` module should only be updated to add/remove routes.\n- The `Resources` module serve your static files (image mainly). Don't change this unless you want to serve files dynamically (generate images on the fly, get images from an outside server, etc.)\n\n### Create your widgets\n\nTo create your widget, simply create a new module under lib/app/widgets (or anywher else, but stay organized !).\nThen create a new function in this module and add the `@name` annotation to register and name your widget.\nYou also can bind the data and props arguments to struct using the `@data_struct` and `@props_struct` annotations respectively. Otherwise, they will be simple map.\n\nYou can then call your widget using the generated function in others widgets `MyWidget.new_\u003cwidget_name\u003e()`.\n\nExample : \n```elixir\ndefmodule App.Widgets.Counter do\n  use Widgets\n\n  alias App.Listeners.CounterListeners\n  alias App.Counters.Counter\n  alias App.Props.{Text, Id}\n\n  @name \"counter\"\n  @data_struct Counter\n  @props_struct Text\n  def counter_w([%Counter{} = counter], %Text{} = props, _context) do\n    %{\n      \"children\" =\u003e [\n        %{\"type\" =\u003e \"text\", \"value\" =\u003e \"#{props.text} : #{counter.value}\"},\n        %{\n          \"onPressed\" =\u003e CounterListeners.new_increment(props: %Id{_id: counter._id}),\n          \"text\" =\u003e \"+\",\n          \"type\" =\u003e \"button\"\n        }\n      ],\n      \"crossAxisAlignment\" =\u003e \"center\",\n      \"mainAxisAlignment\" =\u003e \"spaceEvenly\",\n      \"spacing\" =\u003e 2,\n      \"type\" =\u003e \"flex\"\n    }\n  end\nend\n```\n\n### Create your Listeners\nSame principle with the listeners. Simply create your module under the `lib/app/listeners` directory.\nThen create a new function with the `@action` annotation to register and name your listener.\nSame thing with the listeners, you can bind the props argument using the `@props_struc` annotation.\n\nExample :\n```elixir\ndefmodule App.Listeners.CounterListeners do\n  use Listeners\n  alias App.Props.Id\n\n  @action \"increment\"\n  @props_struct Id\n  def increment(%Id{} = props, _event, api) do\n    App.Counters.increment(api, props._id)\n  end\nend\n```\n\n### The data API \nIn your listener, you will want to call the Data API to change your model.\nTo do this, use the `Api.DataApi` module.\n\nYou can bind the return value of the data API into a struct to have typed value. To do this, simply add the `as: MyStruct` option.\n\nExample : \n```elixir\nApi.DataApi.get_doc(api, \"counters\", id, as: App.Counters.Counter)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flenra-io%2Ftemplate-elixir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flenra-io%2Ftemplate-elixir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flenra-io%2Ftemplate-elixir/lists"}