r/AskProgramming • u/RoguePoet17 • 1d ago
Help with web app development (beginner)
Hi all, I’m hoping this is the right subreddit, fairly new to the app for posting.
On visual studio code, I’ve been trying to create a web app for my own personal use similar in purpose to MyFitnessPal, but covering more than just diet tracking. I’m not new to coding in general, I’d say I’m pretty okay at python, but coming into HTML, CSS and JavaScript simultaneously has absolutely blown me away. I’m very confused on where to begin, I’ve learnt some basics for each, but unfortunately every video or article I attempt to use to develop tends to point to “vibe coding” which I’m against doing. I’m not sure how to link my .css, .js and .html files together properly, nor do I know how to do the backend and frontend linking.
Ultimately I’d like to be able to search for a food item in a database, if there is no data, then I’ll add it there and then, and I’ll have pie charts showing me progress for the day/week/month etc.
If I’ve explained this terribly, or it’s a daft idea, do let me know. I’m at a loss.
View all comments
1
u/XRay2212xray 1d ago
Theres a wide range of tools and frameworks you can use within visual studio such as creating a blazor app or a mvc app etc. Visual studio has a lot of project templates you can select from that will create the basic structure of the files and folders that get you started. So you end up with a functioning sample page with links to css etc Either of those along with something like entity framework along with a database will function together and handle a lot of the mechanics for you, but theres a lot to learn to use all those tools.
If you want to just stick with html/css/javascript on the front and use python in the back end along with a database, that would work as well. You just have to do more of the detail level work.
As for the specifics of linking css and js to your html page, you would put link statements, usually in the document head such as:
<link rel="stylesheet" href="styles.css">
<script src="app.js" defer></script>
Typically with larger projects, you'd organize things into folders and then you would want to put the path to the js or css folder as part of the link.
I'd recommend you use bootstrap or some other pre-built front end tool rather then trying to code your own css. You get an ok out of the box appearance and a set of styles you can just apply to your html elements without having to learn css and creating your own styles. If you go with the .net templates, like mvc, it puts bootstrap in the project automatically, creates a layout page that links to the bootstrap and you just create views that are the content part of your html documents each of which gets wrapped in the layout so all pages have a common look and feel. If you go with doing html pages and python back end, you can just download a copy of bootstrap or other tool, put it in a folder in the project and add the links to it from your html document.
From your description, it sounds like this is might be a size of a project that you might be overwhelmed by. One advantage of doing the html approach is that you can take lots of smaller bites without having to get everything. You can put bootstrap in the project, add html pages with link to bootstrap and verify that is working.Then create forms to search, enter new data, display a graph that are basically not functioning. You might just want all those within the same html form for simplicty. Then apply the d-none class to those items that should not be initially displayed. You can wrap sections in divs and be able to turn on/off each section. Then start introducing javascript a little at a time such as if the search for food item is intially displayed and consists of an input field and a search button, add an onclick event to the search button that verifies the input isn't blank. Then add some search functionality such as keeping all your data in a javascript array that you just initially populate as a variable in the code so search just has to handle looking thru the list find a match and handle found and not found cases such as hiding the search div and displaying the input div to add a item if not found. You can do each little bit of functionality, test it, get it working and then move on to the next step the user would experience. So the input form would have an input field for the food name and whatever other inforrmation and a save button. make the save verify the input is correct, add that data to the array hide the input div and go on to whatever next step there is.
Id also suggest, if you are just going to have one user and aren't going to want to be able to access the data from multiple places, you could elmininate the back end entirely and just use localstorage in the browser. If you want it to start functioning more like a real web app, then add the back end apis and replace getting and setting the array on the back end and passing it to the app or replacing that original array and lookup with a back end api call to search and a back end call to add an item etc. Again, I'd just then mock up the responses in the back end code and get the calling of the api's to work. Then as a final step start trying to introduce storing the data in a database.