The createOvermindSSR factory creates an instance of Overmind which can be used on the server with server side rendering. It allows you to change state and extract the mutations performed, which can then be rehydrated on the client.
import { createOvermindSSR } from'overmind'import { config } from'../client/overmind'import db from'./db'exportdefaultasync (req, res) => {constovermind=createOvermindSSR(config)overmind.state.currentPage ='posts'overmind.state.posts =awaitdb.getPosts()consthtml=renderToString(// Whatever your view layer does to produce the HTML )res.send(`<html> <body> <div id="app">${html}</div> <script> window.__OVERMIND_MUTATIONS = ${JSON.stringify(overmind.hydrate())} </script> <script src="/scripts/app.js"></script> </body></html>`)}