Docs/Getting Started

Quick Start

Get up and running with Lubes in under 5 minutes.

Prerequisites

Before you begin, make sure you have the following installed:

  • Node.js 18+ or Bun 1.0+
  • npm, yarn, pnpm, or bun package manager
  • A code editor (VS Code recommended)

Installation

1. Create an account

First, create a free Lubes account. You'll get access to the dashboard where you can manage your projects.

2. Install the CLI

Install the Lubes CLI globally:

Terminal
# Using npm
npm install -g @lubes/cli

# Using Homebrew (macOS/Linux)
brew install lubes/tap/lubes

# Using cargo (Rust)
cargo install lubes-cli

3. Login to your account

lubes login

This will open your browser to authenticate. Once complete, you're ready to create your first project.

Your First Project

1. Create a new project

# Create a new project
lubes projects create my-first-project

# Navigate to project directory
cd my-first-project

# Initialize Lubes in your project
lubes init

2. Install the SDK

TypeScriptPythonGo
npm install @lubes/sdk

3. Initialize the client

lib/lubes.ts
import { Lubes } from '@lubes/sdk'

export const lubes = new Lubes({
  projectId: process.env.LUBES_PROJECT_ID!,
  apiKey: process.env.LUBES_API_KEY!,
})

// Access individual services
export const { db, storage, auth, functions } = lubes

4. Set up environment variables

.env.local
LUBES_PROJECT_ID=your-project-id
LUBES_API_KEY=your-api-key

You can find your project ID and API key in the dashboard settings.

Quick Examples

Query the database

import { db } from '@/lib/lubes'

// Insert a record
await db.query`
  INSERT INTO users (name, email)
  VALUES (${'John Doe'}, ${'john@example.com'})
`

// Query records
const users = await db.query`
  SELECT * FROM users WHERE status = 'active'
`

// Subscribe to changes
db.subscribe('users', { event: 'INSERT' }, (payload) => {
  console.log('New user:', payload.new)
})

Upload a file

import { storage } from '@/lib/lubes'

// Upload a file
const { url } = await storage.upload('avatars', {
  file: avatarFile,
  contentType: 'image/png',
})

// Get a signed URL for private files
const signedUrl = await storage.createSignedUrl(
  'documents/report.pdf',
  { expiresIn: 3600 }
)

Create an edge function

functions/hello-world/index.ts
import { serve } from '@lubes/functions'

serve(async (req) => {
  const { name } = await req.json()

  return Response.json({
    message: `Hello, ${name || 'World'}!`,
    timestamp: new Date().toISOString(),
  })
})

Deploy your function with a single command:

lubes functions deploy hello-world

Next Steps

Now that you have Lubes set up, explore these guides to learn more:

Need help?

Join our Discord community or check out the GitHub discussions for support.