Programming Help
I need help learning about server-side programming enough to make my first simple web app. I know there are places like Stack Overflow that are supposed to be ideal for programming questions. They are good for very specific questions, but not so friendly for people with general questions or open-ended discussion.
I understand front-end coding with HTML, CSS and Javascript. I started with jQuery and now I'm learning ReactJS with Redux. So far so good. I tried Angular also but it was not for me.
I have a simple single page app. I won't go into detail, but basically it allows a person to enter some information and then it saves the data in a JSON object. It stores the data in browser local storage so if the person closes the browser and comes back the information is still there. But if they switch to a different device or browser the data is lost.
So, I need to figure out how to save and retrieve the JSON data from the server. I suppose before that I need to set up authentication/users? Create login/password? Reset password?
I'm not sure where to start. NodeJS? Rails? PHP? GraphQL? I also do not understand how hosting works for web apps. Currently, I have a web host and use FTP to transfer files. For web apps these days, it seems like everyone uses GitHub. So I set up an account and I'm learning the basic Git commands: add, commit, push. For hosting, I also keep hearing about Heroku, Digital Ocean, AWS. Should I be using one of these?
I highly recommend Github. It's amazingly powerful and convenient and easy enough to use that you can sufficiently incorporate it into your workflow within a few weeks and not really have to think about it much after that.
Plus it makes deploying much easier when your files are stored in a single location and your web host is connected there directly.
Speaking of which- you say you have a web host- what are you currently using?
A "database" is really just a big text file that sort of resembles a CSV. You can simulate storing in a database by saving your JSON in a simple file. If you want to have a folder and have each file named by some key, that's doable and a small step up from what you're doing now. However! This gets messy. It's not very scaleable- meaning it's hard to add things later if you need to- and it's quite slow. Databases save the data in a really clean and consistent way and they're generally set up in such a way that it's very easy to change and expand the data should you need to. So I'd recommend learning about/using one of those.
I've used PostgreSQL and MySQL the most, as well as a few others. The difference between each database type is the way you retrieve information. I prefer PostgreSQL simply because it's easy and works nicely.
You'll need to install a database to your web host in order to use it- but most web hosts will do that for you automatically.
Next you'll want a web application framework to handle the data on a server side. Using a JS based one might be tempting because you've already got experience with Javascript, but I personally don't recommend it. I don't like mixing responsibilities though. Javascript does front end functionality like manipulating a page, to me it doesn't make sense to use it to also interact with a database, but that's my opinion. 🤷♂️
Then what you'll do is upon submitting a form, instead of storing that in a cookie with javascript, you'll pass it along to your web app backend, which will format it, serialize it, validate it or whichever and then feed it into the database, where it can be retrieved at a later date.
Any of the frameworks you mentioned would be good. I personally use Rails. I know of people that use all the rest, too.
Rails is known to be very easy to get up and running on small projects very quickly, however, it can have some scaling limitations that are slightly bigger hurdles than some others. (Not impossible, just a trade off- easy early game for a more difficult late game rather than the other way around.)
As for hosting- Heroku, DO, and AWS are all great. Here's my summary of each:
Heroku Very very easy to get started. Scales the worst. Also tends to be the most expensive after you have more needs than is covered by their free plan. However, because of the free plan, this is generally the best place to start.
Digital Ocean My personal favorite, DO is a great balance between freedom and guidance. They supply you tools to do what you need and the freedom to get deeper and configure things.
AWS By far the most powerful, also the cheapest. The downside is they basically drop you in a desert with a wrench and tell you to build a car without instructions or materials.
Okay, maybe not that bad. But AWS is the most difficult to start, and requires a foundation of knowledge in dev ops.
Finally, yes, in order to save the data for each user and not have that data accessible by other users, you'll likely need some sort of authentication.
If you want quick and dirty- when a user saves something you can assign them a pin/id/something and have them enter it when they come back to retrieve the info.
Authentication is a big nasty can of worms. Luckily, most mature frameworks have decent open source projects/libraries that can handle authentication for you. It's highly recommended you stick with these so you don't make mistakes that can cause your users harm. For example, it's considered very bad practice to store passwords in "plain text". Instead, you apply an algorithm that changes the password to something unrecognizable. Authentication libraries will usually do this for you so you don't have to worry. (As much. You should still do what you can to keep your server secure.)
Sorry if that was a huge load, but hopefully that answered a few of your questions, and I'm happy to help with any follow up questions you have.
Finally, to close, this website (Help-QA) is built with Rails, the code is hosted (open source) on Github, the server is hosted on Digital Ocean, and it uses PostgreSQL to run the database. 😊
To persist your data you need something called "database", to get the information from the database you need "SQL".
So your web server can host both the database and the backend language to fetch the data.so Php for example would fetch the data from the database and return it to the front-end (client).
Thanks for all of the info!
I am currently using MediaTemple shared hosting: https://mediatemple.net/webhosting/shared/
I am guessing it is more user-friendly, but not as powerful as the other hosts? There is a built-in control panel so it is easy to set up domains and email addresses. I think it supports PHP files automatically. I installed WordPress a while ago and that was using PHP and a database - I can't remember which.
I'm leaning against using PHP because part of my goal is to learn a newer technology and switch to more of a Git workflow which seems to be what most are doing now.
Ok, I think I will try Heroku free plan first and see how it goes. At this point it would be cool if I can just get something to work, so not concerned about scaling yet. I still need to decide on a framework. Do you know if it makes sense to use ReactJS with Rails?
PHP is REALLY old. It can't really be considered "newer technology" anymore.
That said- many people still use it, but, generally it's people that learned in it and don't know anything else and/or are working on a huge, long standing project and switching to anything else is too difficult.
I personally wouldn't recommend it. In my opinion, it's a really messy and ugly language.
You should be able to host anything on MediaTemple, depending on what kind of access to the box that you have. Since it's shared, you might not have root access which prevents you from installing/configuring anything new.
And generally yes, unfortunately the easier something is to start with and set up, the harder it is to scale/the less powerful it is.
Looks like MediaTemple works with PHP out of the box, so you should be good there- you could even stick with what you've got. 😊
And yes- many people use React with Rails. Whether or not it "makes sense" is up to you, but it's been done and there are plenty tutorials out there that can help you get it set up and running.
I meant that I'm leaning against PHP so I'm glad to hear that you don't recommend it. It makes the decision easy. :)
I think I'll try Heroku since I want to move in the direction of learning to use Digital Ocean and seems like Heroku is a step in that direction. And I will try Rails first and see how it goes.
😄
I wish you luck! Like you said- Stack Overflow is amazing for specific questions, but if you've got more broad needs, feel free to ask here!
Also- tutorials are amazing! Now that you've slightly narrowed down what you're wanting, you should be able to find some walkthroughs on how to get things set up and running.
Thanks! This was extremely helpful. Will let you know how it goes.
Rockster160 wrote:
😄I wish you luck! Like you said- Stack Overflow is amazing for specific questions, but if you've got more broad needs, feel free to ask here!
Also- tutorials are amazing! Now that you've slightly narrowed down what you're wanting, you should be able to find some walkthroughs on how to get things set up and running.
Stacks....?
Broads....?
Overflow.....???
Keep this up we might need to make this post NSFW.
Help me with: We have another hurricane coming this way.
Just an update: I'm still planning to do this, but it is on hold for the moment...
Hoping to use this tutorial when I do: https://blog.heroku.com/a-rock-solid-modern-web...
soco wrote:
Rockster160 wrote:
😄I wish you luck! Like you said- Stack Overflow is amazing for specific questions, but if you've got more broad needs, feel free to ask here!
Also- tutorials are amazing! Now that you've slightly narrowed down what you're wanting, you should be able to find some walkthroughs on how to get things set up and running.
Stacks....?
Broads....?
Overflow.....???
Keep this up we might need to make this post NSFW.
😂
Lawn wrote:
Just an update: I'm still planning to do this, but it is on hold for the moment...Hoping to use this tutorial when I do: https://blog.heroku.com/a-rock-solid-modern-web...
Good to hear! 😄
Help-QA supports basic Markdown, emoji 😁, and tagging friends with @username!
To use this site you must be 13 years or older and occasionally submit your email address. Your email address is only shared with your explicit permission.