Laravel With Node.js

Quick question, looking at building an app with a realtime text editor along the lines of Quill.js with note editor built in node but rest of app to be Laravel Spark based, so need to be able to access the data in notes via PHP etc. For example it might be the content of the note, or it might be a section of the text that has been highlighted/tagged.

I’m not a developer, but the devs I’m looking at contracting are having challenges with this due to the different stacks. Has anyone had success doing things with Node and Laravel and could offer me any tips I could pass on, or help me understand the challenges here from another perspective?

Thanks in advance!

Your post doesn’t really make it clear where Node.js comes in to play in the stack. But regardless, they should just communicate over a REST API, similar to how the frontend would communicate with the backend.

Part of your post sounds like they are also having trouble sending data back and forth to the server through the JavaScript client. If you’re paying these people and they are incapable of doing this, then you should find someone else to pay.

Hey Mawburn!

Thanks for your reply. From what I understand, they know how to send data back and forth but its more how I had suggested it might work by putting the editor into the same window as the rest of the front end rather than it running as a seperate app and sharing data. Maybe this attached mockup will help to explain:

It dramatically simplifies the real world example, but in essence you would have data from inside the editor that you would need to also reference in other parts of the app - for example I might want to show text that is highlighted in a note on another page. Or is the solution here that if you are building something that require a realtime editor it can’t be built with Laravel and everything should be built with Node rather than mixing stacks? I feel as if that wouldn’t make total sense, since I’m sure Google Drive for example must use a mix of tech (then again, they do open the text editor in a completely seperate page)

Would be really interested in your thoughts. Thanks in advance. :slight_smile:

Tim

Instead of trying the dictate the technical aspects of the solution, why not just send out an explanation of what you want to accomplish and see what sort of results come back?

I have read your words several times and looked at your screen shot but things just don’t add up. Both PHP and Node.js are server side technologies. The idea of having a note editor built in Node.js for a web application just does not make sense to me.

2 Likes

Hi Tim,

It’s worth bearing in mind that client-side code (i.e JavaScript) is essentially a separate app from your server-side code. Even though you might be using Laravel to handle things like authentication, CRUD operations, and rendering out templates, as soon as the browser receives those pages and executes the JS, you’ve now got a separate app running in the browser that is totally unaware of what language(s) are being used on the server.

There’s no reason your JS can’t open a WebSocket connection to a separate Node server to handle realtime collaboration with other users. This would actually be playing to each language’s strengths somewhat.

2 Likes

So you have some sort of WYSIWYG text editor; this is entirely a matter of JS running in the browser. And that the editor is written in JS doesn’t mean that it has to be served by node – PHP can serve JS as well, just like any other web content.

The editor can then communicate with your backend (or access the rest of the page) as usual via the hypertext transfer protocol (or the document object model respectively); JS provides built-in interfaces for that.

(x-post)

1 Like

Thanks so much for your responses everyone.

Sorry if it came across that way, its more I was jumping in at the current cross roads - while I did a bit of a search for some tools that might help, the developers asked to quote the project had complete freedom to work out the best way to do it - they got stuck finding an editor that could do what I need it to do, I found one which they said would but it runs Node.js - and here we are. So yes, of course I would be interested in how you would approach, all ideas welcome. :slight_smile:

Most of the editor frameworks I’ve found seem to be based on Node. Have you built/seen anything yourself that works easily with a PHP backend?

Interesting, that’s kind of what I had assumed would be the case. Which is why I’m struggling to understand the complications a bit. Would definitely like to play to the strengths of whatever technology is used rather than force one to do something its not designed for.

Given the various views, I suspect its a language/translation issue with the developers since English is a second language for them - I’ve found a local developer I can sit down with who can hopefully help worth through this with me in more detail (because there may well be something in the spec that is causing the issue I could just remove and they might be able to go ahead in a way one of you has proposed above).

Thanks again everyone!

1 Like

I suspect there are several technologies being mixed up here, without a full understanding of what they all do.

From the initial description I would have, you are thinking Noide comes into it for “websockets”, powering a real time / collaberative system in the wysiwyg editor. The editors themselves are just javascript, however the ‘node’ bit will be using npm (node package manager) to install and manage dependancies. You can use npm to install a javascript library, without needing it to run through node.

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.