Menu

StackMachine
    Query data

    A database per app.
    Query it your way.

    Create Postgres, MySQL, or SQLite databases from the SDK. Connection details are automatically available in your app as environment variables, ready for the driver you already use.

    Pick an engine. Your app gets the connection details.

    One engine is picked out of Postgres, MySQL, and SQLite, and a database of that kind is created. StackMachine exposes its connection details as environment variables to the app. The app queries that database, and rows come back.

    Connection details, automatically available in your app.

    DB_NAME
    Database name
    DB_USERNAME
    Database username
    DB_PASSWORD
    Database password
    DB_HOST
    Database hostname, without the port
    DB_PORT
    Database port

    An illustration, with example data.

    Powering products and agents at

    Wasmer logo
    Simply Static logo
    Tiiny logo
    Manus logo
    ModularDS logo
    Pick the engine
    Choose Postgres, MySQL, or SQLite to match your runtime and your migrations.
    Connect with your driver
    Read DB_NAME, DB_USERNAME, DB_PASSWORD, DB_HOST, and DB_PORT from your app's environment. Use the client library your app already has.
    Rotate when access changes
    Issue new credentials from the SDK when you replace a secret or hand an environment over.

    Create it in one call.
    Connect in the next.

    Create the database against an app and connect using its automatically configured environment variables. Rotate the credentials later from the same client.

    Shell
    $ npm install stackmachine

    Read the docs

    query.js
    import StackMachine from "stackmachine";
    
    const client = new StackMachine(process.env.STACKMACHINE_API_KEY);
    
    const { database, password } = await client.apps.databases.create({
      app: "da_XYZ",
      dbEngine: "POSTGRES", // or "MYSQL", "SQLITE"
      name: "orders",
    });
    
    // The app receives DB_NAME, DB_USERNAME, DB_PASSWORD, DB_HOST, and DB_PORT.
    // Connect with your Postgres driver using the app's environment.
    // Store password securely if an external client needs it.
    console.log(database.host, database.port, database.username);
    
    const rotated = await client.apps.databases.rotateCredentials(database.id);

    From a new app
    to durable state.

    Keep records, user data, and queues next to the app that uses them.

    Credentials, shown once

    Your app receives its database credentials through environment variables. For external clients, creation and rotation return a password to store securely.

    ordersPostgres
    host
    db.example.com
    port
    5432
    username
    orders_app
    password
    shown once
    Rotate credentialsnew password, shown once

    Each app keeps its own

    Databases are created against an app and listed with it, so every project has its own state and its own engine.

    storefront3 databases
    • ordersPOSTGRES
    • sessionsSQLITE
    • reportsMYSQL

    A few things
    to know.

    More in the documentation.

    Postgres, MySQL, and SQLite. Choose the one that fits your application runtime and migration workflow.

    Start with your first database.

    One API key for hosting, storage, databases, email, and cron.