npm.io
0.5.90 • Published 2d agoCLI

@levrbet/shared

Licence
Version
0.5.90
Deps
37
Size
2.5 MB
Vulns
2
Weekly
0
Install scriptsThis package runs scripts during installation (preinstall/install/postinstall)

@levrbet/shared

Shared utilities, components, and types for the LEVR platform...

Installation

npm install @levrbet/shared @prisma/client

The Prisma client is automatically generated during installation - no additional setup required.

Usage

// Core utilities (universal - works in both browser and Node.js)
import { e18, LevrBaseMarket } from "@levrbet/shared/core"

// Prisma types and client
import { PrismaClient, GamePhase, MarketStatus } from "@levrbet/shared/core"
// Or directly from @prisma/client
import { PrismaClient, GamePhase } from "@prisma/client"

// Server-only utilities
import { authMiddleWare, validateApiKey } from "@levrbet/shared/server"

// React components and hooks
import { useAuth } from "@levrbet/shared/react"

Package Structure

  • /core - Blockchain contracts, types, Prisma re-exports, and universal utilities
  • /server - Node.js server utilities (auth, database, logging, middleware)
  • /react - React components and hooks

Peer Dependencies

This package requires the following peer dependencies:

Package Required For
@prisma/client Database types and client
react React hooks (optional)
@tanstack/react-query React query hooks (optional)
@privy-io/react-auth Privy auth hooks (optional)

Prisma

The Prisma schema is bundled in this package and the client is auto-generated on install. If you need to manually regenerate:

npx levrbet-prisma-setup
# Or directly:
npx prisma generate --schema=node_modules/@levrbet/shared/prisma

Development

npm install          # Install dependencies
npm run build        # Build package
npm run dev          # Build and pack for local testing
Local Testing
# In this package
npm run dev  # Creates a .tgz file

# In consumer project
npm install /path/to/levr-shared/*.tgz

License

Proprietary to LEVR Labs.