🤔 ChatGPT has transitioned from Next.js to Remix, causing a stir in the developer community. The main question is: Why this switch?
🔍 After investigating the codebase, it appears that the application is primarily client-rendered, with minimal server-rendered HTML. Most interactions and rendering occur on the client side.
📄 The initial page load includes HTML with meta and link tags for preloading images and JavaScript, essential for client-side operation. Unlike Next.js, Remix excels in handling single-page applications (SPAs).
📊 The application has about 60 routes, utilizing a robust routing system from React Router. Each route can load data efficiently through a feature called loaders, which fetch data during the initial render.
⚡ The initial load is fast because all necessary data is collected server-side, avoiding delays from client-side API calls. The application hydrates with a 7,000-line JSON object containing user data.
🔄 Page transitions are handled entirely client-side, fetching data from a separate backend API, which is likely hosted on their own servers using Envoy as a proxy.
🖥️ The Remix server runs on Express, which is surprising, and they are using Azure for their CDN. They have moved away from Vercel for hosting.
🎨 For styling, they are using Tailwind, but it seems they are not fully utilizing all Remix features, such as actions for form submissions.
🔑 The reasons for moving to Remix include its superior routing capabilities and the efficient loader API, which simplifies data handling for initial renders. The application does not require extensive server-side rendering or SEO considerations.
⚙️ Additionally, Remix runs on Vite, which is lightweight and efficient, contrasting with Next.js's reliance on Webpack, which can introduce complications.
💡 In conclusion, Remix offers flexibility and efficiency for ChatGPT's needs, making it a suitable choice for their architecture.