HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
Ff00ff
mammoth
TypeScript2019–2023
Ff00ff / mammoth

mammoth

A type-safe Postgres query builder for TypeScript.

8Distinct people
13Mentions
0Explicit recommenders
487GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A type-safe Postgres query builder for TypeScript.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:03:16 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year13 dated mentions

Observed mentions: 2019-04-07 21:20:10 UTC to 2023-10-14 14:01:19 UTC.

0123452019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments20192020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 5 mentions; 2 submissions, 3 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 5 mentions; 1 submissions, 4 comments20212022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2023

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC202
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC523
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC514
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC000
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC101

What Hacker News says

13 sources
In a type-safe environment I think you should just be able to switch your pur sang SQL builder to another dialect. Because of the type-safety you’ll be able to find incompatibilities at compile time which makes the migration easy enough (ignoring data migration). This avoids creating a weird ad hoc SQL dialect trying to fit all the others in a single API. I work on Mammoth which is a pur sang Postgres query builder, see https://github.com/Ff00ff/mammoth.
In Show HN: Write universally accessible SQL, not library-specific ORM wrapper APIs
This seems to be solving mostly the same problem as the following libraries: [1] https://github.com/phiresky/ts-typed-sql [2] https://github.com/Ff00ff/mammoth [3] https://github.com/AnyhowStep/tsql [4] https://github.com/travigd/vulcyn A query in one of those looks like the following: const rows = await select(list.id, list.createdAt) .from(list) .where(list.createdAt.gt(now().minus(`2 days`)).or(list.value.eq(0))) .limit(10); The resulting type of `rows` is inferred by TypeScript to the corresponding correct type (`{id: string, createdAt: Date}`) Prisma solves the problem by generating code, while all of these do it completely in type-level within typescript. Prisma also seems to introduce its own query language, while the above linked libraries stay closer to SQL. [1] was written by a friend of mine and I'm using
Read the rest
it in production to great success. I wouldn't recommend it though because it has repeatedly broken with new TypeScript updates since it uses very complex type structures and the dev has basically given up on it due to the complexity. [2] is probably the most production-ready, though it has some design choices I'm not sure about. [3] is the most well-designed, and can handle complex scenarios (including differentiating between join types etc). But it's incomplete so far. [4] I have not used. Pure type-level has the advantage of not adding a compile-step and keeping everything in a tool you already know. But all of the above have the disadvantage that the resulting type structures are very complex - most TS devs would have a hard time understanding the internals of the libraries and the resulting type errors can be unreadable. They can also cause the TS compiler to slow down significantly (in the past [1] had exponential compile time when adding a new column, though this has been fixed). Also, since the TS compiler uses heuristics in multiple places and the type system is not sound, Microsoft has introduced regressions that have broken [1] in every other release.
In Prisma 2.0 Beta: Type-safe Database Access
Prisma looks good and I hope it succeeds. Another interesting and unique approach I'd love to see get more attention is Mammoth[0]. Instead of abstracting the database away, you define columns using its raw primitives (in this case, Postgres) and in return get a type-safe client, along with auto-generated migrations. I imagine this approach allows you to leverage the features of the database much more easily. And Postgres has quite a lot of rich features to take advantage of! :) [0]: https://github.com/Ff00ff/mammoth
In Prisma – Database tools for modern application development

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.