Skip to content

Commit

Permalink
feat: ✨ initial setup to Message Pickup Repository gateway (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmatau79 authored Oct 16, 2024
1 parent 3359049 commit bbf5f20
Show file tree
Hide file tree
Showing 48 changed files with 27,291 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js', 'packages/client/src/index.d.ts'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
}
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Continuous Integration

on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened, labeled]
push:
branches: [main]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout message-pickup-repository
uses: actions/checkout@v4

- name: Setup node v22
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install dependencies
run: |
yarn install
- name: Check Format
run: |
yarn format
- name: Check Types
run: |
yarn check-types
- name: Build
run: |
yarn build
- name: Unit tests
run: |
yarn test
- name: E2E tests
run: |
yarn test:e2e
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# compiled output
/dist
/node_modules

# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# OS
.DS_Store

# Tests
/coverage
/.nyc_output

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# Tools
/databases

#files
package-lock.json
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 120,
"semi": false,
"singleQuote": true
}
60 changes: 59 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,59 @@
# message-pickup-repository
# Message Pickup Repository

## Description

Service designed for the management and storage of messaging for the Message Pickup repository of the credo-ts framework. It allows and facilitates the methods implemented by this module for handling messages from the mediator and its clients, adding live session management for clients, as well as a publish and subscribe notification process for clients connected on other instances when there is more than one mediation instance.

## Enviroments

## Environment Variables

| Variable | Description | Default Value |
| ---------------------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| `APP_PORT` | The port number on which the application will run. | `3500` |
| `WS_PORT` | The port number on which the WebSocket server runs. | `3100` |
| `FCM_SERVICE_BASE_URL` | The base URL for the push notification service. | _Not set by default_ |
| `MONGODB_URI` | The MongoDB URI for connecting to the database. | `mongodb://user:password@localhost:27017/MessagePickupRepository` |
| `REDIS_TYPE` | Allows set redis type works `single` or `cluster` | `single` |
| `REDIS_URL` | The Redis database URL for connecting to the server.(only single mode) | `redis://localhost:6379` |
| `THRESHOLD_TIMESTAMP` | Allows set threshold time to execute message persist module on milisecond | `60000` |

## Installation

```bash
$ yarn install
```

## Running the app

```bash
# development
$ yarn run start

# watch mode
$ yarn run start:dev

# production mode
$ yarn run start:prod
```

## Test

```bash
# unit tests
$ yarn run test

# e2e tests
$ yarn run test:e2e

# test coverage
$ yarn run test:cov
```

## Message Pickup Repository Documentation

For more information on how the server works, including details on WebSocket methods, pub/sub, and push notifications, check out the [Message Pickup Repository Server](./docs/message-pickup-repository-server.md).

## Message Pickup Repository Client Documentation

For detailed instructions on setting up a client, including typescript examples, check out the [Message Pickup Repository Client](./docs/message-pickup-repository-client.md).
Loading

0 comments on commit bbf5f20

Please sign in to comment.