HACKER Q&A
📣 lukcybrain

Looking for a lightweight and simple engine for dynamic page rendering


I want to implement a website similar to HN, but I don't want to/not familiar with the front end(it's ok but debugging is too slow).

the basic requirements are link tags,forms,lists, and simple styles.

The key point is that data needs to be dynamically rendered through a small server side,not static documents I thought about the Markdown document rendering engine.

Compared to HTML,I prefer the Markdown syntax, but it seems there is not way to submission or data exchange with the server.[Perhaps it can be achieved by extending the syntax?]

Or there might be some technologies that I haven't learned about yet that can achieve this?


  👤 wruza Accepted Answer ✓
Sounds like a web 1.0 http server with a pug-like html templater and some popular css framework.

👤 solardev
> I want to implement a website similar to HN, but I don't want to/not familiar with the front end

OP, it was a bit unclear from your post: What technologies are you already familiar with? Does this mean you can already comfortably make the backend (DB, API, etc.), or is that part unfamiliar too?

> The key point is that data needs to be dynamically rendered through a small server side,not static documents

That's fine, but that doesn't really narrow it down by much. You can use any sort of backend stack that can output HTML, but there's a million of them to choose from, and probably a dozen good & popular ones.

Even if you had a heavy and partially static frontend, you would still need a backend (or serverless) to persist data in anyway. Persistent data lives on the server and the rendering will always happen on the client because HTML is ultimately rendered by the browser. What's different is where application logic happens (clientside in JS, or sent as data to the backend for some other language to process). Even if you had a partially static site, normally parts of it would still be dynamic and update from AJAX calls. Ultimately the frontend and backend will always work together, but where you want to draw the particular lines is entirely up to you.

> Compared to HTML,I prefer the Markdown syntax

Me too, but unfortunately Markdown just isn't expressive enough for something like this. It doesn't have logical functions or network functions.

If you want interactivity, you need some sort of scripting language on top of a document markup language (which is all Markdown is). These are often called templating engines, and were really popular in the past (90s-2010s) before the JS frameworks took over everything... the folks that used to use them now use React/Vue/Svelte/etc.

There are also in-between systems, like HTMX + Alpine that's popular on HN.

If you want to go the more traditional route and do the logic on the server, PHP is the most obvious serverside system for something like this (maybe with Laravel & Blade or Symfony & Twig), or people build their own too (like Shopify did with Liquid: https://shopify.dev/docs/api/liquid#what_is_a_template_langu...), Django for Python, etc. There are probably similar ones for Java, Go, Rust, and whatever other language you prefer to work in. But ultimately you need something that can process both content markup/styling and also logic, which Markdown can't do on its own. You don't necessarily need to do everything on the frontend, but it's helpful for the user to be able to do certain things (like upvoting) via AJAX without having to redownload a whole new page from your server. So it's worth thinking about what logic should vs shouldn't live on the frontend.

Whatever you do, you might wanna take a look at other HN clones to see how other people have made similar software: https://www.google.com/search?q=github+HN+clones&ie=UTF-8

--------------

If you don't wanna do any of this yourself, you can also just consider running a Discourse system (or pay for a hosted one) and add a voting plugin... might be similar enough.