{"id":13776611,"url":"https://github.com/commanded/commanded-audit-middleware","last_synced_at":"2025-04-10T20:32:39.246Z","repository":{"id":57484801,"uuid":"75287313","full_name":"commanded/commanded-audit-middleware","owner":"commanded","description":"Command auditing middleware for Commanded CQRS/ES applications","archived":false,"fork":false,"pushed_at":"2024-06-19T19:11:46.000Z","size":55,"stargazers_count":39,"open_issues_count":4,"forks_count":17,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-29T22:37:26.629Z","etag":null,"topics":["command-auditing-middleware","cqrs","cqrs-es","cqrs-framework"],"latest_commit_sha":null,"homepage":null,"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/commanded.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2016-12-01T11:44:07.000Z","updated_at":"2024-08-14T17:33:31.000Z","dependencies_parsed_at":"2024-11-09T16:35:55.638Z","dependency_job_id":null,"html_url":"https://github.com/commanded/commanded-audit-middleware","commit_stats":{"total_commits":45,"total_committers":7,"mean_commits":6.428571428571429,"dds":0.4222222222222223,"last_synced_commit":"488b77bac82ac795206a589276391108c4cd9264"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commanded%2Fcommanded-audit-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commanded%2Fcommanded-audit-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commanded%2Fcommanded-audit-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commanded%2Fcommanded-audit-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commanded","download_url":"https://codeload.github.com/commanded/commanded-audit-middleware/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230715563,"owners_count":18269623,"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":["command-auditing-middleware","cqrs","cqrs-es","cqrs-framework"],"created_at":"2024-08-03T18:00:30.089Z","updated_at":"2024-12-21T19:07:28.747Z","avatar_url":"https://github.com/commanded.png","language":"Elixir","readme":"# Commanded audit middleware\n\nCommand auditing middleware for [Commanded](https://github.com/commanded/commanded) CQRS/ES applications.\n\nRecords every dispatched command to the configured database storage. Includes whether the command was successfully handled, or any error.\n\nPlease refer to the [CHANGELOG](CHANGELOG.md) for features, bug fixes, and any upgrade advice included for each release.\n\nMIT License\n\n[![Build Status](https://travis-ci.com/commanded/commanded-audit-middleware.svg?branch=master)](https://travis-ci.com/commanded/commanded-audit-middleware)\n\n---\n\n## Getting started\n\n1. Add `commanded_audit_middleware` to your list of dependencies in `mix.exs`:\n\n   ```elixir\n   def deps do\n     [\n       {:commanded_audit_middleware, \"~\u003e 1.0\"}\n     ]\n   end\n   ```\n\n2. Add the following config section to `config/config.exs`:\n\n   ```elixir\n   config :commanded_audit_middleware,\n     ecto_repos: [Commanded.Middleware.Auditing.Repo],\n     serializer: Commanded.Serialization.JsonSerializer\n   ```\n\n   If you prefer to instead serialize the `command_audit`'s `data` and `metadata` columns as [JSONB](https://www.postgresql.org/docs/current/datatype-json.html) (which [can be indexed and queried efficiently](https://www.postgresql.org/docs/current/functions-json.html)), choose an Ecto schema type of `:map` and a PostgreSQL database type of `:jsonb`:\n\n   ```elixir\n   config :commanded_audit_middleware,\n     ecto_repos: [Commanded.Middleware.Auditing.Repo],\n     serializer: EventStore.JsonbSerializer,\n     data_column_schema_type: :map,\n     metadata_column_schema_type: :map,\n     data_column_db_type: :jsonb,\n     metadata_column_db_type: :jsonb\n   ```\n\n3. By default, `commanded_audit_middleware` should filter all `password`, `password_confirmation` and `secret` in your schemas. If you want to **override** and define your own filters, you should add the following to your `config/config.exs`:\n\n   ```elixir\n   config :commanded_audit_middleware,\n     filter_fields: [:credit_card_number, :btc_private_key]\n   ```\n\n4. Add the following config section to each environment's config (e.g. `config/dev.exs`):\n\n   ```elixir\n   config :commanded_audit_middleware, Commanded.Middleware.Auditing.Repo,\n     adapter: Ecto.Adapters.Postgres,\n     database: \"commanded_audit_middleware_dev\",\n     username: \"postgres\",\n     password: \"postgres\",\n     hostname: \"localhost\",\n     port: \"5432\"\n   ```\n\n5. Fetch and compile mix dependencies:\n\n   ```console\n   $ mix do deps.get, deps.compile\n   ```\n\n6. Create and migrate the command audit database:\n\n   ```console\n   $ mix ecto.create -r Commanded.Middleware.Auditing.Repo\n   $ mix ecto.migrate -r Commanded.Middleware.Auditing.Repo\n   ```\n\n7. Add the middleware to any Commanded router.\n\n   ```elixir\n   defmodule Router do\n     use Commanded.Commands.Router\n\n     middleware(Commanded.Middleware.Auditing)\n   end\n   ```\n\n### Contributing\n\nPull requests to contribute new or improved features, and extend documentation are most welcome. Please follow the existing coding conventions.\n\nYou should include unit tests to cover any changes. Run `mix test` to execute the test suite:\n\n```console\nmix deps.get\nmix test\n```\n\n### Contributors\n\n- [Ben Smith](https://github.com/slashdotdash)\n- [CptBreeza](https://github.com/CptBreeza)\n- [Daniel Chambers](https://github.com/hoodsuphopeshigh)\n- [Iuri L. Machado](https://github.com/imetallica)\n- [James Lavin](https://github.com/JamesLavin)\n- [Mikhail Karavaev](https://github.com/mkaravaev)\n","funding_links":[],"categories":["Libraries"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommanded%2Fcommanded-audit-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommanded%2Fcommanded-audit-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommanded%2Fcommanded-audit-middleware/lists"}