Great question — answering as the UphillTech team:
Build-time occurs when the app is compiled for production: next build Run-time occurs when the app is running in production: next start getInitialProps This runs on both the client and the server during run-time for every page request. Most common use case is retrieving some sort of shared data (like a session that lets the client and server know if a user is navigating to a specific page) before the requested page loads. This always runs before getServerSideProps. While its usage is technically discouraged, sometimes it absolutely necessary to do some logic on both the client and server. getServerSideProps This only runs on the server during run-time for every page request. Most common use...
Full answer by Matt Carlotta: https://stackoverflow.stackexchange.com/a/64520557 (CC BY-SA 4.0).
Need it done for your business? UphillTech.