{"id":15973423,"url":"https://github.com/BurntCaramel/lofi-schema-elm","last_synced_at":"2025-10-20T14:31:45.578Z","repository":{"id":57674712,"uuid":"86885336","full_name":"BurntCaramel/lofi-schema-elm","owner":"BurntCaramel","description":"Friendly syntax for creating schemas, output to Swift, React PropTypes, Elm, Golang, MongoDB, and more","archived":false,"fork":false,"pushed_at":"2018-03-02T05:59:38.000Z","size":559,"stargazers_count":5,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T21:53:07.463Z","etag":null,"topics":["elm","golang","joi","mongoose","mongoose-schema","mysql","proptypes","react","schema","swift"],"latest_commit_sha":null,"homepage":"https://schema.lofi.design","language":"JavaScript","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/BurntCaramel.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}},"created_at":"2017-04-01T05:04:55.000Z","updated_at":"2017-11-08T15:05:20.000Z","dependencies_parsed_at":"2022-09-11T18:21:01.581Z","dependency_job_id":null,"html_url":"https://github.com/BurntCaramel/lofi-schema-elm","commit_stats":null,"previous_names":["royalicing/lofi-schema-elm"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurntCaramel%2Flofi-schema-elm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurntCaramel%2Flofi-schema-elm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurntCaramel%2Flofi-schema-elm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurntCaramel%2Flofi-schema-elm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BurntCaramel","download_url":"https://codeload.github.com/BurntCaramel/lofi-schema-elm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237348772,"owners_count":19295418,"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":["elm","golang","joi","mongoose","mongoose-schema","mysql","proptypes","react","schema","swift"],"created_at":"2024-10-07T21:04:51.095Z","updated_at":"2025-10-20T14:31:40.216Z","avatar_url":"https://github.com/BurntCaramel.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# #lofi #schema in Elm\n\nLow fidelity schemas. Write with a friendly syntax and convert to other forms easily.\n\n## Interactive demo\n\nI’ve made an [online tool to convert #lofi schemas](https://schema.lofi.design/). Convert to React PropTypes, Mongoose schemas, Joi validations, and MySQL commands.\n\n## Basic usage\n\n```elm\nimport Html exposing (Html, section, h2, pre, text)\nimport Lofi.Parse exposing (parseElement)\nimport Lofi.Schema exposing (Schema, fromElement)\nimport Lofi.Schema.Output.MySQL as MySQL\nimport Lofi.Schema.Output.Mongoose as Mongoose\nimport Lofi.Schema.Output.Joi as Joi\nimport Lofi.Schema.Output.ReactProps as ReactProps\nimport Lofi.Schema.Output.Swift as Swift\nimport Lofi.Schema.Output.Elm as Elm\nimport Lofi.Schema.Output.Go as Go\n\ntype alias Model =\n  { collectionName : String\n  , individualName : String\n  , lines : List String\n  }\n\nmodel : Model\nmodel =\n  { collectionName = \"Users\"\n  , individualName = \"User\"\n  , lines =\n      [ \"First name\"\n      , \"Middle name #optional\"\n      , \"Last name #text #max: 255\"\n      , \"Email #email\"\n      , \"Date of birth #date\"\n      , \"Last signed in at #time #now\"\n      , \"Favorite number #number #default: 7\"\n      ]\n  }\n\nview : Model -\u003e Html Msg\nview model =\n  let\n    elements =\n      List.map parseElement model.lines\n\n    schema : Schema\n    schema =\n      { collectionName = model.collectionName\n      , individualName = model.individualName\n      , items = List.map fromElement elements\n      }\n  in\n    section []\n    [ article []\n      [ h2 [] [ text \"React PropTypes\" ]\n      , pre [] [ text (ReactProps.createPropTypesCode schema) ]\n      ]\n    , article []\n      [ h2 [] [ text \"Mongoose\" ]\n      , pre [] [ text (Mongoose.createModelCode schema) ]\n      ]\n    , article []\n      [ h2 [] [ text \"Swift\" ]\n      , pre [] [ text (Swift.createStructCode schema) ]\n      ]\n    , article []\n      [ h2 [] [ text \"Elm\" ]\n      , pre [] [ text (Elm.createTypeAliasCode schema) ]\n      ]\n    , article []\n      [ h2 [] [ text \"Golang\" ]\n      , pre [] [ text (Go.createStructCode schema) ]\n      ]\n    , article []\n      [ h2 [] [ text \"Joi\" ]\n      , pre [] [ text (Joi.createSchemaCode schema) ]\n      ]\n    , article []\n      [ h2 [] [ text \"MySQL\" ]\n      , pre [] [ text (MySQL.createTableCommand schema) ]\n      , pre [] [ text (MySQL.insertRowCommand schema) ]\n      ]\n    ]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBurntCaramel%2Flofi-schema-elm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBurntCaramel%2Flofi-schema-elm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBurntCaramel%2Flofi-schema-elm/lists"}