Ask HN: What are the best open source TypeScript projects I can learn from?

  • Depends whether you actually want to learn TypeScript or just how to consume it. More than 90% of TypeScript code I've seen is not actually taking advantage of TypeScript's static analysis capabilities to write safer more scalable code and is instead just being used as glorified autocomplete.

    If you actually want to learn, then take a look at the implementation for stuff like Zod: https://github.com/colinhacks/zod/tree/master/src/helpers

    You can do some really powerful stuff that hugely benefits your team. A decent example I stumbled across recently when I went to release my own library (that does the same thing) is https://github.com/leancodepl/ts-routes

  • I work on Linen https://github.com/Linen-dev/linen.dev its an open source Slack alternative. Its a full stack typescript app. We do a mono repo with typesharing between both client and backend. If you are looking for a realworld typescript SAAS app this would be good

  • This could be a good learning resource, a collection of client & server-side TypeScript projects.

    Awesome TypeScript - https://github.com/dzharii/awesome-typescript

    And here's a list of projects on GitHub tagged with the topic "TypeScript", sorted by most stars. Many build tools I see on the first page, starting with the TypeScript compiler itself - which is an impressive and interesting codebase, but it may not be so suitable for study purpose.

    https://github.com/topics/typescript

    You might enjoy learning from some books too.

    The TypeScript Handbook - https://www.typescriptlang.org/docs/handbook/intro.html

    TypeScript Deep Dive - https://basarat.gitbook.io/typescript/

  • This is not exactly a codebase, but I believe it merits mention in this thread as a great TypeScript learning resource.

    https://type-level-typescript.com/

    A short online course about intermediate-to-advanced level TypeScript.

  • Senior dev here. Recently have some extra time. Happy to offer some code reviews to help you get started. Contact info in bio

  • I'm part of the team that maintains a digital wallet browser extension with a really clean codebase — check it out.

    https://github.com/tallyhowallet/extension

  • I am working on a Node/browser OS in TypeScript to solve for decentralization/peer-to-peer relations if you want to check that out.

    https://github.com/prettydiff/share-file-systems

    Selling points:

    * No frameworks and minimal dependencies

    * The GUI loads in the browser with full state restoration in about 260ms in Chrome.

    * Full peer to peer file system access

    * Original WebSocket service support faster than the popular NPM packages (ws, socket.io)

    * Peer-to-peer end-to-end test automation in the browser that is faster and easier than the big browser test automation applications (puppeteer, playwrite)

    * I am currently working on a streaming command terminal for the browser for support for for things like vim and irssi. The current experimental terminal only supports basic command input/output

  • Zapatos, check out how it does type safe querying. Very impressive work and shows that typescript’s type model has a lot of power.

  • You should check out https://github.com/medusajs/medusa

    It’s an open source commerce engine built in Node w. TypeScript. The domain is fairly easy to wrap your head around and the architecture and code quality are often praised.

  • I've found NestJs to be a very thoughtful application framework. I'd argue it demonstrates pro-level typescript coding.

    https://github.com/nestjs/nest

  • I definitely wouldn’t say it’s the “best” open source project but my side project https://github.com/codeamigo/codeamigo is a full stack project written in TypeScript and I’m happy to answer any questions you have about it. Full project here: https://codeamigo.dev

  • Fp-ts and io-ts, best examples of what functional programming along with strict type safety can achieve. The source code is a pleasure to read and explore

  • This book gave me a good push in the right direction when I was in the same situation as you many years ago. It gave me the tools I needed, and it is still very relevant today. "old but not obsolete" as they say in the terminator movie.

    https://en.wikipedia.org/wiki/Code_Complete

  • I want to ask the same question for Python and Go. I'd love to see some quality OSS using Python or Go and contribute to them if I can.

  • I started working on a project to solve this exact issue https://github.com/mburst/protomolecule. I haven't spent too much time building out other frameworks, but the first framework is React + Express which fits what you're looking for

  • https://github.com/type-challenges/type-challenges

    The type challenges are a great thing to learn with. Admittedly, they're a bit intense but it's a great way to "expand your awareness".

    As a shameless self plug, I'm participating in a 140-day long project to do them all (complete with video explanations) that just started yesterday, if you wanna follow along: https://github.com/type-challenges/type-challenges/issues/21...

  • This could be a good place https://create.t3.gg (understanding all the code generation would be useful, but also you can deep dive into any one of the type safe libraries).

  • https://github.com/shadcn/taxonomy has been very useful for me learning the new Next.js 13 app/ React Server Components in Typescript.

  • Outline: https://github.com/outline/outline

    One of the best code base that I have seen, not just TypeScript.

  • This is such a valuable question for other languages too. I wonder if there's a repo/resource listing such projects..

    I asked a similar question about ruby some time ago, and came across one good recommendation (https://github.com/sharetribe/sharetribe), but would love to have many more. I'm also self-taught and feel I haven't read enough great ruby code!

  • For backend and general typescript knowledge, I’d highly recommend Apollo GraphQL: https://github.com/apollographql/apollo-server

    Check out their apollo-server and apollo-client repos. It’s a very useful codebase to be knowledgeable about. This is something you should mention in an interview as a strong positive if the company wants graphql experience.

  • https://github.com/preludejs for lightweight functional approach.

  • Meta question: I wonder what it would take to splat a code quality metric on every github repo. Obviously this is a combination of subjective and objective factors, but I wonder if doing this in bulk would lead to a general improvement in the industry. Particularly paired with CoPilot and having some sort of feedback into the training this would be pretty neat...

  • How about a different approach. Instead doing more of the same, branch out in to a different language. Elm, for example. [0]

    Elm specifically will teach you lots on the static types end of things. And it will only take a weekend or so of tinkering to show improvements in your TS life.

    0 - https://elm-lang.org/

  • Lolssss you’ve all been duped… this list will be used to train an ai model, which will then take over your job!!

  • I have the same question, but for Java. I'm was front-end developer that now learning back-end.

  • This one is good reading, it's the backend of a real-time 2D multiplayer war game: https://github.com/wight-airmash/ab-server

  • It's not popular, but I'm very proud of my ADT library I'm working on. https://github.com/schwartzworld/schtate

  • I don't know about the quality, but Mattermost is in TS: https://github.com/mattermost/mattermost-webapp

  • tRPC, because you can learn a lot of type-inference tricks using generics and proxies

    https://github.com/trpc/trpc

  • You should contribute to open source project that has reviewers, it's like doing a test and having it graded by teachers.

  • The vscode codebase might be interesting.