Needs advice
on
AdonisJSAdonisJSExpressJSExpressJS
and
Next.jsNext.js
in

I want to build a web app with these features: - render a 3D object in the browser - when the user touches a part of the object I retrieve data or send API requesst to a database - get data in real-time from the backend and display it on the object - cache 3D object on the browser to avoid its loading (with cost)

I'm more a JavaScript developer with a passion for React and Node.js ecosystem, So I want to know for this kind of project it is better to build it with Next.js+three.js for frontend and Nodes.js + Express + Prisma + PostgreSQL Or build it directly with the API functionalities of Next.js? I thought having these two separate parts will be more scalable and easy to maintain.

Thanks.

READ LESS
7 upvotes·25.4K views
Replies (1)
Avatar of tonypai
Principal Site Reliability Engineer at OneDegree·

Based on your 3D object is a file or raw data, if it's a file, the pressure will be on the storage, you can use CDN to serve those files, here I will suggest you to use Next.js for both frontend SSR and serving API, and it will be more easy to maintain since there is only one instance.

If 3D object is storing as raw data in database, the pressure will be on the backend, you can use Redis cache to reduce the expensive requests, here I will suggest to separate the frontend and backend.

READ MORE
4 upvotes·5 comments·3.9K views
Tawal Mc
Tawal Mc
·
December 31st 2021 at 10:15PM

Hi thank you.

Pls, what do you mean by raw or file ?

Because I'll write 3D with React + three.js , even if I think it is raw

·
Reply
Tony Pai
Tony Pai
·
January 2nd 2022 at 4:17AM

Even you write 3D objects with code, you still need to store them, as I know there are two formats, JSON and binary, JSON is raw data which it can be stored in the database, binary is file, and it can be `.obj` or `.glb`.

See what kind of format you use, then you can decide the stack.

·
Reply
Tawal Mc
Tawal Mc
·
January 2nd 2022 at 10:22PM

Ok ok. Right. Thanks.

And about performance, render 3D object what do you think ?

3D object consumes more data bundle and with low network quality it can take time to render it...

·
Reply
Tony Pai
Tony Pai
·
January 3rd 2022 at 4:50PM

Rendering 3d object in browser is a should cost, I recommend you to focus on the compression and the cache to reduce the file size and increase the transmission speed.

·
Reply
Over Martinez
Over Martinez
·
February 23rd 2022 at 4:09PM

In my personal opinion, I always try to use the Next.js api for purposes that are not as complex, as dropdown lists or certain basic functionalities, otherwise (especially for more control & scalability issues) I prefer to have the backend separate.

·
Reply