Next.Js SSR and SSG support on CloudFlare Pages

From the CF pages document, it support only the Static Site Generator, my app needs to be supported both SSG and Server Side Rendering (SSR) with Next.JS framework. Any alternative ways to solve it with CloudFlare?