{"id":34616828,"url":"https://github.com/gws/clj-dynamodb-session","last_synced_at":"2026-05-29T09:31:51.517Z","repository":{"id":24505791,"uuid":"27911381","full_name":"gws/clj-dynamodb-session","owner":"gws","description":"A DynamoDB-backed Ring session store","archived":false,"fork":false,"pushed_at":"2017-02-17T02:20:28.000Z","size":44,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-26T03:41:58.366Z","etag":null,"topics":["clojure","dynamodb","session"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gws.png","metadata":{"files":{"readme":"README.markdown","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":"2014-12-12T08:09:41.000Z","updated_at":"2019-07-26T09:16:53.000Z","dependencies_parsed_at":"2022-08-23T00:00:58.880Z","dependency_job_id":null,"html_url":"https://github.com/gws/clj-dynamodb-session","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/gws/clj-dynamodb-session","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gws%2Fclj-dynamodb-session","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gws%2Fclj-dynamodb-session/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gws%2Fclj-dynamodb-session/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gws%2Fclj-dynamodb-session/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gws","download_url":"https://codeload.github.com/gws/clj-dynamodb-session/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gws%2Fclj-dynamodb-session/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33646421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"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":["clojure","dynamodb","session"],"created_at":"2025-12-24T14:41:18.272Z","updated_at":"2026-05-29T09:31:51.508Z","avatar_url":"https://github.com/gws.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clj-dynamodb-session\n\nA [DynamoDB](http://aws.amazon.com/dynamodb/)-backed\n[Ring](https://github.com/ring-clojure) session store.\n\n## Installation\n\n[![Clojars Project](https://clojars.org/gws/clj-dynamodb-session/latest-version.svg)](https://clojars.org/gws/clj-dynamodb-session)\n\n## Quick Start\n\nYou will need:\n\n- A DynamoDB table with a `HASH` key but no `RANGE` key.\n- For the purposes of the quick start, the key should be named `id` (the\n  default), but this can be specified in the configuration, so you can call\n  yours anything you want.\n\nRequire the library:\n\n```clojure\n(ns your.app\n  (:require [gws.middleware.session.dynamodb :as dynamodb]))\n```\n\nCreate the session store (if you are following along, make sure the region and\ntable name match your own):\n\n```clojure\n(def session-store\n     (dynamodb/dynamodb-store {:region \"us-west-2\"\n                               :table-name \"my-app-session\"}))\n```\n\nTell Ring to use your custom session store. If you are using\n[ring-defaults](https://github.com/ring-clojure/ring-defaults), you would do\nsomething like this:\n\n```clojure\n(def my-defaults\n  (-\u003e secure-site-defaults\n      (assoc-in [:session :store] session-store)))\n```\n\n## Configuration\n\nThe configuration map you pass to `dynamodb-store` is merged into the default\nconfiguration map. An explanation of each key is below:\n\n### `:client`\n\nIf you have a preconfigured Amazon DynamoDB client (using the Java SDK), you can\npass it in here. If it is set, `:region` and `:endpoint` will be ignored, as the\nclient is assumed to be configured.\n\n- Required: Yes (one of `:client`, `:endpoint`, or `:region` must be set)\n- Default: `nil`\n\n### `:region`\n\nThis is the AWS region to use. If this is set, `:endpoint` will be ignored.\n\n- Required: Yes (one of `:client`, `:endpoint`, or `:region` must be set)\n- Default: `nil`\n\n### `:endpoint`\n\nThis is the endpoint at which the DynamoDB service (or one just like it) will be\nlocated. This is useful for testing with the DynamoDB Local service. This will\nonly be used if `:client` and `:region` are not set.\n\n- Required: Yes (one of `:client`, `:endpoint`, or `:region` must be set)\n- Default: `\"http://localhost:8000\"`\n\n### `:table-name`\n\nThe name of the DynamoDB table.\n\n- Required: Yes\n- Default: `\"clj-dynamodb-session\"`\n\n### `:id-attribute-name`\n\nThis is the name of the \"primary key\" (`HASH`) attribute on the table, and will\ncontain the session key.\n\n- Required: Yes\n- Default: `\"id\"`\n\n### `:data-attribute-name`\n\nThis is the name of the attribute that will contain the Transit-serialized\nsession data.\n\n- Required: Yes\n- Default: `\"data\"`\n\n### `:custom-attributes`\n\nThis will contain a map of attribute name to 1-arity function. The function will\naccept the (deserialized) session data as its argument, and return an\n[AttributeValue](http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/dynamodbv2/model/AttributeValue.html)\nthat will be placed into the session item at that attribute when the item is\nwritten to the table. This way, we can natively support any data type supported\nby DynamoDB.\n\nThis is very useful if you, for example, want to add an application-specific\nuser ID to the session item (maybe to implement per-user session revocation), or\ntrack the session \"last-updated\" date for a job to come along later and scan the\ntable for old session data.\n\n- Required: Yes\n- Default: `nil`\n\nTo write your own, you might do something like this:\n\n```clojure\n(ns my.app\n  (:import [com.amazonaws.services.dynamodbv2.model AttributeValue]))\n\n; Assume `data` contains `{:my.app/user-id \"abc123\"}`\n(defn session-\u003euser-id\n  [data]\n  ; By default, this constructor signature will use the `String` type for the\n  ; data. You can supply any type you want, using `.with{X}` or `.set{X}` on the\n  ; object constructed with the 0-arity constructor. See the docs linked above\n  ; for more detail.\n  (AttributeValue. ^String (:my.app/user-id data)))\n```\n\nThen, to use it, you would place the following entry in your DynamoDB session\nstore options map:\n\n```clojure\n{... YOUR OTHER OPTIONS ...\n :custom-attributes {\"user_id\" session-\u003euser-id}}\n```\n\n## Testing\n\nCurrently, running the tests requires a live DynamoDB instance and the default\nis to use the endpoint at `http://localhost:8000`. There is a\n`docker-compose.yml` included in the repository to make this easier.\n\n1. `docker-compose up` (requires `docker-compose` 1.6.0 or later)\n2. `lein test`\n\n## License\n\nCopyright 2014 Gordon Stratton\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgws%2Fclj-dynamodb-session","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgws%2Fclj-dynamodb-session","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgws%2Fclj-dynamodb-session/lists"}