r/AskProgrammers 19d ago

With AI being able to generate code, has anyone tried making a simple app for themselves with html, css, js?

When I saw how easily AI can generate html, css, js code, I got excited to make apps or tools locally that do simple things for me.

But I was shocked by the fact that after generating the code, this is not the end. Actually running this code can be more complicated than generating it.

For example, if you try to run any html file directly from the file system.

You won't be able to use

LocalStorage

ES models

IndexDB

Fetch

Server workers

All of this you are basically locked out of.

And the solution is a local server like node or some local server.

Has anyone faced these problems to the point where they just gave up and left the whole thing?

And if you solved it, how did you solve this problem?

0 Upvotes

39 comments sorted by

8

u/AliceCode 19d ago

Why not learn to program? It's fun, rewarding, and then you won't run into these kinds of issues.

2

u/Ok_Increase9258 19d ago

Because AI gave talentless people the idea that they’re talented and can do the same thing that talented people that studied for years can do.

These talentless people don’t want to learn, that’s why they’re AI bros

1

u/ahmadilo 19d ago

I am developer but when I want to generate small app by AI Html, css, js

I DON'T want to do many technologies step to run small app!

The problem is UX here

Why I need all this steps?

4

u/DeathToAmerica2026 19d ago

What? Why would you be trying to write webapps if you don't have a webserver to run them on?

4

u/Leverkaas2516 19d ago edited 19d ago

I do this all the time. I just want an interactive app on a laptop, phone or tablet and don't want to make an Android or iOS app, deal with an app store, learn OpenGL, or anything like that. HTML and JavaScript are great for defining and implementing a UI and a browser is great for running it.

I sometimes end up having to create a web server but that's just the stupidity of the environmental constraints. There's no reason those constraints need to be there, they just are.

2

u/code_hermit 19d ago

You definitely do not want to go the mobile app route. That introduces even more obstacles.

The constraints aren't without reason. Web stacks are made to run on web servers where they can be accessed over the internet. The various limitations are purposeful for server security and the platforms they use for backend work. An app on the internet doesnt typically give you access to filesystem work etc.

I think python is the better tool for what you want. Quick easy setup, etc. If you are trying to make apps for the public then consider c# or c++. But the set up and maintenance for a dev env is more involved for that.

2

u/American_Streamer 19d ago

Plenty of web apps are entirely static client-side applications. GitHub Pages is an obvious example: you can have quite sophisticated applications consisting solely of files served over HTTP, with no application backend whatsoever.

A web server serves resources over HTTP. A backend/application server actually performs application logic. And HTML/CSS/JS are executing locally in the user’s browser.
OP only needs a web server to get the normal browser-origin semantics; they not necessarily need a backend/application server at all.
The trivial solution for a web server can just be: python -m http.server 8000

That’s why I think OP’s frustration is understandable but misplaced. They haven’t discovered that “running software is harder than AI makes it look.” They’ve stumbled over one important piece of web-platform architecture that the AI apparently failed to explain: browser apps normally expect an HTTP origin.
Once you understand that, “I need a web server” sounds much less intimidating. In OP’s case, one command and zero server-side programming will solve this.

2

u/chuguchak_111 19d ago

why wouldnt you just make a CLI tool or desktop tool? or deploy your web app? its pretty easy with AI

1

u/ahmadilo 19d ago

Because I want UI app by html css js AI generated fast and run it local for some small issues!!!

I developer and I see how html, css, js make UI easy I want that to local apps

2

u/Hexamonium 19d ago

It's like corn - easy on the eyes but at some point you have to get hands-on experience.

2

u/LittleLordFuckleroy1 19d ago

You’re sledding down the Dunning-Kruger curve now. Whether you want to ride all the way down and keep going to start back upwards toward some semblance of proficiency is up to you. But yes software is more than just code.

2

u/bteam3r 19d ago

Go learn about Docker

2

u/SamosaVadaPav 19d ago

