An open source publishing ecosystem for uncensorable citizen journalism, powered by Nostr, Lightning and eCash. See more on pareto.space.
This repository contains the Pareto client, a Nostr client for reading and publishing uncensorable long-form content.
This is a monorepo with both Elixir/Phoenix backend and Elm frontend.
The backend delivers for certain routes HTML metadata for nostr articles, communities, and profiles:
/a/naddr1qvzqq...- metadata for long-form article/c/ncomm1qvzqq...- metadata for Nostr community/e/nevent1q...- metadata for Nostr article/u/[email protected]- metadata for Nostr profile/u/[email protected]/identifier- metadata for Nostr article/p/nprofile1qyt8w...- metadata for Nostr profile
Additionally a static landing page is delivered for the home route.
There's an API available that redirects to the image of OpenGraph metadata:
/api/opengraph/image??url=...
This is being used for thumbnails of Odysee videos
This API call proxies OEMBED calls in order to avoid CORS issues (Twitter/X):
/api/oembed
Another API endpoint helps embed Rumble videos in articles:
/api/rumble/embed
NIP-05 validation JSON is served on this route:
/.well-known/nostr.json?user=\<user\>
LNURL Pay JSON data is served on this route:
/.well-known/lnurlp/\<user\>
Detailed Nostr information about this app, like supported NIPs and Kinds, can be found here.
These environment variables need to be set
PHX_HOST: The domain where the server is accessed from external (e. g. pareto.space)PORT: The port where the server accepts connections (e. g. 4000)SECRET_KEY_BASE: The secret key generated bymix phx.gen.secret.POSTHOG_API_KEY: The API key of a PostHog serverPOSTHOG_HOST: Host name of a PostHog server (e. g. https://eu.i.posthog.com)
Additional users with NIP-05 <user>@pareto.space can be added at
nostr_backend/lib/nostr_backend_web/controllers/nostr_controller.ex
This shell script downloads and modifies the landing page as needed:
nostr_backend/update_landing_page.sh
To enable debugging, write the following command in the browser console:
localStorage.setItem('debug', 'ndk*,pareto-client*');
To disable debugging, type
localStorage.removeItem('debug');
Make sure you display all log levels in the console in order to see debug messages.
For development purposes you don't need Docker. The Docker setup is mainly intended for deployment.
- Setup the latest versions of Elm, Elixir and Erlang (OTP). One of the best options is asdf
- Install Elm Land (https://elm.land/):
npm install -g elm-land@latest - When using VSCodium, install Elm, Elm Land, and Elixir plugins
- Open the frontend and backend separately (
frontendandnostr_backenddirectories)
Change to the frontend directory for the following commands.
- run ./build.sh (only needed once to generate the code for translations and Tailwind CSS modules)
- run
./run.shin the frontend directory.
In case you get a build error make sure that the following line is present in the file ~/.tool-versions:
elm 0.19.1
After changes to the English language file lang/lang-en\_US.json you need to generate the related Elm code with ./gentranslations.sh.
On http://localhost:1234/read you'll find the Pareto client, served by a development server.
You'll notice a small rect bottom/right of the screen that allows to open the Elm debugger.
Change to the nostr_backend directory for the following commands.
- run
mix deps.getto load externally referenced modules. - The backend can be started locally with
./run.sh. This includes building of the frontend.
To run the backend without building the frontend execute ./dev.sh.
If you want to test single functions use iex -S mix