{"id":16573671,"url":"https://github.com/dkarter/cookie_monster","last_synced_at":"2025-08-10T13:20:59.062Z","repository":{"id":57485761,"uuid":"274589218","full_name":"dkarter/cookie_monster","owner":"dkarter","description":"🍪 HTTP Cookie Encoder and Decoder in pure Elixir with zero runtime dependencies.","archived":false,"fork":false,"pushed_at":"2024-01-09T04:13:13.000Z","size":1102,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-09-14T07:50:54.857Z","etag":null,"topics":["cookie","cookies","elixir","erlang","http","phoenix","phoenix-framework"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/dkarter.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}},"created_at":"2020-06-24T06:09:25.000Z","updated_at":"2024-06-18T14:38:01.000Z","dependencies_parsed_at":"2023-11-10T12:08:49.778Z","dependency_job_id":null,"html_url":"https://github.com/dkarter/cookie_monster","commit_stats":{"total_commits":24,"total_committers":1,"mean_commits":24.0,"dds":0.0,"last_synced_commit":"902e620bcf5128da8df16983828249d64dd91a6b"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkarter%2Fcookie_monster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkarter%2Fcookie_monster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkarter%2Fcookie_monster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkarter%2Fcookie_monster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dkarter","download_url":"https://codeload.github.com/dkarter/cookie_monster/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219858495,"owners_count":16556043,"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":["cookie","cookies","elixir","erlang","http","phoenix","phoenix-framework"],"created_at":"2024-10-11T21:42:47.157Z","updated_at":"2024-10-11T21:42:47.691Z","avatar_url":"https://github.com/dkarter.png","language":"Elixir","readme":"# CookieMonster\n\n![Build Status](https://github.com/dkarter/cookie_monster/actions/workflows/elixir.yml/badge.svg) [![Hex.pm](https://img.shields.io/hexpm/v/cookie_monster)](https://hex.pm/packages/cookie_monster)\n\nA simple HTTP Cookie encoder and decoder in pure Elixir with zero runtime dependencies![^1].\n\n![cookie monster logo](https://github.com/dkarter/cookie_monster/raw/main/img/cookie_monster.png)\n\n## Motivation\n\nI recently worked on an app that needed to parse cookies. Initially I reached\nout for [Plug](https://hex.pm/packages/plug)'s implementation to encode\nand decode the cookies, but that meant bringing in a (relatively) large dependency just to use a small portion of it (my application was not web facing).\n\nAnother issue I had with Plug's implementation is that it used the name of the cookie as a map key in the decoding result:\n\n```elixir\n\"hello=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; HttpOnly; Secure\"\n|\u003e Plug.Conn.Cookies.decode()\n\n# =\u003e %{\"Expires\" =\u003e \"Wed, 21 Oct 2015 07:28:00 GMT\", \"hello\" =\u003e \"a3fWa\"}\n```\n\nI wanted something a little simpler, and dependency free that makes it easy to extract the name and\nvalue. As a bonus, I wanted to decode the date into an Elixir native DateTime\nso that I can easily check if a cookie is expired.\n\n## Example\n\n#### Encoding\n\n```elixir\nalias CookieMonster.Cookie\n\n%Cookie{\n  name: \"id\",\n  value: \"a3fWa\",\n  expires: ~U[2015-10-21 07:28:00Z],\n  http_only: true,\n  secure: true\n}\n|\u003e CookieMonster.encode!()\n\n# =\u003e \"id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; HttpOnly; Secure\"\n```\n\n#### Decoding\n\n```elixir\nalias CookieMonster.Cookie\n\n\"id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; HttpOnly; Secure\"\n|\u003e CookieMonster.decode!()\n\n# =\u003e %Cookie{name: \"id\", value: \"a3fWa\", expires: ~U[2015-10-21 07:28:00Z], http_only: true, secure: true}\n```\n\n## Installation\n\nThe package can be installed by adding `cookie_monster` to your list of\ndependencies in `mix.exs`:\n\n\u003c!-- x-release-please-start-version --\u003e\n\n```elixir\ndef deps do\n  [\n    {:cookie_monster, \"~\u003e 1.1.6\"}\n  ]\nend\n```\n\n\u003c!-- x-release-please-end-version --\u003e\n\nThe docs can be found at [https://hexdocs.pm/cookie_monster](https://hexdocs.pm/cookie_monster).\n\n[^1]: Boundary is listed as a dependency, but it is not a runtime dependency and only used during compile time to ensure proper design\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkarter%2Fcookie_monster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdkarter%2Fcookie_monster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkarter%2Fcookie_monster/lists"}