My App

Quick Start

Set up the Lit Status server and database in under 5 minutes

Quick Start Guide - Backend Setup

Set up the Lit Status monitoring server and database in under 5 minutes.

Prerequisites

  • Node.js/Bun runtime
  • PostgreSQL database
  • Basic knowledge of REST APIs

Installation

1. Clone and Setup

git clone <your-repo>
cd backend
bun install

2. Database Setup

# Start PostgreSQL (example with Docker)
docker run -d --name postgres \
  -e POSTGRES_PASSWORD=yourpassword \
  -e POSTGRES_DB=litstatus \
  -p 5432:5432 \
  postgres:15

# Configure environment
cp .env.sample .env
# Edit .env with your database URL

3. Run Migrations

# Generate Prisma client
bunx prisma generate

# Run database migrations
bunx prisma migrate deploy

Generate API Keys

# Generate a write key (full access)
bun run gen:write-key

# Generate a read key (read-only access)
bun run gen:read-key

The above commands will generate keys to the .env file

READ_ONLY_API_KEYS='["read-key-here"]'
FULL_ACCESS_API_KEYS='["write-key-here"]'

Start the Server

bun run server

The server will start on port 3000. Check health:

curl -H "X-API-Key: your-key" http://localhost:3000/health

Test with SDK (Optional)

If you want to test your server setup using the TypeScript SDK:

Installation

bun add @lit-protocol/lit-status-sdk

Basic Test

import { createLitStatusClient } from '@lit-protocol/lit-status-sdk';

// Initialise client
const client = createLitStatusClient({
  url: 'http://localhost:3000',
  apiKey: 'your-api-key'
});

// Test server health
const health = await client.healthCheck();
console.log('Server status:', health.status);

// Register a test function
const func = await client.createOrUpdateFunction({
  name: 'testFunction',
  network: 'testnet',
  product: 'quickstart-test'
});

console.log('✅ Server setup successful!');

Next Steps

Configure Your Backend

Start Using the API