5 ms·
What frameworks are recommended nowadays for Typescript? Is Express still dominant here or are there TS-first options?
by vector_spaces 6y ago
What frameworks are recommended nowadays for Typescript? Is Express still dominant here or are there TS-first options?
- runarberg 6y agoIf you want static types you can still use typescript in JavaScript as doc comments. If you really want the syntax as well you can always compile your code down to javascript before. So express works just as well with typescript as it does with JavaScript
- Azeralthefallen 6y agonest.js is fantastic. https://nestjs.com/ https://nestjs.com/
- ducharmdev 6y agoAgreed - trying out nest.js the first time gave me hope that we'd see something like Django for typescript/javascript. Especially paired with nx workspaces, with shared code between front & backend... so nice.
- enumjorge 6y agoHow's their authentication solution? Auth is such a critical component of most web apps, yet something that IMO a lot of web frameworks don't fully flesh out compared to how easy it is with Django. I took a quick look at their auth docs, and while the docs seem pretty detailed, I noticed it involves multiple packages (@nestjs/passport, passport, passport-local, and their corresponding types) that you then have to glue together into a full solution. The instructions also apparently only show you how to store passwords in plain text, and using something like bcrypt to do it yourself is an exercise left to the reader. Not rocket science, as this [1] (older) article pointed out, it's hard finding quality auth-related tutorials in the Node ecosystem. With Django a lot of this stuff is built-in and solidly implemented. Granted, this was after a quick look at the docs, so my impression might be off. [0] https://docs.nestjs.com/security/authentication https://docs.nestjs.com/security/authentication [1] https://hackernoon.com/your-node-js-authentication-tutorial-is-wrong-f1a3bf831a46 https://hackernoon.com/your-node-js-authentication-tutorial-...
- nicoburns 6y agoWhat do you find you get from auth libraries? I've always found them much more trouble than they're worth. But I feel like I must be missing something.
- Blahah 6y agoPassportjs is the standard across all these frameworks. It's modular by design, so you can easily compose the right auth system for your needs. I've always found it quite intuitive and I've never seen anything even nearly as comprehensive in any language. http://www.passportjs.org/ http://www.passportjs.org/
- krono 6y agoEvery single typescript oriented library that I've tried has had a pretty atrocious dev experience and no end of compatibility issues. I love typescript, but the ecosystem is without a doubt one of the biggest detractors.
- girvo 6y agoNestJS is quite a bit better in that regard, but in general I agree with your overall point. What do you feel most of these frameworks are missing re. dev experience?
- krono 6y agoMostly use other languages for back-end systems, but I will definitely be checking out NestJS soon. With regards to TS, generally, it takes a lot of effort to get it to work. More often than not, getting to that point in a way that is actually useful/practical and cost effective, requires yet another library to be installed. Just look at the TSLint/ESLint migration problems, the popularity of all those TS runners such as ts-node/ts-node-dev/tsx-watch/ts-babel/etc., the complete lack of interoperability between all those separate pieces. Many issues and even proposed fixes to parts of the TS ecosystem - which is all community ran - are either ignored, left open because no one seems to be able to figure it out, or deemed to be out of scope. I don't know how to fix this honestly. Some leadership from Microsoft would be a good start.
- girvo 6y agoYeah that’s fair: I’m a bit of an early adopter of Deno [0] for that reason, it helps standardise quite a bit of that. Promising, anyway, if a bit rough currently. [0] https://deno.land https://deno.land
- Kaze404 6y agoYou don't need any of those. TSLint was deprecated long ago, and TS runners are only mildly useful in development (to the point where I don't bother and just `tsc && node dist`). Are you sure it's a problem with the ecosystem?
- foolofatom 6y agoI've been using https://tsed.io/ https://tsed.io/ with great success.
- zumu 6y agoI've been out of the JS/TS world for a couple years. Are decorators everywhere now? I will be very sad if so.
- mssundaram 6y agoMy experience is only n=3 but I've only rarely seen them where I've worked over the past 5 years. The only sane use case I've seen was for tagging logs and metrics.
- pas 6y agoTSed has a great dependency injection system, and uses decorators for a few things, I did not find its use excessive.
- girvo 6y agoI second the NestJS recommendation, but I’ve also got quite far using pretty stock standard Express style middleware with Deno. It’s been a fun experience.
- simplify 6y agoTwo I've been lightly following are Redwood[0] and Blitz[1]. Still a long ways behind something like Rails, but promising nonetheless. [0] https://github.com/blitz-js/blitz https://github.com/blitz-js/blitz [1] https://github.com/redwoodjs/redwood https://github.com/redwoodjs/redwood
- joshxyz 6y agoMy codes are written on JS but the sensitive parts are heavily commented with TS types so my vscode intellisense could assist me with correct types. /* * @type {Map<String, Number>} */ const map = new Map(); Like that. Express JS is still shit, koajs and fastify are a little better, I used to use nodejs's internal http and https libraries directly but these days uwebsockets.js is what you'd want since it's mature enough already (used by top crypto exchanges). https://github.com/uNetworking/uWebSockets.js/ https://github.com/uNetworking/uWebSockets.js/ And oh it comes with TS types which are cool.