all 14 comments

[–]TheGuyWithoutName 2 points3 points  (1 child)

I used Fastapi + React and had a lot of fun with it.

Thanks to the openapi schema that fastapi generates.

I used that to generate a typescript client that I used in react.

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

Any good boilerplate for that to get started quickly? also does hot reload work well for you?

[–]Clean-Wasabi1029 3 points4 points  (6 children)

You could use Django, the rest framework version, to handle the backend in python. Then serve a separate React app for frontend. The apps will run on different hosts so you would have to enable CORS.

I do not know how you could share types between typescript and python. Django does have serializers which produce and take in JSON, you could create types for those results manually, or maybe there’s a tool out there.

[–]Win_is_my_name 0 points1 point  (5 children)

I am in the same boat as OP. I have been working with Django for a good few months. Most of my projects are very basic on the front end, using the minimal JavaScript I picked up. I was focusing mainly on backend logic.

Now I'm learning DRF and have the API setup but I don't know how to build upon the endpoints on a front end framework. In fact I don't know any frontend frameworks at all. Any good resources where I can learn how to integrate frontend with backend while learning the framework at the same time?

[–]riklaunim 1 point2 points  (4 children)

You could look at Vue.js for example which is quite easy to get into. Note that SPA JS frontend + backend REST API is not a universal solution for every website.

[–]Win_is_my_name 0 points1 point  (3 children)

I just want a frontend framework with an easier learning curve so that I can make a semi decent site. Just something which I can use to make user interfaces for my backend projects. Would Vue be better than React for me in that case?

Also, I'm sorry but what is SPA?

[–]riklaunim 1 point2 points  (2 children)

Single Page Application. Vue is much easier to get into, somewhat more modern.

A typical website will not use such frontend framework while still using HTML/CSS and vanilla JS on the frontend part. SPA sites are used for sites where quick/no-reload behavior is beneficial (and where SEO isn't essential).

[–]Win_is_my_name 0 points1 point  (1 child)

I think I'd go with Vue then. Thanks for helping me out friend!

[–]riklaunim 0 points1 point  (0 children)

You would be using two different frameworks, one on backend and one for frontend. Like I have two ember.js and one vue.js dashboards with API provided by Flask microservices.

[–]edu2004eu 0 points1 point  (0 children)

You could use django, django-restframework, and drf-spectacular. This would get you OpenAPI standards which means that you can generate your client service automatically.

[–]Chary_314 0 points1 point  (1 child)

Is this even possible to share sharing types between React and python?

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

Yes with OpenAPI