Skip to content

React: Add resource on how to separate frontend and backend #30948

@a-gracia

Description

@a-gracia

Checks

Describe your suggestion

In the Using ruby on rails for your backend lesson, the first assignment explains the ways that React can be integrated with Rails, including serving React from Rails and serving each one as a separate app.

The second assignment is about integrating React with Rails using esbuild. I followed the guide for the projects, but I didn't like this approach too much, so I split my app into a React frontend and a Rails backend.

However, I found that most resources on the internet focus on using JWT tokens, which added another layer of complexity on the Rails side. Also, many resources on cookie authentication were broken or hard to follow.

So, after reading through the Rails docs and some blog posts, I was able to implement cookie authentication for my Rails apps and decided to write my own tutorial so I will not forget the steps.

My suggestion to improve the curriculum would be to add this tutorial to the React course as a third assignment so now this case is covered:

https://andres-g.com/posts/rails-api-authentication-using-cookies/

I think it's a good tutorial, and in the end readers will get a Rails API with cookie authentication that works with any frontend framework. I tried to be very specific in each step and included some JavaScript tests so people can get results quickly and create their own custom hooks.

Path

Ruby / Rails

Lesson Url

https://www.theodinproject.com/lessons/react-new-using-ruby-on-rails-for-your-backend

(Optional) Discord Name

gdanies

(Optional) Additional Comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions