Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/earldouglas/sectery
A digital assistant chatbot
https://github.com/earldouglas/sectery
Last synced: 12 days ago
JSON representation
A digital assistant chatbot
- Host: GitHub
- URL: https://github.com/earldouglas/sectery
- Owner: earldouglas
- License: mit
- Created: 2015-01-11T02:06:36.000Z (almost 10 years ago)
- Default Branch: main
- Last Pushed: 2024-10-20T19:45:04.000Z (23 days ago)
- Last Synced: 2024-10-22T01:41:42.365Z (22 days ago)
- Language: Scala
- Homepage:
- Size: 1.12 MB
- Stars: 0
- Watchers: 3
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
[![Build Status][build-badge]][build-link]
[build-badge]: https://github.com/earldouglas/sectery/workflows/build/badge.svg "Build Status"
[build-link]: https://github.com/earldouglas/sectery/actions "GitHub Actions"# Sectery
Sectery is an digital assistant chatbot.
## Usage
To run Sectery, you'll need API keys for
[Finnhub](https://finnhub.io/docs/api), [Dark
Sky](https://darksky.net/dev), [AirNow](https://docs.airnowapi.org/),
and [OpenAI](https://platform.openai.com/docs/quickstart/api-keys).To start Sectery, first set a bunch of configuration variables, then run
the two main classes with `sbt run`:```
$ export RABBIT_MQ_HOSTNAME=localhost
$ export RABBIT_MQ_PORT=5672
$ export RABBIT_MQ_USERNAME=guest
$ export RABBIT_MQ_PASSWORD=guest
$ export DATABASE_URL=jdbc:mysql://username:password@host:port/dbname
$ export FINNHUB_API_TOKEN=my_finnhub_api_token
$ export OPEN_WEATHER_MAP_API_KEY=my_open_weather_map_api_key
$ export AIRNOW_API_KEY=my_airnow_api_key
$ export OPENAI_APIKEY=my_openai_api_key
$ sbt "project producers" run
``````
$ export RABBIT_MQ_HOSTNAME=localhost
$ export RABBIT_MQ_PORT=5672
$ export RABBIT_MQ_USERNAME=guest
$ export RABBIT_MQ_PASSWORD=guest
$ export IRC_HOST=irc.libera.chat
$ export IRC_PORT=7000
$ export IRC_USER=my_nick
$ export IRC_PASS=my_password
$ export IRC_CHANNELS=#my_channel
$ sbt "project irc" run
``````
$ export RABBIT_MQ_HOSTNAME=localhost
$ export RABBIT_MQ_PORT=5672
$ export RABBIT_MQ_USERNAME=guest
$ export RABBIT_MQ_PASSWORD=guest
$ export SLACK_BOT_TOKEN=xoxb-foo-bar-baz
$ export SLACK_APP_TOKEN=xapp-1-foo-bar-baz
$ sbt "project slack" run
```## Development
See [CONTRIBUTING.md](CONTRIBUTING.md).
## Architecture
### Layers
Sectery's code is organized as layered modules with both shared and
disjoint compile-time visibility. Each layer has access to the layers
beneath.```
.----------------------------------------------------------------------.
| Layer 5 |
| |
| irc slack producers |
| |
| o (ZIO) |
'-|--------------------------------------------------------------------'
|
.-|--------------------------------------------------------------------.
| v Layer 4 |
| | |
| | adaptors adaptors-with-zio |
| | |
| | o (implementations of L2 effects) |
'-|-|------------------------------------------------------------------'
| |
| | impure
==|=|===================================================================
| | pure
| |
.-|-|------------------------------------------------------------------.
| v v Layer 3 |
| | | |
| | | use cases |
| | | | | |
| | | responders <---------' '---------> announcers |
| | | o |
'-|-|-|----------------------------------------------------------------'
| | |
.-|-|-|----------------------------------------------------------------.
| v v v Layer 2 |
| | | | |
| | | | effects |
| | | | o |
'-|-|-|-|--------------------------------------------------------------'
| | | |
.-|-|-|-|--------------------------------------------------------------.
| v v v v Layer 1 |
| |
| domain |
| | | |
| entities <---------' '---------> operations |
| |
'----------------------------------------------------------------------'
```Layers 1 through 3 are all pure functions and data structures modelling
the domain, business rules, and effects.Layers 4 and 5 both impure, with effects implementations underneath ZIO
to wire everything together.### Message queue
Modules interact with each other via RabbitMQ:
```
.------------.
/ \ \
.-----------------> | inbox |=================..
| \ / / ||
| '------------' vv
.-------. .-------------.
| irc | | producers |-.
'-------'-. '-------------' |-.
| slack | '-------------' |
'-------' '-------------'
^ .------------. ||
| / / \ ||
'---------------| outbox | <===================''
\ \ /
'------------'
```### External dependencies
Modules access various internal and external resources:
```
.-----. .------------.
| irc |-------->| IRC Server |
'-----' '------------'.-------. .-----------.
| slack |------>| Slack API |
'-------' '-----------'.-----------. .----------------.
| producers |-.======>| 3rd party APIs |-.
'-----------' |-. '----------------' |-.
'-----------' | '----------------' |
'-----------' '----------------'
||
|| .-------.
''==========>| RDBMS |
'-------'
```