Ask HN: How do I build a website as a backend engineer?
Over the years, I have accumulated many “calculators” in various spreadsheets to make my personal life easier: tax simulations, startup equity, investment allocation, real estate, …
Clearly calculators online are a dime a dozen, yet I’ve never found the competition (top hits on Google) as accurate as mine, they all seem very wonky, slapped together quickly and missing important details.
What would be the path of least friction to produce a no-backend static website that can host these calculators? I believe that with the right intuitive UX and user-friendly features (i.e. persist the input in the URL query string, instant recomputation on input change, …) they could be valuable for someone.
For context, I’m a software engineer working in FAANG as a backend developer in distributed systems and Linux kernel for many years. I just really dislike dealing with anything frontend-related and I’m utterly incompetent in it, I find CSS to be the biggest monster in computer science (and I troubleshooted bugs in distributed consensus algorithms, ha!), so I’m ideally looking for a framework/template where I can mostly focus on my business logic functions/invariants and get as a result a few static assets to host.
Thanks!
83 comments
[ 2.7 ms ] story [ 151 ms ] threadOtherwise the Python community likes to avoid touching anything that is not Python. Dash Plotly or Streamlit are great tools to make web apps in Python.
As for functionality, if you're "just" doing some calculations and presenting it like a spreadsheet, you probably don't need a framework. Some plain Javascript onChange event listeners for your various input fields might be all you need.
It compiles to javascript and will generate an index.html for you if you want.
Elm is highly opinionated… maybe you’ll love it, or maybe you’ll hate it, but it’s a good fit for what you want to do.
https://elm-lang.org/
Some programmer who isn't familiar with the front-end world probably is going to develop a website by copying and pasting little HTML/CSS/JS snippets they find online that kinda solves their problems. It's not going to be particularly pretty code (and that's ok), but with a little brute force effort, they'll eventually make it work.
But using something like Elm means that probably somewhere near ~99% of the HTML/CSS/JS examples you find online aren't going to be helpful examples for you that you can easily translate into your own work.
Short of hiring/partnering with someone, learning yourself is the closest best bet.
I'd say have the api ready, go through vuejs tutorials to build something, and then ask for help ?
https://css-for-js.dev is a good course.
Instead of asking me to explain why OP should prioritise styling, why don’t you explain how styling allows OP to build financial calculators? Form over function is not a good thing and I would expect HN readers to understand this?
For what its worth, I never said OP should prioritize CSS, you are assuming my stance improperly, something you probably do often. I merely suggested you be helpful and give constructive criticism rather than shoving half an opinion down another's throat.
So you continue the personal attacks then? You say I'm assuming something and yet you indicated the goal of learning CSS was somehow the priority for OP.
> I merely suggested you be helpful and give constructive criticism rather than shoving half an opinion down another's throat.
I already gave quite an extensive series of steps with numerous possible sub-steps which is helpful. Not sure why that is shoving anything down anybodies throat. Certainly more advice than "go ask frontend engineers you already know" which I imagine OP may have already done but wanted to ask a wider audience.
You definitely seem annoyed, especially as it sounds like you're really quite fixated on guessing lots about me. I suggest you re-read HN rules.
I also suggest react because after extensively using multiple frameworks I can say without a doubt the react ecosystem stands out far above the rest. There’s many high quality graph and table libraries for React. And having also dealt with integrating these sorts of libraries into component frameworks, it’s just not the sort of thing you want to waste time on.
As for language I would highly recommend just embracing TypeScript and skipping JavaScript. This will certainly help eliminate a whole class of potential frontend-typical problems like strings being interpreted as numbers due to developer error.
For styling I would use tailwind (although if using react styled-components is another approach, but tailwind definitely gets out of your way). This will easily get you past the styling problem you mentioned.
For hosting I would use Vercel. I would have suggested Netlify and really both are good but I’m considering migrating my sites to Vercel because netlify appears to load CSS files in a weird order, but that’s not too relevant to the discussion here I suppose.
Happy to answer anymore questions or help you get started with the code and implementation - contact links in profile! I hope this advice has been practical.
Telling someone to just “use css html and js” is about as helpful as telling someone to “just write code”.
(Don't worry I know you're joking).
But you and many others picked up on the implicit premise of this request: to make it in a form that ranks highly on search. A form that is monetizable even if it doesn't help as much. To be clear, I realized this too but I still wanted to point out the more helpful way to cut this for-profit gordion knot.
Maximize help instead of monetization and it's suddenly simple. And you can even work on making a JS/CSS web application after the 15 minutes the simple html+files way takes. Maybe someone else will even make it for you using the spreadsheets you put out. That'd save a lot of time and help everyone the same amount.
I also disagree that downloadable HTML files are a good solution here.
Downloading html files and then opening then isn’t really feasible for anyone outside the tech bubble we are in.
Bootstrap is very popular and easy to find components for.
For simple interactions look into htmx or alpinejs. Or jquery.
These recommendations presume you want to get things off the ground asap, without spending months learning.
Learn the tool designed for the puropse instead of looking for shortcuts
Providing the actual spreadsheet files directly will be of far more use to other people than trying to turn them into an inferior website.
Also, I would stay far away from any Javascript package manager. Your calculator should be working for 10 years at least since HTML, CSS, plain Javascript, and Rust will most likely still work in 10 years and math doesn’t change either.
Maybe I’m misunderstanding your use case, but if you want to create web apps out of your backend work, streamlit may be your ticket for “easy to understand on the back end, hyper-simple front end.”
At least worth giving it a look.
https://streamlit.io/
This is literally the reason frameworks exist: to handle user input, managing state over time, and then updating the UI in response to changing of state.
By suggesting a framework like I did, allows OP to focus on writing the actual calculation code and and to build their site - not spending time writing user inputs and bindings and manual DOM updates.
You do make a good point (perhaps accidentally) about libraries for output. As a backend dev, the opening poster should be able to understand the concept of magicLibrary.drawGraphyThingy(wowSuchValues);
tldr: DOM bad. Simple form submission and using server for heavy lifting is alternative. Using full power of modern tools is another alternative. Definitely mutually exclusive.
I have made little tools like this in pure html and JS before. Its really quite straight forward and using a framework is overkill.
Also, could you explain how sending the data to a server is the answer when OP specifically asked for a static site without a backend? You did read the question in full before deciding on the answer, I hope.
If he/she doesn't want to learn front end, just dumping data to an API is a workable solution. If he/she really wants to go the quoted route - sure, learn everything. Again though, SPAs are NOT a substitute for learning HTML/CSS/JS basics. At the end of the day, he has to understand that || is raw Javascript, even though it's used to render or not render. That creating a <tr> from data is actually populating a <table> that needs a <th>, etc, etc.
So what we are recommending is "work around all that to your strengths". Your solution is pretty much "learn front end".
I would deploy using Netlify with their CDN or Cloudflare.
The best I've found is NextJS (you can use their API support if you don't have a separate one yet) + Chakra UI (removes practically all the need for css).
You can pick it up in a weekend and build beautiful products.
Find some minimal CSS framework. My preference is Skeleton [0] or Bootstrap [1]. The key is just finding something minimal that works without too much fuss. Personally, I rather have a minimal framework provide 'responsiveness' so I don't have to worry about it but I also want it to get out of the way of anything I do.
Use JQuery [2]. Don't rely on CSS for animations or interactivity. In theory CSS does a lot. In practice it's a nightmare to use and to get it play well with whatever else I'm doing in the page.
Write in "bare" HTML and "vanilla" JavaScript. Don't use a static site generator and don't use a JavaScript framework.
Port in JavaScript libraries as needed. Some of the ones I tend to use are numeric.js [3], downlaod.js [4] and audience-minutes [5]. If you're doing spreadsheet things, maybe there's some JS package out there that will help.
Doing "raw" HTML/"vanilla" JavaScript makes me effectively unhirable but for limited scope side projects where I have full control and want to minimize bit-rot, this is fine.
The point is to create something that's minimal and focuses on functionality. The CSS is just there to make it not look like a Web 1.0 page but otherwise steps out of the way to focus on the actual usage of the application.
For context, here are some projects where I've used this philosophy (all open source, feel free to pilfer): Noixer [6], Resonator Voyant Tarot [7], Boston Train Track (now defunct) [8], CalebHarrington.com (an artist friend) [9], What Is This License [10], HSV Hero [11].
[0] http://getskeleton.com/
[1] https://getbootstrap.com/
[2] https://jquery.com/
[3] https://github.com/sloisel/numeric
[4] https://github.com/rndme/download
[5] https://github.com/berthubert/audience-minutes
[6] https://mechaelephant.com/noixer/
[7] https://abetusk.github.io/ResonatorVoyantTarot/
[8] https://github.com/abetusk/bostontraintrack
[9] https://calebharrington.com/
[10] https://mechaelephant.com/whatisthislicense/
[11] https://mechaelephant.com/hsvhero
I think these tools should work for someone coming in without prior experience and figuring it out from the docs.