District Informatics Officer at Informatics Center·
Needs advice

Hey Everyone,

I am using the Django with Django REST framework for backend and API.. for front-end using React..

  1. What will be the best way for deployment. Backend and front-end are at different domains or both at the same domain...
  2. My app will be used concurrently by more than 1000 users. How will I achieve performance? Is there any suggestions...
6 upvotes·8.8K views
Replies (4)
CTO at SMOK sp. z o. o.·

Best advice will be to put a reverse proxy nginx routing certain calls to frontend, and certain to backend. Best way to build will be Docker images and a docker-compose file for starters, where you will define the database, the backend, the frontend, and the reverse proxy nginx, which you can configure to use certificates and certbot from Let's Encrypt. You can worry about performance later, at which point you will probably need to migrate towards Kubernetes. Standard setup with docker-compose should serve you well for up to 1000 users. You can initially use the same domain with possibly /v1 routing keys towards backend, and the rest towards frontend, which should be a plain Nginx image with all of the frontend files compiled. You can compile them using multi-stage Docker builds, or just plain CI/CD such as GitLab.

7 upvotes·6.4K views

Hello Rajeev!

In a global sense, if there is such an opportunity, and if it is applicable to your project, I really advise you to change the technical stack. Try using static UI frameworks (Svelte) and server oriented fast languages ​​(Java, C#).

But if we take current conditions, then your option would be to audit absolutely all technologies. Review your data consumption, such as how fast your database response is, how well you use the power of both languages, such as in optimization. Make sure the quality of your server provider, database, other technologies. If you're using an image extensively, consider a CDN.

As for placing the API and the Website on the same domain, the choice is yours, but in my experience, mostly people prefer the api sub-domain (example: api.example.com), it's easier and clearer.

These are big and complex decisions, but they will affect UX, and therefore your income :)

Happy coding!

Useful resources: https://reactjs.org/docs/optimizing-performance.html https://docs.djangoproject.com/en/4.0/topics/performance/ https://www.sisense.com/blog/8-ways-fine-tune-sql-queries-production-databases/

5 upvotes·6.6K views
View all (4)
Avatar of rajeev kumar

rajeev kumar

District Informatics Officer at Informatics Center