Outerbase SDK
  • Outerbase SDK
  • Get Started
    • Overview
    • Playground
  • Introspection
    • Overview
    • Universal data language
    • Connect a data source
    • Generate models
      • Limit table scope
    • Remote queries
  • Query Builder
    • Overview
    • Select
      • Single table
      • Multiple tables
      • Where clauses
      • Join tables
      • Limit & Offset
      • Order By
    • Insert
    • Update
    • Delete
    • Returning
    • Operators
    • .toString()
    • .asClass()
    • .query()
    • .queryRaw()
  • Data Sources
    • Overview
    • Outerbase
    • Cloudflare D1
    • Neon
Powered by GitBook
On this page
  • Install the package
  • How to use the SDK
  • Data Models
  • Remote Queries
  • Query Builder
  1. Get Started

Overview

PreviousOuterbase SDKNextPlayground

Last updated 11 months ago

Currently this SDK is intended for usage in either Typescript or Javascript projects. If you are looking to have it made available for another platform or language we'd love to all about that!

Install the package

You can add the package to your project in the ways.

npm i @outerbase/sdk

pnpm add @outerbase/sdk

How to use the SDK

Below is a chart that breaks down which features are intended for what platform use cases. All features should work on both the frontend and backend but for best practices and security purposes we find it important to explicitly enumerate them below.

Feature
System

Data Models

Frontend** & Backend

Remote Queries

Frontend & Backend

Query Builder

Backend

Data Models

Generating data models helps you map your data exactly as the relationships are declared in your database with the rest of your development stack. This greatly reduces ambiguity, out of sync nomenclature, and removes unnecessary manual redeclaration of classes at each layer of your application.

Since the introspection is only generating Typescript classes, there is no issues with using it on the frontend or the backend to reference those models.

** - We don't advise you using available methods that generate or execute SQL on the frontend, these are meant for backend purposes only. See for more details as to why.

Remote Queries

Executing network calls to saved queries within Outerbase allow you to send requests securely without exposing SQL statements to your frontend client, and only allowing a pre-determined set of SQL statements to be executable. Because of those reasons running remote queries is entirely safe on both the frontend and backend side of your development stack.

An added benefit to executing remote queries is the fact that these queries can be cached with a customized TTL (time to live) which can greatly reduce the overhead your database receives for duplicative calls, or long executing queries.

Query Builder

Query Builder generates either a named or positional parameterized raw SQL query, accompanied by the parameters, and can be used to .query() and trigger a network call to your database. If that event was fired from the frontend platform then users could observe that traffic and potentially send malicious SQL statements to your database causing potentially catastrophic and unintended affects.

We are open source!

If you have any questions, you can reach us at

Every space voyage needs a crew. The Outerbase SDK is an open source project that any human being can contribute to. Add your ideas to our , report your bugs as , or open your first to add more functionality for others.

support@outerbase.com
Discussions
Issues
Pull Request
hear more
Query Builder section