Disclaimer: I should know what I'm doing but I don't. 😢

I'm a very experienced full stack dev (15+ years), but I don't know the more modern JS frameworks. I'm trying to learn React and I have a little project I'd like to do.

I have database (in both SQLite form and JSON form). I'd like to read from it, parse it and run various displays in a shared hosting environment (that doesn't have node). So webpack. And either an API to get the data or a React compatible SQL component.

But dagnamit, I cannot find a tutorial or example with this kind of set up and I can't figure it out. What packages do I need and what kind of config?

I genuinely thought this would be a traditional and simple architecture but I'm obviously mistaken. And I'm about to turn in my developer card because I'm clearly a stupid twonk.

Has anyone done this? Do you know of any tutorials or examples of this kind of thing? Is there somewhere else I should ask this question? Thanks anyway...

  • 3
    My freind, cranky, your question is all over place. Referring to numerous tech which is confusing me.

    React is just the view layer of your single page app in the user's browser.

    Webpack would be your build tool don't use it as a static file server in production. It allows you to take all your es6 js files and transpile them all into es5 js file or files (if applicable) ready for browser to download and use.

    Your server could use any db you want and it should then send json to the client (either through restapi or websockets). Your js client can then keep data in memory or persist it in cookies, local storage, websql, etc.

    For learning purposes, I would suggest use the server stack you are most comfortable with and use react to load the client app (render html ...)
  • 0
    @rusty-hacker Thanks. You are totally right - my question is all over the place and I think that is what is frustrating me most. I should be able to make sense of this more easily than I am.

    I understand the principle of the different layers. React is my view. I was trying to keep it simple and minimise the layers so I thought I could just read the data without a "server" in between. I know I need to source it somehow, so maybe something simple to do that.

    And I think I've been bamboozled by so many different options, patterns and tools in searching for a simple solution that I'm stupidly over-complicating the whole thing.
  • 1
    Right, got you.

    You are going to need a server to send static files to the clients nginx, apache, nodejs.

    Then regarding db, if authentication and authorisation are of no concern, many of nosql dbs provide rest apis. To name a few postgress, couchbase and elastic search. You could also use rethinkdb whicb I think provides a js client.
    I have recently come accross arangodb+foxx which also allows you to write logic around apis if needed.

    Personally, I find that a thin http/websocket server between client and db makes things a lot easier, even if you are using any of the mentioned modern dbs.
  • 0
    use whatever db you like, provide an API(rest or graphql) for the frontend then render the it with React.
    So many options, confusing as hell sometimes.
    but thats how this is nowadays.
  • 0
    @kp15 go with Vue and don't look back. Unless you have a facebook-size project and need react redux.
Add Comment