d-zone-org / d-zone

An ambient life simulation driven by user activity within a Discord server
ISC License
573 stars 75 forks source link

Move to NEXT.js? #249

Closed SagnikPradhan closed 3 years ago

SagnikPradhan commented 3 years ago

I think we should probably move to NEXT.js at this point. Reasons?

These reasons alone should make our work lot easier.

One thing this would change is how we imagined d-zone to be? We were thinking about going having a server package, which would then be a dependency of the web interface for serving the public assets and API. So yeah little change in plans. We are slowly evolving and learning in the process.

SagnikPradhan commented 3 years ago

Anything you'd like to add? @vegeta897

vegeta897 commented 3 years ago

One thing this would change is how we imagined d-zone to be? We were thinking about going having a server package, which would then be a dependency of the web interface for serving the public assets and API. So yeah little change in plans.

Can you expand on this? What is the NEXT.js way?

SagnikPradhan commented 3 years ago

One thing this would change is how we imagined d-zone to be? We were thinking about going having a server package, which would then be a dependency of the web interface for serving the public assets and API. So yeah little change in plans.

Can you expand on this? What is the NEXT.js way?

So typically in a node full-stack application what happens is you have two separate folders, one containing the frontend and the other server itself. You bundle your application using the bundler then serve the bundle along with your API using the server.

But in case of NEXT.js your views are closely tied along with the server code. You have your frontend code and server right beside each other. For example look here

SagnikPradhan commented 3 years ago

Now that I think about this, implementing websockets is going to be a little uneasy. We'd have to implement a custom server. Then hook our NEXT.js handler and websocket handler to the custom server. To get better idea of what I mean, look here.

Apart from that using services like netlify, vercel would be out of scope too. So I take back my words. "Help us better integrate with Vercel"

I'd still recommend NEXT.js cause you still get SSG, SSR, Image optimization and etc etc.