Oracle® Backend For Firebase JavaScript Namespace SDK Reference, Release 26.1.0
    Preparing search index...
    Oracle® Backend For Firebase JavaScript Namespace SDK Reference
    Release 26.1.0

    G48197-02

    Oracle® Backend For Firebase JavaScript Namespace SDK Reference, Release 26.1.0

    Oracle® Backend For Firebase JavaScript Namespace SDK

    A JavaScript SDK for Oracle Backend For Firebase provides authentication, database, storage, and optional UI components.

    Install the JavaScript Namespace SDK package:

    npm install fusabase-ns
    

    The SDK exposes a namespaced default export fusabase and subpath modules for App/Auth/Database/Storage/UI.

    import fusabase from 'fusabase-ns';

    const appInstance = fusabase.initializeApp({
    // Required
    ords_host: 'https://your-ords-host/ords/your-schema/',
    schema: 'your-schema',
    app_id: 'your-app-id',
    project_id: 'your-project-id',
    objs_type: 'dbfs', // your objects type (e.g. 'dbfs')
    storage_bucket: 'your-bucket',
    auth_type: 'base', // base | ldap_s | base_s | idcs
    auth_id: 'your-auth-id'
    }, '[DEFAULT]');

    // Set log level for all apps (use enum from subpath)
    // fusabase.setLogLevel(appMod.LogLevel.ERROR);
    // or
    // fusabase.setLogLevel(oradbMod.LogLevel.ERROR);
    import fusabase from 'fusabase-ns';
    import auth from 'fusabase-ns/auth';

    const appInstance = fusabase.app(); // or hold the instance returned from initializeApp
    const authInstance = fusabase.auth(appInstance);

    // Create a new user (IDCS/Base depending on your config)
    const userCredential = await authInstance.createUserWithEmailAndPassword('user@example.com', 'password');

    // Sign in an existing user
    const signInCred = await authInstance.signInWithEmailAndPassword('user@example.com', 'password');

    // Social login with popup (for on-prem supported providers)
    const googleCred = await authInstance.signInWithPopup(new auth.GoogleAuthProvider());

    // Social login with redirect (IDCS or on-prem)
    await authInstance.signInWithRedirect(new auth.GoogleAuthProvider());
    // Later in your redirect handler:
    // const result = await authInstance.getRedirectResult(authInstance);

    // Listen to auth state
    const unsubscribe = authInstance.onAuthStateChanged(user => {
    console.log('Current user:', user);
    });
    // unsubscribe();
    import fusabase from 'fusabase-ns';
    import oracledb from 'fusabase-ns/oracledb';

    const appInstance = fusabase.app();
    const db = fusabase.oracledb(appInstance);

    // Get a document
    const docRef = db.collection('collection-name').doc('document-id');
    const docSnap = await docRef.get();
    if (docSnap.exists) {
    console.log(docSnap.data());
    }

    // Add a document
    const newRef = await db.collection('collection-name').add({
    field1: 'value1',
    field2: 123
    });

    // Query
    const querySnap = await db.collection('collection-name')
    .where('status', '==', 'active')
    .orderBy('createdAt', 'desc')
    .limit(10)
    .get();
    querySnap.forEach(d => console.log(d.id, d.data()));

    // Aggregation
    const aggSnap = await db.collection('collection-name')
    .aggregate({
    total: oracledb.AggregateField.sum('amount')
    })
    .get();
    console.log(aggSnap.data().total);

    // Transactions
    const ref = db.collection('collection-name').doc('doc-1');
    await db.runTransaction(async (tx) => {
    const snap = await tx.get(ref);
    if (snap.exists) {
    tx.update(ref, { counter: oracledb.FieldValue.increment(1) });
    }
    });
    import fusabase from 'fusabase-ns';

    const appInstance = fusabase.app();
    const storage = fusabase.storage(appInstance);

    // Upload bytes
    const bytes = new Uint8Array([0x48,0x65,0x6c,0x6c,0x6f]);
    const storageRef = storage.ref('path/to/file.bin');
    const snapshot = await storageRef.put(bytes);

    // Download URL
    const url = await storageRef.getDownloadURL();

    // Metadata
    const meta = await storageRef.getMetadata();

    // List
    const listRes = await storage.ref('path/to').list();
    const listAllRes = await storage.ref('path/to').listAll();

    // Delete
    await storageRef.delete();
    import { authUI } from 'fusabase-ns/ui';
    import fusabase from 'fusabase-ns';
    import auth from 'fusabase-ns/auth';

    const appInstance = fusabase.app();
    const authInstance = fusabase.auth(appInstance);

    // Create and start the UI
    const ui = new authUI.AuthUI(authInstance);
    ui.start('#auth-container', {
    signInOptions: [
    auth.EmailAuthProvider.PROVIDER_ID,
    auth.GoogleAuthProvider.PROVIDER_ID,
    auth.FacebookAuthProvider.PROVIDER_ID,
    auth.GithubAuthProvider.PROVIDER_ID
    ],
    signInSuccessUrl: '/home',
    callbacks: {
    // Return false to prevent automatic redirect
    signInSuccessWithAuthResult: (result, redirectUrl) => true
    }
    });

    Generate TypeDoc documentation:

    npm run docs
    

    Documentation will be generated per the configured TypeDoc options.

    This project welcomes contributions from the community. Before submitting a pull request, please review our contribution guide

    Please consult the security guide for our responsible security vulnerability disclosure process

    npm test
    

    Runs the Mocha test suite in the test/ directory.

    npm pack
    

    Copyright (c) 2015, 2026, Oracle and/or its affiliates.

    This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.

    If you elect to accept the software under the Apache License, Version 2.0, the following applies:

    Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.