I wanted to create a simple web app and I felt like the current state of Meteor should allow me to SSR the app without having to “hydrate” the state of the app. After some tweaking I got exactly what I wanted and decided to share the boilerplate:
- SSR “just works”. I write my app and it’s SSR’d correctly whether a component uses data or not.
- No need to put data/state on the initial HTML render.
- User data is SSR’d normally. Again, just write the app.
- Admin section (
/admin) is lazily loaded (not part of the main bundle).
Check it out: https://github.com/ManuelDeLeon/meteor-ssr
- I forked react accounts ui and basic because they had errors and it was a lot easier to fix those than doing it from scratch.
- It’s technically possible for a user to pull the admin screen but they wouldn’t be able to view or modify admin data.
- It’s using
ReactDOM.hydratebut that’s just the new name for
.render(). By “hydrate” people typically mean injecting the initial state on the HTML and using it to render the state. That isn’t needed here.
- There’s some code duplication in the components. I felt that drying an example would make it less readable.