Skip to content

Latest commit

 

History

History
110 lines (79 loc) · 4.32 KB

File metadata and controls

110 lines (79 loc) · 4.32 KB

posthoglogo

Docs - Code

Polycentric is an open-source, distributed social network

Polycentric is an open-source, distributed social network that lets you publish content to multiple servers. If you're censored on one server, your content remains accessible from other servers.

Getting started

⚠️ We're working on this.

You will need:

The following commands will get you up and running:

# Use node version manager to install the pinned version of node
nvm install

# Check you have the correct dependencies
apt-get install \
 protobuf-compiler \
 cmake \
 g++ \
 pkg-config \
 libssl-dev \
 libsasl2-dev

# Add the WASM target to the rust toolchain
rustup target add wasm32-unknown-unknown

# Build the frontend and core binaries
pnpm install
pnpm build

# Setup the git pre-commit hooks
pnpm prepare

# Start the server process
docker compose up -d --build

# Apply the database schema if it has changed
docker compose run --rm server /app/migration fresh

# Start the frontend dev server
pnpm dev

If you're using Podman, ensure docker compose resolves to Compose v2.

To run the server from source instead, see services/server/README.md.

Clearing stale build caches

Builds are cached by Turbo. The cache key does not track changes to installed dependencies, so after switching branches or updating deps (e.g. a uniffi-bindgen-react-native / @ubjs/core bump) pnpm build can restore a stale cached output and fail with mismatched generated bindings — for example a TypeScript error that two Query / UniffiEnum types "are unrelated".

If that happens, clear the build cache and rebuild:

pnpm clean:cache
pnpm build

If the generated uniffi bindings themselves are stale (not just their cache), also regenerate them with pnpm ubrn:clean followed by pnpm build.

Project Structure

Packages

Package Description
packages/js-core Core JavaScript library containing the main Polycentric protocol logic
packages/js-browser Browser SDK using SQLite WASM for local storage
packages/js-node Node.js SDK using sqlite3 for local storage
packages/js-storage-sqlite Shared SQLite (Drizzle ORM) storage layer for the JS SDKs
packages/react-native React Native SDK for mobile applications
packages/rs-common Shared Rust code used by rs-core
packages/rs-core Rust core library - the underlying protocol implementation
packages/rs-core-uniffi-web rs-core on WASM with uniffi-bindgen-react-native bindings

Apps

App Description
apps/polycentric The main Polycentric social network application (Expo/React Native)

Services

Service Description
services/server Polycentric server
legacy/services/polycentric-server Legacy server
legacy/services/verifiers-server Legacy Server for verifying claims and signatures in the protocol