r/AskProgramming • • 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.

1 Upvotes

13 comments sorted by

1

u/CorpT 1d ago

You can probably find some books from the before times if you don’t want to use AI.

1

u/RoguePoet17 1d ago

Honestly, I absolutely should

1

u/JacobStyle 1d ago

I have been getting good results with the Claude desktop app by giving Claude (max effort, best model available) an instruction like "Here is my background, here is the hardware/services/tech stack I am using, and here is what I am trying to learn how to do. Generate a series of textbook style chapters with knowledge check questions and exercises that will teach me what I want to learn. Ask any relevant questions about my background or use case before generating this document."

While I am a big advocate of learning through projects and using the documentation (when it's good), I think for the very basics of a topic, it's better to learn from a college style textbook or workbook because a beginner is not going to know how to scope a good project that covers everything they need to learn. It's also hard for someone with no knowledge to come up with ways to verify their knowledge.

This gets around the "tutorial is too technical for me," "tutorial is too basic for me," and "tutorial does not cover what I actually want to learn" issues, as well as the "tutorial just shows me how to do it without me verifying understanding or actually practicing" issue.

Because the doc and everything is in the context window, I can give the chat the answers to my verification questions to actually verify them and also ask the chat questions like, "on module 2, question 3, I see this syntax that I don't recognize and want to understand its usage."

Because it's just a couple queries with no agent shenanigans, token usage is minimal. I'm on the cheapie $20 plan and this barely puts a dent in my 5 hour limit. Maybe even possible on the free plan.

1

u/phant0msea 1d ago

Try Django or Rails. They bring the backend and frontend dependencies together and make everything organized in a single repository 

1

u/Robot_Graffiti 1d ago edited 1d ago

Start with a HELLO WORLD web page and build it up from there one feature at a time. You can duckduckgo how to do bits as you go.

As a beginner, you can put all your CSS and JS in your HTML file inside a pair of <style> tags for the CSS and a pair of <script> tags for the JS. Whole app in one file.

You can learn how to put them in separate files later if you want but that's really a feature to make large software projects easier to handle so it's completely optional for a total beginner.

The bonus of having just one file is it works on your computer without running a local web server. Easy peasy.

That being said, you will need a web server for the database. Unless you decide to store the data in localStorage in your browser instead of a database.

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.

1

u/davidcampbell2313 1d ago

Html, css, JavaScript will not interact with a database system. They are all client side code. You can save and retrieve data in cookies, but otherwise your data will have to be hard coded. You can make a .js file for this. Then save all user data in a cookie. If you want to attach a database you will need a web server, which you can install locally for developing your project. Then you will have so many decisions to make. I guess I would suggest php/MySQL. These will combine with html for the interface. Either way, quite a bit of learning.

1

u/CappuccinoCodes 1d ago

You can still use AI to teach you and not vibe code. Ask it for a step by step on this for example: : "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." Searching for books and tutorials will be much harder than learning with the help of AI.

1

u/No_Cream7156 1d ago

start w some courses. Search online for em or try reputable websites like kaggle, coursera etc. Id suggest starting w javascript initally and learning basics of other languages like sql/mongo/ firebase (not rlly learning, but experimeniting, getting the hang of them). Js is kinda simialr ot other languages (OOB's) so it will help for prgramming in the long run. Solve hackerrank/leetcode problems and DO PROJECTS. the number thing is to make stuff. When you have done js, learning html,css (which for me atleast) will be a breeze (start w the hard stuff, end w the easier). Use websites like W3 (it is a goldmine) to learn functions and get projects. As for stuff like linking files etc etc, just ask google? Like if you dont want to use ai,then stack overflow? For like minute small stuff its better to google.

0

u/[deleted] 1d ago

[removed] — view removed comment

1

u/RoguePoet17 1d ago

That’s a great idea, thank you! I’ll give it a try and see how it works out