{"id":18423599,"url":"https://github.com/chadtech/elm-relational-database","last_synced_at":"2025-10-04T11:10:58.836Z","repository":{"id":57674546,"uuid":"182256584","full_name":"Chadtech/elm-relational-database","owner":"Chadtech","description":"Manage remote data with ids in your front end","archived":false,"fork":false,"pushed_at":"2019-04-22T15:01:21.000Z","size":29,"stargazers_count":9,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T15:46:04.963Z","etag":null,"topics":["elm","relational-databases"],"latest_commit_sha":null,"homepage":"https://package.elm-lang.org/packages/Chadtech/elm-relational-database/latest","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Chadtech.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":"2019-04-19T11:46:21.000Z","updated_at":"2024-02-21T01:04:25.000Z","dependencies_parsed_at":"2022-08-29T17:41:07.563Z","dependency_job_id":null,"html_url":"https://github.com/Chadtech/elm-relational-database","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/Chadtech/elm-relational-database","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chadtech%2Felm-relational-database","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chadtech%2Felm-relational-database/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chadtech%2Felm-relational-database/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chadtech%2Felm-relational-database/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Chadtech","download_url":"https://codeload.github.com/Chadtech/elm-relational-database/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chadtech%2Felm-relational-database/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276085259,"owners_count":25582514,"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","status":"online","status_checked_at":"2025-09-20T02:00:10.207Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["elm","relational-databases"],"created_at":"2024-11-06T04:37:54.611Z","updated_at":"2025-09-20T11:13:19.568Z","avatar_url":"https://github.com/Chadtech.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Elm Relational Database\n\nSome software projects involve the front end handling a large amount of unknown, dynamic and inter-related data, often retrieved from a remote source. Heres what I mean, taking a `User` as an example..\n\n- `Large` meaning, the front end might get a lot of `User`s.\n- `Unknown` meaning, it has no idea how many or what `User`s it will get\n- `Inter-related` meaning, `User`s might be related to other data, for example your software might let `User` be friends with each other. \n- `Dynamic` meaning, the `User`s and their relationship might change over time. A new `User` might show up, or, two existing `User`s might become friends with each other during or between run times.\n\nProjects like this need a centralized single source of truth for all this data, so so that your data can be represented the same across the entire software. Indeed, thats exactly what a relational database is. \n```elm\nimport Db exposing (Db)\n\ntype alias Model =\n    { users : Db User }\n```\n[If you still are wondering what the deal is, Richard Feldman gave a really good talk on relational database stuff in Elm.](https://www.youtube.com/watch?v=28OdemxhfbU)\n\n\n\n## Message Board Example\n\n```elm\nimport Db exposing (Db)\nimport Id exposing (Id)\n\ntype alias Model =\n    { threads : Db Thread\n    , posts : Db Post\n    }\n\n\ntype alias Thread =\n    { title : String\n    , posts : List (Id Post)\n    }\n\n\ntype alias Post =\n    { author : String\n    , content : String\n    }\n\n\n-- ..\n\nthreadView : Db Post -\u003e (Id Thread, Thread) -\u003e Html Msg\nthreadView postsDb (threadId, thread) =\n    let\n        posts : List (Html Msg)\n        posts =\n            thread.posts\n                |\u003e Db.getMany postsDb\n                |\u003e Db.filterMissing \n                |\u003e List.map postView\n    in\n    Html.div [ css [ threadStyle ] ]\n        (Html.p [] [ Html.text thread.title ] :: posts)\n\n\npostView : (Id Post, Post) -\u003e Html Msg\npostView (id, post) =\n    Html.div\n        [ Attrs.css [ postStyle ] ]\n        [ Html.p\n            []\n            [ Html.text post.author ]\n        , Html.p\n            [ Event.onClick (ReplyToPostClicked id) ]\n            [ Html.text post.content ]\n        ]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchadtech%2Felm-relational-database","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchadtech%2Felm-relational-database","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchadtech%2Felm-relational-database/lists"}