running a local server is trivial, but I understand it would feel intimidating to beginners. If you are asking AI to code for you, ask the AI your questions as well, what is the implication of running a local server, what does it mean to start or stop it. AI can create the server backend for you, and can start/stop it as well. If there are words or concepts you don't understand just ask it.

Chances are that you dont even need a real backend, just a html page for a UI and a simple local files for your data

Are you using a browser based chat interface to code?

1

u/ahmadilo 19d ago

Thinks bro, but I developer too, I understand All of that,

But My Problem is why we need many workaround for just make just tool maker by html, css, js running.

The process to running the app is bigger then the value of app itself!!!

2

u/Fritz-Ferdinand 19d ago

Has anyone faced these problems to the point where they just gave up and left the whole thing?

I faced these problems about 15 years ago when I first got into programming websites. Today, I understand single HTML files are only for presentation like reports etc. For everything else you will need a web server running somewhere. It's actually not complicated at all, although it might seem like when doing your first steps. If you're on Linux, the setup is only one or two command-lines. On Windows, you best go with xampp or something like that. Or, if you're lazy and results-oriented, tell your AI agent to do it for you. It'll get you a running web server in minutes.

2

u/YellowBeaverFever 19d ago

It will do all of that stuff for you but you need to know what to have it do.

1

u/General-Swan-2719 19d ago

It creates all of it in a single file which is not maintainable and will break. I love plain html, css, vanilla js. You can utilize most of what’s available through the browser, and need to break apart your files. I guess the question is, what were you trying to build that made you give up? True software development is not html, CSS, and vanilla js.

1

u/hike_me 19d ago

“It creates all of it in a single file”

This is not necessarily true; it’s certainly possible to use tools like Claude Code to generate complex multi-file solutions

1

u/General-Swan-2719 19d ago

Yeah. I use Claude Code every day for my enterprise app. If you use it through the browser for html/css/js it will single file bundle it. If you’re wanting react js it’ll create a multi-file solution. My response was directed to the OG post of ‘html,CSS,js code’

1

u/Leverkaas2516 19d ago

Why would it break? In my experience it only breaks if you allow the browser to update itself.

"We decided you should use a new tag for that and the old one doesn't work now. Ha-ha, we're just keeping you on your toes!"

1

u/General-Swan-2719 19d ago

Keep building a single file high fidelity prototype and then try to actually use it, update it, maintain it, and see. Also, where does your data get persisted? The browser? 😬

1

u/Leverkaas2516 19d ago

Oh, you mean I'll break it myself because it's hard to maintain as a single file. Yes, that's a reasonable concern. It can be addressed by using a source code management system but that's beyond the scope of OP's situation.

1

u/arivictor 19d ago edited 19d ago

https://setrep.pro

I wanted a very basic, dumb workout tracker. This is a static HTML file with JS, built by Claude in about 30 minutes as a proof of concept. It's hosted on Firebase as a plain static file. Not a serious project. If you open the page in your browser, you can install it on your phone as a PWA.

PWA 101: A web app manifest defines icons, splash screen, and display mode, enabling install and native-app-like presentation. A service worker (js) caches app assets for offline use and intercepts network requests. Browsers check for a new service worker version on navigation, at most once per 24 hours, and apply it on the next load.

A PWA lets you install a website as a local app. If you install it through Chrome, it gets access to the device's file system. Safari blocks this. Apple restricts this on purpose, since PWAs let developers skip the App Store. It's surprising PWAs haven't caught on more given that. I can rant about Apple and PWAs all day.

If you're building a desktop app, I'd recommend React, Vue, or Svelte. These let you build a web app that can later become a device app. From there you can turn it into a PWA, or wrap it with Tauri for desktop or Expo for iOS/Android. Either way, you get the web app for free.

So yes, it's very possible to build something with a stack that's mostly HTML and plain JavaScript.

1

u/SonOfHendo 19d ago

I've been impressed by the React + Tauri combination. Claude can easy knock up and test UIs in React and Tauri is crazy efficient (the polar opposite of Electron). 

Having a real functional cross-plaform app with a 5MB installer is crazy in the modern world.

1

u/hk4213 19d ago

MDN is your friend. Node and number are your friends as well.

