Next.js offers features like simple client-side routing, automatic code splitting, Webpack-based development environment with the support of HMR. It supports two server-side rendering modes: static and on-demand export.
While static export renders all pages to .html files and serves them using any file server the later one renders unique pages on each request. This mode is good for dynamic web apps which content changes often, have a login state and similar use cases. On-demand export requires a running Node.js server.
The first version of Gatsby.js came out in 2017. You can use it for creating both dynamic and static websites/web apps including blogs, e-commerce websites, dashboards, etc. When it comes to databases sources, Gatsby supports Markdown files, CMS like Contentful or WordPress, or REST or GraphQL API. Gatsby.js also automates important processes like code splitting, image optimization, lazy-loading, resource prefetch and make things easier.
Going a little deeper, Nest.js uses Express and is fully compatible with a large number of popular libraries. It mostly uses classes, decorators, metadata reflection for most of its abstractions.