I found that React-three-fiber is the best way to build the frontend of the three.js webapp.
I am confused what backend will be best suited for it.
What API server side language should I use : Django or PHP or Node js(If node.js express.js or sails.js) ?
Which database would be the best to work with ?
Is MERN Stack the best option to go with…
Backend usually depends on what your application does - not what the frontend is built with.
- If you know JS/ES very well, your app is very dynamic and requires live connection with the server - go with
express or any of it’s derivatives should do the trick.) Mind that servers get relatively expensive if you underuse them.
- If you know JS/ES very well, your app is dynamic but not constantly connected to the server, and you want to save some money - go with
serverless + node (it does not require using
express, it’s just pure
node + libraries of your choice.) Mind that serverless gets relatively expensive if you overuse it.
- If you want static server-side rendering - go with
gatsby and simple webhosting.
- If you want dynamic server-side rendering - go with
PHP, if your server supports it.
As for databases - probably an unpopular opinion, but based on experiences I’d advise not to use DBs to store three-related JSONs. It’s very time- and resource-consuming to search these JSONs, plus DBs can have size limits on records’ length.
If you want to store scenes / worlds on servers, use a mix of file storage + searchable database with IDs and tags - ex.
DynamoDB + S3 on AWS.
Depends on the app - it’s can also be an overkill if all you’d need from an API is a few endpoints + a simple database.
I am planning to build something where user can login create their own model and save it retrive it later.
Need to store the created models over to the servers
And I need a completely dynamic site , will express handle it seamlessly with aws.
And could you please suggest some reference to store the three js models as you said in dynamoDB or Mongo or anything else
Sounds like you don’t need a server at all - since it’s all stateless, except for the models. Or are these models uploaded live? After every update on the frontend, you instantly sync the model with the database?
If it’s only a “Click here to Save the model” situation, you can for example go with:
serverless (AWS Lambda / GC Functions): create 4 endpoints. One will allow the user to log in, second will authenticate existing user, third will allow to upload the models, last to allow reading uploaded models (after authentication.)
DynamoDB (GC BigTable / Firestone): 2 tables to store users and model IDs. When user creates an account put their data in one table. When a model is uploaded, put its ID and author ID in the other table (that’s a bit simplified and probably not the safest, later you can add access control to the files and combine it with something like Cognito.)
S3 (GC Storage): 1 bucket. When user uploads a model via serverless, create a subfolder for the user in the main bucket and put the model there, save only the ID to the database.
Tbh, it’d be exactly the same story when using
express + MERN, just the names of the services change, plus MERN you have to host and backup yourself.
Thankyou so much for your help
Much kowledge will check out everything and try the best one.
Can you reference me somewhere where i can know completely about the backend mainly servers and hosting as I am a frontend postition and new to these stuff , that would be really helpful. Just wanted to know about the different types of servers.
This guide seems to explain a lot of it, and also at once. Though I wouldn’t read all of it - it seems to also have a lot of bloat like
Setting up Bootstrap or
Add app favicons :’) Could be a good starting point, but read only the parts you’d feel are important and useful for your case.
Thankyou so much for taking time and helping me out . Much appreciated .
Thank you somuch will check them out .
have you tried firebase or similar solutions. you can host your app as a static spa, it can still be connected to backend services, databases, etc, without you having to create all that yourself.
I took a dive on knowing more about firebase as you suggested .
Will it be completely reliable to use firebase only or should I set express as the server and then host it in firebase.
Basic requirements my project would need are
- Storing base models
- Storing models created by specific users
- Reusing the models
And it is recommended that creating own backend for long term use
I am confused in what way to go .
None of this stuff warrants your own stack imo. I would go for a self baked back end on node when I have my own node services, but just for authentication and storage, I would prefer firebase or competitors. They allow you to make a static site and they have ready made integrations.
My two votes are for either serverless architecture as recommended or (if you don’t actually need a website and mostly want the save assets functionality) going with electron + express as a native app