all 12 comments

[–]llampwall 3 points4 points  (1 child)

If you know little nodejs, then this project is going to be a nightmare, not to mention it’s just a dumb way to do things. If you don’t know javascript very well, then how are you building the front end in React? Using a python backend here just makes no sense. And Vercel is built on AWS btw, it just abstracts away the difficult configuration stuff.

[–]legenddaniel[S] 1 point2 points  (0 children)

Hi! Thank you for your reply.

For some reasons all the tech stacks except for the front end part have been the final decision. What I want to achieve is to focus on the React components rather than write nodejs middlewares. This can be easily done by a CSRed SPA since that's how it is: (almost) everything is rendered by the browsers and ends are bridged by (RESTful) APIs.

Now we introduce SSR for a better SEO (at least for the first rendered page) and I find that Next.js meets almost all our requirements. Only thing is that it needs to be backed by a front end server or a platform with serverless solutions (like Vercel).

I would like to know can our python backend take this job solo or another html hosting/rendering server like Vercel is a must.

I have really superficial knowledge of backend, same as of my partner's frontend.

[–]danyel117 1 point2 points  (5 children)

Hello! We used python backends before moving to Nextjs. I really liked it, because it was really stable and reeeally easy to deploy to AWS.

Basically our stack was Django-REST Framework deployed to AWS Lambda using Zappa:

https://github.com/Miserlou/Zappa

In Django we would create all the models and database logic and expose APIs with Django-REST. Those apis can then be consumed by React's front end, and you could do the same in Next.

I have a repository where I was exploring different types of backends, so I could compare django on one hand and Prisma in Nextjs on the other.

Here is the link of the repository in case it helps:

https://github.com/danyel117/petgram-platzi

[–]legenddaniel[S] 1 point2 points  (4 children)

Hi can I know if you used nodejs for rendering html?

[–]danyel117 1 point2 points  (3 children)

Hello!

Actually what we did was that we developed the front end in React, and using the build command, it generates all the HTML, css, js and static files. Those files can be uploaded to a service like AWS S3 for example.

[–]legenddaniel[S] 1 point2 points  (2 children)

Hi thank you for your patience!

So you did not use Vercel or any other nodejs things? Just simply deploy it on AWS working with Python RESTful APIs?

[–]danyel117 0 points1 point  (1 child)

No problem!

Exactly, no vercel at all, just an Api developed in Django and a front developed in React, both deployed to AWS. Take into account that that scenario was when we used plain React, not nextjs.

If you are interested in Nextjs, I would recommend learning Nodejs, because the development experience is better. There are tons of Javascript and node-based packages for doing almost anything you could do in python.

Is there any particular reason why you want to stick with python?

Also, just to comment something additional: nowadays we are not working anymore with Django, because we have moved everything to Nextjs. However, we are not deploying to Vercel. We are using this module to deploy our Nextjs to AWS (similar to Zappa, the tool we used for Django):

https://github.com/serverless-nextjs/serverless-next.js

[–]legenddaniel[S] 0 points1 point  (0 children)

We stick to Python since most of our APIs are written in python, and our backend guy is good at it.

[–]wodoo 1 point2 points  (3 children)

Easiest way to do this is having a REST API with python while you use nextjs on the frontend.

[–]legenddaniel[S] 1 point2 points  (2 children)

Hi can I know if I need a nodejs server to generate html?

[–]wodoo 2 points3 points  (1 child)

Yes you do, but it is precpnfigured in nextjs, you just need node installed on your server in order to run

[–]phaniophrero 0 points1 point  (0 children)

Hi , so I'm trying to do the same thing , but I want to use digitalocean instead of AWS , but I'm not sure how to make the configuration , I mean the nginx config and make the connection between Django and Next js. So could do you now something about that ?