Introducing globalContext
We are thrilled to unveil globalContext
, available starting from 0.4.229
.
-
API >
globalContext
-
API >
getGlobalContext()
-
API >
pageContext.globalContext
-
API >
onCreateGlobalContext()
hook -
API >
onCreatePageContext()
hook
It's a foundational new primitive that unlocks new use cases and facilitates existing ones.
For example:
- Global initial data can now simply be fetched in
+onCreateGlobalContext
. - Integrating a state management store with SSR is now an even more natural process.
- You can use
globalContext.pages
to access the metadata of all your pages. - You can integrate authentication for SSG apps in a straightforward fashion.
It also unlocks features for Vike extensions. For example, it enables vike-server
to automatically add the server middlewares of upcoming Vike extensions such as vike-trpc
, vike-telefunc
, and vike-better-auth
.
We've updated Vike's documentation to feature globalContext
, most notably:
- Guides > Data Fetching
- Integration > Store (State Management)
- Integration > Authentication
- Integration > Markdown > Metadata
Vision
The new globalContext
primitive doubles down on Vike's philosophy of being an unopinionated core with low-level primitives, enabling unprecedented user freedom.
We also care about zero-config, and that's why everything we released can also be used by Vike extensions.
In general, we're working towards full feature parity between Vike extensions and the user land, enabling powerful Vike extensions.
To foster user freedom, extensions are ejectable.
Roadmap
Thanks to globalContext
, we will soon be able to merge and release our work on:
We will then implement:
- Open Source Pricing
- Type-safe routing (see
topic:routing
) - Improved SSG support (see
topic:ssg
) - A lot of polishing ✨
- V1 release ⭐
In parallel to Vike's roadmap, we are:
- Working on making
vike-server
agnostic (@magne4000) so that any Vite-based framework can use it. - Doing outreach to (better) explain Vike's vision.