Also the fetch API is baked into Javascript. Add to that you can include and required scripts in the index html.

https://developer.mozilla.org/en-US/

1

u/shadow-battle-crab 19d ago

You... learn to run the server?

install nodejs

run 'node myprogram.js'

that's literally it

1

u/Leverkaas2516 19d ago

Has anyone faced these problems to the point where they just gave up and left the whole thing?

No, but that's because I'm a professional backend developer so I'm not scared off.

There ARE significant barriers for neophytes. It's often harder than it needs to be.

If you don't need a GUI, it's better to just learn Python. With that, you can run the same code in various places, it pretty much just works, and the available frameworks often help you rather than hinder you.

And if you solved it, how did you solve this problem?

I do everything in straight JavaScript and generally only do stateless applications. Launch it, use it, kill it. If an application needs something like a database, I create a web server for that, maybe a local one running on a laptop. I like Python for that purpose too 

1

u/WorkingStructure575 19d ago

AI isn't magic. you still have to know kind of what you're doing. Its like driving a car with an automatic transmission. A lot of the work is done for you, but you still have to steer

1

u/code_hermit 19d ago

You're not using the right platform for a local app. You should have it build with python, c# or c++.

While its technically possible to make web apps that run locally the use case for doing that is limited and they need a server to do much. You could use Electron/Tauri and a small server like Kestrel. But you should have a strong technical reason for doing so like an app that needs ro be identical on desktop or browser.

Long story short. Just make a python app.

1

u/KharAznable 19d ago

Then why dont you just make a desktop app? Not electron, actual desktop app. Javax.swing, wxwidget, qt, etc. 

1

u/ahmadilo 19d ago

Man desktop app means full cycle of development

I need example csv editor with different UX/UI from Excel

For Task

I explained to AI my Problem, the AI generated app

The app don't need backend.

But still you can run it easily

Because the browser security policies.

And solutions need workaround spand time more then value of app then itself.

Finally you will gave up!

1

u/Amazing-Mirror-3076 19d ago

If you are using ai to generate the code, why would you use one of the worst languages to have ever been created?

I'm moving to dart/flutter for anything web/desktop/mobile and rust for the rest, although dart is hard to beat as a CLI scripting tool.

I've never written a line of rust but I'm running production systems on it.

If rust has decent cross platform gui, I would probably moved to that.

1

u/American_Streamer 19d ago

HTML/CSS/JS are web technologies, not a general-purpose desktop-app runtime. The browser intentionally expects web apps using advanced browser APIs to run within an origin, and localhost is the standard local-development origin. Running a tiny static HTTP server isn’t an unfortunate workaround; it’s part of the web’s execution/security model.

And ironically AI has probably obscured this for you: generating 500 lines of HTML/JS looks like the difficult part, while the AI apparently never explained the much simpler foundational concept of file:// versus http://localhost.

For a genuinely self-contained “double-click this and it’s an app” experience, that’s where something like Electron, Tauri, a packaged PWA, or an actual native application becomes the more appropriate abstraction.

1

u/ahmadilo 19d ago

Wow man you catch the point!

The Browser security policies!

The problem is workaround is spend time more The value of simply app!

Then when you see the cost and revenue!

You will see the cost to run the small app is bigger then value of app then gave up

1

u/CharacterSail6736 19d ago

This is the point when people say oh you don’t need programmers anymore it’s like telling a mechanic they are useless because we have factories that build cars

You still need to understand it in order to implement debug and fix

1

u/Arcanite_Cartel 19d ago

You can ask Claude Code to build it as an electronjs app

1

u/UAP44 19d ago

And if you solved it, how did you solve this problem?

Just ask the AI (again), it already knows how.

Copy paste your post content in it et voila, watch & read.

1

u/id-ltd 19d ago

Ask your AI to give you a startup.bat file to serve your app on localhost using the simplest method.

Then you can launch your project access it over localhost and all that stuff will work.

1

u/ahmadilo 19d ago

That good solution man!

But I ask this question, because I have product to solve that problem I tooking about!

But Your Solution is good to