-
-
Notifications
You must be signed in to change notification settings - Fork 11.4k
Description
This is a bit of a case of me thinking out loud. Perhaps it's part of #1789, but it is also related to #2156 and #2179 (package.json support).
At the moment we have:
- bootstrap (initialise the config file)
- server init (does a whole tonne of stuff, finally calling server.listen)
- serve first request = middleware
I'm wondering if the server init could be streamlined into only things that are absolutely necessary to happen before Ghost even starts.
Surely a whole heap of this isn't actually needed until we serve the first request which needs it. For example, mail - it might never ever be needed, so why bother initialising it before we start Ghost?
Similarly with the new package.json stuff, should we be loading this into config? That's certainly convenient, but should it be somewhere else, loaded only if and when it is necessary? Or should it be passed to config later on in the flow... generated when requested?
This is a pretty different way of working, but I'm thinking it could lead us to much more streamlined, more modular code, it could give us a faster boot time, and a smaller memory footprint by default.
But I am just thinking out loud 😉