aantron / dream

Tidy, feature-complete Web framework
https://aantron.github.io/dream/
MIT License
1.59k stars 126 forks source link

Suggestion: push non-essential functionality into optional packages #168

Open cemerick opened 2 years ago

cemerick commented 2 years ago

As I get closer to deploying a dream app into production, and things like deployment package size are top of mind, it occurs to me that dream includes some bits that could reasonably be shuffled into optional packages to enable slimmer default deployments (quite analogous to one needing to pull in the caqti driver corresponding to the database(s) actually in use):

Obviously this suggestion is somewhat in tension with the stated tagline of "a feature-complete web framework" (i.e. I assume by their inclusion so far, you believe that making some of these features optional would diminish the "feature complete" part of that). But there might be a "why not both?" approach, i.e. have a dream-slim package that omits such things, and the canonical dream package depends on it, and N additional optional bits.

As always, greatly appreciate the utility and fundamental vision of dream. :raised_hands:

aantron commented 2 years ago

I'll take a look at this.

Have you looked at how much space would be saved by removing TLS support or GraphQL? Just asking — I can take a look later.

Ideally, I think, we would have some kind of link-time dead code elimination just get rid of these if they are not used. I think that should be readily applicable to GraphQL. The way TLS is "integrated" into Dream might be hard for DCE to discover it is not used.

ReallySnazzy commented 6 months ago

+1 I think this would also be useful for Windows users. During building a project using Dream with DkML, it seems like it's able to compile all 3rd party dependencies except for the ssl package. If ssl was optional, then it might be easier to do development on Windows.

aantron commented 1 week ago

For the SSL failure specifically, was it an instance of https://github.com/savonet/ocaml-ssl/issues/155? Also reported in https://github.com/ocaml/setup-ocaml/issues/856.