https://github.com/martenframework/marten-db-session
A database session store for the Marten web framework.
https://github.com/martenframework/marten-db-session
crystal db framework marten session web
Last synced: 8 months ago
JSON representation
A database session store for the Marten web framework.
- Host: GitHub
- URL: https://github.com/martenframework/marten-db-session
- Owner: martenframework
- License: mit
- Created: 2022-04-30T17:20:03.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-08-07T01:02:48.000Z (over 1 year ago)
- Last Synced: 2024-08-07T03:35:44.595Z (over 1 year ago)
- Topics: crystal, db, framework, marten, session, web
- Language: Crystal
- Homepage:
- Size: 56.6 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Marten DB Session
[](https://github.com/martenframework/marten-db-session/tags)
[](https://github.com/martenframework/marten-db-session/blob/main/LICENSE)
[](https://github.com/martenframework/marten-db-session/actions)
[](https://github.com/martenframework/marten-db-session/actions)
**Marten DB Session** provides a database [session store](https://martenframework.com/docs/handlers-and-http/sessions#session-stores) for the Marten web framework.
## Installation
Simply add the following entry to your project's `shard.yml`:
```yaml
dependencies:
marten_db_session:
github: martenframework/marten-db-session
```
And run `shards install` afterward.
Once installed you can configure your project to use the database session store by following these steps:
First, add the following requirement to your project's `src/project.cr` file:
```crystal
require "marten_db_session"
```
Secondly, add the following requirement to the top-level `manage.cr` file in order to make Marten DB Session Store migrations available to your project:
```crystal
require "marten_db_session/cli"
```
Then, add the `MartenDBSession::App` app class to your project's `installed_apps` setting and ensure that your `sessions.store` setting is set to `:db`:
```crystal
Marten.configure do |config|
# Other settings...
config.installed_apps = [
MartenDBSession::App,
# Other apps..
]
config.sessions.store = :db
end
```
Finally, run the `marten migrate` command in order to install the DB session entry model.
_Congrats! You’re in!_ From now on, your session data will be persisted in a `marten_db_session_store_entry` table.
## Authors
Morgan Aubert ([@ellmetha](https://github.com/ellmetha)) and
[contributors](https://github.com/martenframework/marten-db-session/contributors).
## License
MIT. See ``LICENSE`` for more details.