Hacker News new | ask | show | jobs
by justsomeuser 1242 days ago
- Server: Node.js + SQLite

I know JS very well, so writing HTTP handlers is quite fast.

Node runs on V8, which is probably the fastest runtime for dynamic code.

SQLite makes development easier as it’s just a file, gives you ACID.

- Frontend: React/Mobx/Tailwind SPA hosted on firebase hosting.

I think the concept of JSX (write your HTML with JS) is good as it gives you a real language instead of a restricted templating DSL.

Tailwind for the fast iteration speed.

Firebase hosting for the simple CLI and fast CDN.

- OS and hosting: Docker running on Google Container Linux

Docker so that the OS level dependencies of my server are defined somewhere.

Container Linux as it auto updates and has all the GCP logging and monitoring built in.

GCP for the incremental disk snapshots for simple backup of the SQLite state.

If I had to scale the service I would add more CPU cores and faster disk. I would also move the parts that need scaling to Go/Rust, and design the code to make use of the cores.

A few principles I use when choosing tech:

- Avoid distributed state (network boundaries) when possible (SQLite instead of SQL server, function calls instead of micro services).

- Use tools for their primary purpose. No shoehorning. Issues arise when you try to use something for what it was not designed exactly for. If you have >3 tools in your stack that you are shoehorning, things are more likely to break in the future.

- Things should still work in 10 years with minimal updates. Lindy effect. Bet on older tools if possible as they are more likely to be around and maintained.

- Good enough vs optimal: stop trying to find the perfect tech. Web tech is sometimes messy and imperfect. Opinion over what is right changes.

3 comments

> I think the concept of JSX (write your HTML with JS) is good as it gives you a real language instead of a restricted templating DSL.

I never got this reasoning. In Vue the idea is:

* Write html templates in HTML

* Call javascript from the template to do javascript things (i.e. computed properties and methods)

This has always made the most sense to me, conceptually.

Sure Vue gives you a DSL for looping template elements (v-for) or showing template elements (v-if), but almost all the typical javascript action happens inside typical javascript calls.

JSX shines if you use TS. Mostly because tsx has excellent code completion, type checking and refactoring tools.

It eliminates entire classes of human errors.

I’m keen on this approach for my next project.

Can you share any Dockerfiles / scripts you use to get going with this?

Sorry I do not, although I have been meaning to publish the "skeleton" template repo's I have locally.

There are two template repos I use: `web-ui` and `server`

The both have a `sh` dir with common commands in .sh files (watch tailwind, watch esbuild, browsersync to serve and live reload during dev).

You config Google Container Linux with a `cloud-config.yaml`, which can take a bit of time to tailor at first, but after that every project uses the same config with small changes. I use Caddy to terminate HTTPS (it will auto generate and renew certs).

If you have a contact I can message you when I put them on Github.

Interesting. Thanks for the tips. I’m ccorcos@gmail — would appreciate the notification when/if you put on GitHub. Thanks!
What do you use for auth?
Just a normal create-user/login form. Or Firebase Auth if Google and other sign in's need to be supported.
In the former case, are you managing signups, password resets...?
Yes, I write those parts myself.