Skip to main content


Diagram of Ditto's internal architecture so far. Not sure I've captured it perfectly, but should give the general idea. #ditto
@alexThis looks complicated. What are you going to do when you have to integrate Ditto into Revolver?
@opphunter88It's actually not super complicated, just requires a bit of bravery because we're going where no man has gone before.

@opphunter88

Does not show how Client interacts with Ditto.
maybe good to add a box or something around Mastodon API and Mastodon Streaming API or combine them?

@ahmadI hate Postgres. It's a goal of mine to make this work with an embedded database.

So far, I haven't optimized it. If performance is poor, there are lots of things I can try.

Failing all that, the query builder I use should allow us to use any SQL compatible backend including Postgres.

And ditto's sqlite is browseable with Soapbox?
@gvsDitto works with Soapbox through Mastodon API.
@gvs
Is ditto already usable or early development?
@gvsUnusable, but moving quickly. Feels like I'm days away but realistically up to two weeks.
@gvs
@tassomanYes. The graph is made with Mermaid which kind of sucks and looks bad if you draw too many arrows.

@ahmadThere are only 3 database tables. In the future there might only be 2. The whole codebase is built around NIP-01 filters, and the SQL part uses Kysely. It would be trivial to swap out SQLite for Postgres: https://gitlab.com/soapbox-pub/ditto/-/blob/develop/src/db/events.ts?ref_type=heads#L55-108

And it would be possible to use a different backing store such as LMDB.

@verita84 @ahmadLooks cool, but I'm aiming for minimalism. Cassandra is maximalist.

If I were to use a non-embedded DB, ElasticSearch is weirdly the best option, except that it isn't FOSS.

@ahmad @verita84 apart from the forks that still are https://github.com/crate/crate

there's always https://sqlite.org/hctree/doc/hctree/doc/hctree/threadtest.wiki on the horizon though

@i @ahmad @verita84Any DB that uses SQL can be made to work with this project.

Originally I wanted the DB itself to be any Nostr relay, but the relay would need special characteristics (like indexes on particular tags) that I can't guarantee unless Ditto itself acts as the relay.

@ahmadIt's stored in the SQLite database. Everything is a Nostr event (pretty much), so it only needs one table for the events, and another table for indexing tags.

Remote data is automatically pruned after 7 days. And since it's connected to the Nostr network, data can be refetched in realtime if you scroll back far enough. The experience will degrade when looking at remote content older than 7 days. Local content will load well and offer the best experience.

It won't have the same problems as Pleroma with remote data making the database too huge.

One question. It's possible to search fediverse posts from Nostr with ditto/mostr?

#ditto #mostr

@ba31f050a66d6aee73fb258405a44fcffa662e24784e6650944f8fc2d3089427None of the relays Mostr publishes to support NIP-50 search. But I bet things would show up in primal.net search since they index everything.

In Ditto I will experiment with SQLite FTS. We'll see how it goes.

@ahmadI'm not building a system that's infinitely scalable. I'm building a system that's minimalist, low cost, and with account portability.

It should be able to handle traffic from Poast, for example. I'm not designing it to handle Truth Social or Gab levels of traffic. But it doesn't matter, because users can move freely and seamlessly between servers, so if one Ditto server is struggling or offline, people can just use a different one with their same account.

it's almost 3-5 steps just to get to reply to your post from nostr. i didn't see your post until i visited your rebased site. then i had to search for your profile, search for your post post, find a client that accepts your post and finally reply. these steps differ each time for any activitypub content

will ditto solve this discovery of post and reply (nostr <-> activitypub) problem?

@82bf2dbdbd8efb0876c5abd2f3729676239c54bfe1866966687e8a10417f6d8dDitto to Ditto network will work great. It's up to whatever client you're using to make the rest of it work. This is mostly a Nostr client problem.
@ahmad Ditto... good one
@Senator_Armstrong @NonPlayableClown @ahmad @mesoPretty much. I think we'll be able to handle spam better than the aforementioned two.

>It can handle Poast level of traffic but not so much of Gab and TS.

Oof really hurting :SeethingDanielS: feelings right there 🤣

Well I suppose it's a good thing :SeethingDanielS: bans many people.

Gab traffic is probably 50% spambots tbh and I don't imagine TS is any better. I'm glad that shit hasn't infested the fedi yet but these retards are already trying with their stupid chat gpt troll accounts
it should use Cassandra instead
@sjwData is portable on Nostr, so I don't see a need to have a decentralized database. The Nostr network IS the decentralized database. If Ditto struggles to scale, the SQLite part could be replaced with a pool of dedicated Nostr relays.

Then use CouchDB because it's the most comfy DB.

Also what about Revolver?

@sjwCouchDB is cool, but I have a strong preference for embedded databases. I looked into PouchDB, but it's for something else.

Also look at how good SQL is at turning Nostr filters into queries, it's phenomenal: https://gitlab.com/soapbox-pub/ditto/-/blob/develop/src/db/events.ts?ref_type=heads#L66-128

Revolver doesn't exist, show me the code.

@sjwLooks good. If I swap out SQLite it would be for a key-value store like LMDB or bbolt as I've just learned. Main reason I haven't is because it's a skill issue.