Files
bridge/app/server
zeekay 778ff148c3 feat(pkg/bridge): add @luxfi/bridge SDK + publish workflow
Rationalize the bridge workspace around one canonical SDK entry:

  - @luxfi/bridge        (NEW)  public SDK consumers import
  - @luxbridge/*          private workspace internals
  - @luxfi/{core,threshold,utila} generic Lux building-block libs

@luxfi/bridge re-exports mountBridge(), <Bridge />, BridgeConfig, and
BrandConfig. The runtime lazy-imports @luxbridge/app as the actual UI
implementation. Mirrors the mountExchange() pattern from
@partner/exchange — declarative config-in, brand metadata applied
to document, React tree rendered into #bridge-root.

Workspace housekeeping:
  - pkg/settings: 0.1.0 -> 1.0.0, marked private
  - pkg/ui (ui-automation), app/server, app/bridge3: marked private
  - app/explorer: 0.1.0 -> 1.0.0
  - root bridge package: 1.0.0 -> 1.1.0
  - app/bridge: add main/types/exports so the SDK can dynamic-import the App component

Publish workflow at .github/workflows/publish.yml fires on v* tag push,
runs pnpm publish -r --access public --no-git-checks. pnpm skips
private packages automatically. Public packages: @luxfi/bridge, @luxfi/core,
@luxfi/threshold, @luxfi/utila.
2026-05-21 14:02:03 -07:00
..
2024-11-27 16:41:55 +08:00
2024-11-24 23:08:28 -06:00
2024-11-27 16:41:55 +08:00
2025-08-03 15:52:32 -05:00

bridge/server

The Lux Bridge Server is an API server that facilitates communication with Multi-Party Computation (MPC) nodes and manages asset swaps.

Prerequisites

•	Node.js: Version 20 or higher.
•	pnpm: Version 9.10.0 or higher.
•	Docker: Ensure Docker is installed and running.
•	Kubernetes: Access to a Kubernetes cluster for deployment.

Installation

1.	Clone the Repository:

git clone https://github.com/luxfi/bridge.git

2.	Install Dependencies:

pnpm install (from root or any project subdir)

Development

  • go into server dir

    cd server

  • generate prisma artifacts

    pnpx prisma generate

  • set up prisma to use sqlite

    in prisma/schema.prisma

datasource db {
  //provider  = "postgresql"
  provider  = "sqlite"
  url       = env("POSTGRES_URL")
  directUrl = env("POSTGRES_URL")
}
  • set env variable to point to sqlite

    in .env

    POSTGRESQL_URL=file:./dev.sqlite

  • create the local sqlite instance

    pnpx prisma db push

  • Start the dev server

    pnpm dev

This command uses nodemon to watch for file changes and restarts the server automatically.

[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): src/**/*
[nodemon] watching extensions: ts,js
[nodemon] starting `node -r tsconfig-paths/register -r ts-node/register ./src/server.ts`
>> Server is Running At: Port 5000

Building the Project

•	Build the Project:

pnpm build

This command compiles TypeScript files, resolves module aliases, and generates the Prisma client.

Docker Operations

•	Build Docker Image:

pnpm docker:build

This command builds the Docker image using Buildx for the linux/amd64 platform.

•	Log in to GitHub Container Registry:

pnpm docker:login

Ensure that the environment variables GH_USER and GH_TOKEN are set with your GitHub username and personal access token, respectively.

•	Push Docker Image:

pnpm docker:push

This command pushes the Docker image to the GitHub Container Registry.

Kubernetes Deployment

•	Apply Kubernetes Configuration:

pnpm k8s:apply

This command applies the Kubernetes deployment and service configurations located in the k8s directory.

•	Scale Deployment:

pnpm k8s:scale

Set the REPLICAS environment variable to the desired number of replicas before running this command.

•	Create Kubernetes Secret:

pnpm k8s:create-secret

Ensure the POSTGRESQL_URL environment variable is set with your PostgreSQL connection string.

•	Restart Deployment:

pnpm k8s:restart

•	Check Deployment Status:

pnpm k8s:status

This command retrieves the status of deployments, services, and pods labeled app=bridge-server.

Linting and Formatting

•	Lint Code:

pnpm lint

•	Format Code:

pnpm format

Environment Variables

The server utilizes environment variables for configuration. Create a .env file in the server directory with the following variables:

POSTGRESQL_URL=your_postgres_connection_string GH_USER=your_github_username GH_TOKEN=your_github_token REPLICAS=number_of_replicas LUX_SIGNER=

Ensure that sensitive information is kept secure and not committed to version control.