{"id":13507981,"url":"https://github.com/bitgamma/crudex","last_synced_at":"2025-12-11T23:43:10.732Z","repository":{"id":25315371,"uuid":"28742135","full_name":"bitgamma/crudex","owner":"bitgamma","description":"CRUD utilities for Phoenix and Ecto","archived":false,"fork":false,"pushed_at":"2015-03-17T15:00:46.000Z","size":384,"stargazers_count":20,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-11T19:25:55.254Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/bitgamma.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":"2015-01-03T11:33:26.000Z","updated_at":"2023-09-01T10:57:18.000Z","dependencies_parsed_at":"2022-08-06T04:01:03.577Z","dependency_job_id":null,"html_url":"https://github.com/bitgamma/crudex","commit_stats":null,"previous_names":["briksoftware/crudex"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/bitgamma/crudex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitgamma%2Fcrudex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitgamma%2Fcrudex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitgamma%2Fcrudex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitgamma%2Fcrudex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitgamma","download_url":"https://codeload.github.com/bitgamma/crudex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitgamma%2Fcrudex/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267179129,"owners_count":24048285,"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-07-26T02:00:08.937Z","response_time":62,"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":[],"created_at":"2024-08-01T02:00:44.905Z","updated_at":"2025-12-11T23:43:10.665Z","avatar_url":"https://github.com/bitgamma.png","language":"Elixir","funding_links":[],"categories":["Framework Components"],"sub_categories":[],"readme":"# Crudex\n\nA glue keeping Phoenix and Ecto together. It has the following features:\n\n* JSON-encoding/decoding of Ecto models\n* Dynamic virtual fields for models\n* Simplifies creation of CRUD controllers\n* User controller for login.\n\n## Crudex.Model\n\nBy using the Crudex.Model module, like this:\n\n```elixir\ndefmodule MyModel do\n  use Crudex.Model\nend\n```\n\nYou make your model JSON-encodable using Poison. You should also use `Ecto.UUID`, `Crudex.JSONBinary`, `Ecto.DateTime` instead of `:uuid`, `:binary`, and `:datetime` in your model respectively.\n\nThe Crudex.Model also provides the following macros:\n\n* `crudex_schema` =\u003e is like `schema` from Ecto.Model but defines ID/foreign keys to be UUID and creates timestamps. You should use this if you want to use the CRUD controller functionalities. It also allows using the two macros below\n* `hidden_field` =\u003e creates a regular field which will be excluded when encoding\n\n### Example\n```elixir\ndefmodule Example.User do\n  use Crudex.Model\n\n  crudex_schema \"users\" do \n    field :name, :string   \n    field :surname, :string   \n    field :email, :string\n    hidden_field :salt, Crudex.JSONBinary\n    hidden_field :password, Crudex.JSONBinary\n    field :role, :string\n  end\n    \n  ...\nend\n```\n\n## Crudex.CrudController\n\nAllows automatic creation of complete or partial CRUD controllers. It even supports user scoping, assuming your model has a `user_id` field.\n\nIt has two macros\n\n* `crud_for` =\u003e creates CRUD actions for the given model. Optionally you can specify which actions should be created.\n* `defcrud` =\u003e defines a single CRUD action for the given model.\n\n### Example\n\n```elixir\ndefmodule BookController do\n  use Crudex.CrudController\n\n  plug PlugAuth.Authentication.Token, [source: :params, param: \"auth_token\"]\n  plug :action\n\n  @ecto_repo MyRepo\n  @user_scoped true\n  crud_for(Book)\nend\n```\n\nAssuming you have a `Book` model, you will get the `:index, :create, :show, :update, :delete` actions created for you. Since `@user_scoped` is set to `true`, all actions will only be applicable for the user currently logged in. This works best in conjunction with plug_auth.\n\n## Crudex.UserController\nProvides a macro, `user_controller` to define a simple user controller. Access control should happen in the controller invoking this macro, using for example plug_auth. It is not very flexible for now, and is more there to show you how to do a complex controller with Crudex.\n\n## TODO\nThere is a lot to do, pagination and filtering is one of the first things. Tests are missing although I have tests in the projects where I use this. Documentation in the code is also missing for now.\n\n## LICENSE\nCopyright (c) 2014, Michele Balistreri \u003cmichele@briksoftware.com\u003e\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted, provided that the above\ncopyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\nWITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\nANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\nACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\nOR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitgamma%2Fcrudex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitgamma%2Fcrudex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitgamma%2Fcrudex/lists"}