Building the Same App Using Various Web Frameworks
The author compares web frameworks FastAPI, FastHTML, Next.js, and SvelteKit by building the same application, noting their unique features and complexities, while expressing interest in TypeScript and learning resources.
Read original articleThe article discusses the author's exploration of various web frameworks by building the same application, "Look at Your Data," using FastAPI, FastHTML, Next.js, and SvelteKit. The application allows users to upload a CSV file, view and manipulate data in an SQLite database, and download the updated data. The author begins with FastAPI, noting its straightforward implementation, and then transitions to FastHTML, which offers a more Python-centric approach. Next.js is highlighted for its extensive ecosystem and structured organization, while SvelteKit is praised for its lightweight design and ease of use. The author also experimented with combining FastAPI and Svelte, facing challenges in server communication. Additionally, the article reflects on the potential impact of coding assistants on developers' choices, particularly regarding newer frameworks like FastHTML and Svelte, which may not yet be well-represented in training data for these tools. The author concludes by expressing interest in further developing skills in TypeScript and invites readers to share useful resources for learning Next.js and Svelte.
- The author built the same app using FastAPI, FastHTML, Next.js, and SvelteKit to compare frameworks.
- Each framework has unique features and varying levels of complexity in implementation.
- FastAPI was noted for its straightforwardness, while Next.js and SvelteKit provided structured approaches.
- The article discusses the influence of coding assistants on the adoption of newer frameworks.
- The author is interested in further developing with TypeScript and seeks resources for learning.
Related
I'll just have vanilla thanks.
The downside is that this is a stateful monolithic approach that requires a server running 24x7 and can break without some effort to cache and reduce the load on the database. They are also often memory-hungry frameworks.
The tradeoff for productivity is worth it in my view, for the vast majority of cases where it's just a small team of 1-3 developers.
It has it's compromises but it's great for just building stuff, with UI updates streamed to the client, no JS (or as much as you want), no extra API building just for the sake of your SPA. Note that I'm not talking about Blazor WASM.
If you're interested in working as a developer for corporations outside of the SF bubble (e.g. the other 80% that use Windows instead of macOS) it's worth checking out, especially for internal corporate stuff.
In cursor settings, click features and then add the documentation URL for each framework or library you are using so they can be indexed.
It would be best if you did this regardless of how well trained a model is on certain code - it helps immensely.
FastHTML has markdown formatted docs which can be used by Claude, just add .md to the end of the URL:
https://docs.fastht.ml/ref/handlers.html.md
You can find markdown docs for most libraries on GiHub, where you can have Cursor index.
I suspect that with the increased use of LLM-aware code editors, single-page markdown-formatted documentation will become more common (even better would be if Cursor hosted an external vector db with up-to-date docs and tutorials for all the most popular libraries and frameworks).
- https://nextjs.org/docs/app/building-your-application/data-f...
For example, the sample projects store passwords in plaintext if they even allow login, which most don’t.
I really wish there was a way to use the FastHTML fast tags in FastAPI, so that I could use their cool HTML generator, but have robust and reliable deployment and auth, and possibly migrate to FastHTML once it’s a more mature product.
Second, it should consist of completely different programming languages like C#, Ruby, PHP, JavaScript, Python, Go etc. Hopefully I will do it one day.
Last, what's the end result?
Yes, but also more stale code from old versions which use patterns that the community has for various reasons moved on from. I ran into a lot of trouble with deprecated patterns while teaching myself react last year with assistants on the side. React 17 and prior version patterns kept coming up all the time.
This type of app is a prime use case for something like LiveView or a Go framework. Just today I had the most marvelous experience using Tailscale's ACP, where I've changed the ACL and it instantly saved it. It was so fast I had to make sure it's not optimistic UI, and sure enough, 78ms round trip for the request.
Even if it was a FE-heavy app using SQLite in the browser, I wouldn't have used JavaScript. After months of Gleam, I am spoiled.
The days of JavaScript-because-we-have-to are thankfully over. JS is now only for when the flexibility is required.
csv_data = [",".join(map(str, tbl.columns_dict))]
csv_data += [",".join(map(str, row.values())) for row in tbl()]
Sigh. He's not "building the app". This code is wrong. It's not escaping the CSV properly, so embedded commas and similar control characters will result in gibberish output.I'm just so fed up with this JS+HTML SPA framework demos where everybody thinks that stringly-typed programming is the only way to do things, where instead of using a proper library that actually encodes/decodes file formats properly there's this kind of quick & dirty script snippet that is basically broken under all but ideal conditions. ("It worked, once, on my computer, with toy data. Job done!")
I get it, this exercise is about comparing the essentials of different frameworks. But that comparison ought to include things that matter, such as correct handling of Accept-Language, safe escaping of data, sorting on date columns, virtualising lists too big to handle in one go, etc... That's what actually matters, that's what takes actual time when getting something to production. Not the folder structure or file naming conventions.
The author mentions "How will coding assistants influence builders?" but ChatGPT can spot this kind of error, and more: https://chatgpt.com/share/793e6353-817f-4765-ab33-f313190637...