←back to thread

82 points jaysylvester | 3 comments | | HN request time: 0.792s | 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
korkybuchek ◴[] No.41863143[source]
Are there any tests for this library? And it looks like you don't support Typescript, is that planned?
replies(2): >>41863349 #>>41866242 #
1. jaysylvester ◴[] No.41866242[source]
Question: would you expect it (or want it) to use a runner or a transpiler? Or does it not matter?
replies(1): >>41872387 #
2. korkybuchek ◴[] No.41872387[source]
Couple of angles to this:

- I'd expect to be able to write typescript and have HMR work (which is not trivial)

- I'd expect a watch mode for my _own_ tests as well, also in TS

replies(1): >>41873196 #
3. jaysylvester ◴[] No.41873196[source]
I think the first request isn't all that bad. Something like:

1. Transpile .ts modules to .js on app startup (development mode only)

2. Import .js modules into citizen as it does today

3. Watch for updates to .ts files and transpile to .js

4. Watch for updates to .js files and reload the module as it does today

I'm assuming you wouldn't want the transpiled JS modules sitting alongside their TS sources due to cleanliness, so I'd have to figure that part out.

The second request, no idea, since I've never written a test in my life :)