Writing Typescript ORM | vol.1

Writing Typescript ORM | vol.1

Fundamental design decisions

We've spent last year writing the next big thing in the world of TypeScript ORMs. I decided to share our initial 12 fundamental design decisions.

1. Don't interfere:

It is a library, not a framework. Be an opt in all the time. Provide features without any tradeoffs. Let developer opt out at any given time and place. Help, enrich, not interfere.

2. Simple things stay simple:

It is hard to do things simple. Avoid adding features if they break simplicity. Work them out until they can be integrated seamlessly. Remove or rework things that make library harder to deal with.

3. SQL-like syntax, little to none learning curve:

Learn SQL, not ORM libraries and frameworks.

4. Predictability:

Things should act the way you'd expect them. Everything should be explicit. Ask for permission if you need to act on behalf o a developer. APIs have to be explorable.

5. Types:

Types ground top. Developer should have no room to make a mistake. If something's wrong - it does not compile. Provide a way to write custom types. The only unsafe place is in raw SQL.

6. Feature support:

Spend 95% of the time on 95% of most used features.

7. Joins:

They have to be perfect. They have to be type safe, explicit and infinitely flexible.

8. Migrations:

That is easily the hardest one. Provide an opt in opinionated way to build semi-automatic, type-safe robust migrations. Provide an opt in opinionated way to run migrations.

9. Stay slim:

Little to none runtime overhead. Zero dependencies, stay serverless friendly. Embrace native database drivers, don't build our own. Transactions degrade performance and have to be opt it, not opt out.

10. Production, Test and Documentation

Usage in real world projects. Extensive tests on multiple database versions. Extensive documentation.

11. Communicate:

Show your work, let people glimpse at what you're doing and how. Provide an easy to use communication and feedback channel

12. Love:

Share some love

Thanks for reading! Ping me out if you're interested in accessing a beta version of the ORM!