# \[ANN\] OCamlot - Activitypub server written in OCaml

**URL:** https://discuss.ocaml.org/t/ann-ocamlot-activitypub-server-written-in-ocaml/11699
**Category:** Community
**Created:** [March 18, 2023, 9:24pm UTC](https://discuss.ocaml.org/t/ann-ocamlot-activitypub-server-written-in-ocaml/11699 "2023-03-18T21:24:26Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Gopiandcode](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/gopiandcode/32/5346_2.png) [@Gopiandcode](https://discuss.ocaml.org/u/Gopiandcode)
#### Post date: [March 18, 2023, 9:24pm UTC](https://discuss.ocaml.org/t/ann-ocamlot-activitypub-server-written-in-ocaml/11699/1 "2023-03-18T21:24:26Z")

</div>

Hi all!

I’m pleased to announce the release of a project that I’ve been working on, on-and-off for a while now: an activitypub server in OCaml — OCamlot.

> **[GitHub - Gopiandcode/ocamlot: An Activitypub server in OCaml!](https://github.com/Gopiandcode/ocamlot)**
>
> An Activitypub server in OCaml! Contribute to Gopiandcode/ocamlot development by creating an account on GitHub.

It’s wildly incomplete, and currently only the bare-bones minimum to be a considered an activitypub server, but it’s coming along nicely.

Currently it supports:

- profiles, custom profile pictures, about
- likes, reposts
- replies

and that’s all.

Some screenshots:

- Feed  

- Writing replies:  

- Listing users:  

- Profile page:  

- Post replies  

Now, the things that this community would care about:

- The server is implemented using dream: [ocamlot/server.ml at master · Gopiandcode/ocamlot · GitHub](https://github.com/Gopiandcode/ocamlot/blob/master/lib/server/server.ml)
- The underlying database is Postgres (or Sqlite), accessed from OCaml using Caqti + [Petrol](https://discuss.ocaml.org/t/ann-petrol-1-2-0-release-postgres-support-user-extensible-types/11691): [ocamlot/tables.ml at master · Gopiandcode/ocamlot · GitHub](https://github.com/Gopiandcode/ocamlot/blob/master/lib/database/tables.ml)
- Ingesting and producing activitypub entities is done using the decoders library: [ocamlot/types.ml at master · Gopiandcode/ocamlot · GitHub](https://github.com/Gopiandcode/ocamlot/blob/master/lib/activitypub/types.ml)
- Rendering is all done server-side using tyxml: [ocamlot/lib/view at master · Gopiandcode/ocamlot · GitHub](https://github.com/Gopiandcode/ocamlot/tree/master/lib/view)

Seeing as there has been some interest in this community recently about activitypub integration in OCaml, I figured this might be interesting.

I have an instance running on over at [https://ocamlot.xyz](https://ocamlot.xyz) – as a warning, I’ve done most of my testing locally using pleroma, so there may be some slight issues interacting with other server implementations at the moment. EDIT: Issues with interacting with mastadon servers have been resolved, go wild!

Also would be happy to field any questions regarding navigating the activitypub spec as well. I plan to write up my experiences somewhere at some point in the future.

---

<div class="post-metadata">

### Author: ![yawaramin](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/yawaramin/32/3384_2.png) [@yawaramin](https://discuss.ocaml.org/u/yawaramin)
#### Post date: [March 18, 2023, 10:30pm UTC](https://discuss.ocaml.org/t/ann-ocamlot-activitypub-server-written-in-ocaml/11699/2 "2023-03-18T22:30:07Z")

</div>

Cool to see a project using purely server-side rendering. Check out htmx as well to easily sprinkle some interactivity to the page e.g. submitting a post and injecting it into the page directly instead of reloading the whole page. I’ve been using htmx with Dream’ EML for a personal project and with Scalatags (similar to TyXML) for a work project, they’re both working very nicely.

---

<div class="post-metadata">

### Author: ![cemerick](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/cemerick/32/1383_2.png) [@cemerick](https://discuss.ocaml.org/u/cemerick)
#### Post date: [March 19, 2023, 1:27am UTC](https://discuss.ocaml.org/t/ann-ocamlot-activitypub-server-written-in-ocaml/11699/3 "2023-03-19T01:27:20Z")

</div>

This looks very cool, thanks for sharing! Also, big 👍 for the name 😉

---

<div class="post-metadata">

### Author: ![toastal](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/toastal/32/2944_2.png) [@toastal](https://discuss.ocaml.org/u/toastal)
#### Post date: [March 19, 2023, 4:38am UTC](https://discuss.ocaml.org/t/ann-ocamlot-activitypub-server-written-in-ocaml/11699/4 "2023-03-19T04:38:51Z")

</div>

Is the goal to be purely a standalone server or a library to build other services atop?

---

<div class="post-metadata">

### Author: ![Gopiandcode](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/gopiandcode/32/5346_2.png) [@Gopiandcode](https://discuss.ocaml.org/u/Gopiandcode)
#### Post date: [March 19, 2023, 4:45am UTC](https://discuss.ocaml.org/t/ann-ocamlot-activitypub-server-written-in-ocaml/11699/5 "2023-03-19T04:45:44Z")

</div>

My plan while developing it was just as a standalone server; I hadn’t considered making it a library, although I’m not sure what the best way of doing that would be.

For example, there are subcomponents of the project that might be useful for building other activitypub services, such as the decoders encoding of activitypub objects, but I’d guess it would be easier to write a domain-specific backend for your purposes.
