bolt-js icon indicating copy to clipboard operation
bolt-js copied to clipboard

Add a new built-in receiver for Fastify users

Open 75asa opened this issue 3 years ago • 3 comments
trafficstars

Description

I know bolt-js is a wrapped version of express, but I think the use case of choosing fastify, which is the same Node.js framework as express, when you want to focus more on performance is well known. In NestJS, the default is express, but we have also made fastify available for use cases where we want to focus more on performance. Wouldn't it be great if bolt-js implemented such a mode as well? Thx.

FYI

What type of issue is this? (place an x in one of the [ ])

  • [ ] bug
  • [x] enhancement (feature request)
  • [ ] question
  • [ ] documentation related
  • [ ] example code related
  • [ ] testing related
  • [ ] discussion

Requirements (place an x in each of the [ ])

  • [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x] I've read and agree to the Code of Conduct.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

75asa avatar Feb 26 '22 10:02 75asa

Hi @75asa, thanks for writing in!

I know bolt-js is a wrapped version of express,

Just to make it clear, this (being Express.js based) used to be true (in v2.x) in the past but now the default is HTTPReceiver, which depends on only Node.js http module.

In NestJS, the default is express, but we have also made fastify available for use cases where we want to focus more on performance. Wouldn't it be great if bolt-js implemented such a mode as well? Thx.

I'm a bit curious whether you've already observed a critical performance issue with Express.js based code. In the Slack app context, as long as your app does not receiver huge traffic from many (say, thousands) workspaces and/or a huge number of users in a workspace, Express.js's performance should not be so bad.

Aside from that, supporting more and more well-known framework (not only nest.js / fastify) out-of-the-box would be great for developers for sure! However, our team may not have the bandwidth to add more built-in receivers in the short term. If you need an immediate solution for it, please consider implementing your own receiver for now.

Lastly, this is off topic a bit but, to support more receivers in the future, this project may need to take some time to refactor the existing receiver internals to more easily share the essential parts of the code among receivers. Currently, we have ~three~ four built-in receivers and they have many duplicated code internally. Before adding more receivers, we would like to improve this issue.

Thanks again for sharing this feedback 🙇

seratch avatar Feb 27 '22 01:02 seratch

@seratch Thx for ur kindness reply.

this (being Express.js based) used to be true (in v2.x) in the past but now the default is HTTPReceiver

I didn't know it was Node's HTTPReciever from ver 3 onwards, thanks for letting me know!

I'm a bit curious whether you've already observed a critical performance issue with Express.js based code.

I haven't measured this yet, but I was curious about it because fastify publishes benchmarks publicly, and the response time has to be within 3 seconds, which led me to this issue.

If you don't need to handle the huge amount of traffic mentioned in the use case, you probably don't need it🤔.

If you need an immediate solution for it, please consider implementing your own receiver for now.

Thanks for the advice, I'll try to implement a custom receiver first!

Lastly, this is off topic a bit but, to support more receivers in the future, this project may need to take some time to refactor the existing receiver internals to more easily share the essential parts of the code among receivers. Currently, we have three four built-in receivers and they have many duplicated code internally. Before adding more receivers, we would like to improve this issue.

Thanks for sharing the current status, I'm looking forward to the future more and more!

75asa avatar Feb 28 '22 15:02 75asa

Just in case it is helpful: the docs on how to implement your own Receiver

filmaj avatar Feb 28 '22 22:02 filmaj

My personal projects support NestJS and Fastify. If you are still looking for a solution for this, take a look at them:

  • https://github.com/seratch/slack-bolt-extensions/tree/main/packages/bolt-fastify
  • https://github.com/seratch/slack-bolt-extensions/tree/main/nestjs-example

Since bolt-js project does not have plans to add those supports, let us close this issue now.

seratch avatar Oct 17 '22 07:10 seratch