←back to thread

82 points jaysylvester | 1 comments | | HN request time: 0.201s | source

Citizen is a web application framework I started building years ago when I was first learning Node. I've added features and improved stability/performance continuously and finally decided it was worthy of 1.0 status.

I think it might appeal to devs like me (old guys) who came up on app servers like ColdFusion, .NET, PHP, etc. and prefer the server do the heavy lifting. It doesn't dictate anything about your front end, and instead tries to be as flexible as possible in providing whatever output the client might need, whether it's a single fully-rendered HTML view, partials, JSON, or plain text.

Only 2 direct dependencies for terminal commands (commander) and file watching (chokidar). Built-in functionality includes zero-configuration server-side routing, session management, key/value store (cache rendered views, controller actions, objects, and static files), simple directives for managing cookies, sessions, redirects, and caches, and more.

It's been in continuous use on at least one site that receives hundreds of thousands of page views per month, running months at a time without the process crashing. Fairly stable.

Appreciate any comments/feedback/contributions.

Show context
danpalmer ◴[] No.41864598[source]
I grew up on Django and have separately seen and contributed to numerous Flask codebases. It has become abundantly clear to me that web apps of any real size that use the library approach (rather than framework) typically end up with a poorly documented internal-only framework anyway, and that plugging together libraries has a significant cost. In my experience this is significantly more of an issue in the JS/TS/Node/etc ecosystem.

My rule of thumb is to look at the feature list for a web framework (Django, Rails, Citizen, etc) – sessions, caching, ORM, rendering, routing, auth, admin, static files, APIs, serialisation, etc etc – and if you need 3 or more, just use a framework that has them all properly integrated.

Example, you're sticking an internal API on your ML model, you need one or two endpoints, and to return some JSON. Just use Flask/FastAPI or whatever the equivalent in your ecosystem is.

Alternatively, you're building a user-facing website, you need routing to endpoints, auth, sessions, and a database. Just use a big framework. You'll likely add more of those cross cutting concerns in the future anyway, and having them all work together rather than gluing libraries together will save a ton of time.

Citizen is the first convincing framework I've seen for this approach from the Node ecosystem. Congrats on the 1.0!

replies(2): >>41865763 #>>41873708 #
1. WD-42 ◴[] No.41865763[source]
Hard agree. I’ve been going by the 3 feature rule as well. I’ve seen so many flask projects that end up being poorly integrated django project equivalents. Seems that the entire node ecosystem is the same, until now I guess?