Connecting Manta Tables
Manta Tables are the internal, high-performance data storage provided by MantaHQ. This is the default data source for the MantaHQ SDK, allowing you to build and iterate on your data schema without managing external infrastructure.
1. Generate an API Key
To authorize communication between the SDK and your project, you must create a dedicated API key.
- Log in to your MantaHQ Dashboard.
- In the sidebar navigation, click API Keys.
- Click New API Key.
- Enter a descriptive name for your key.
- Copy and store the generated key immediately.
2. Configure your Tables
Before interacting with data via the SDK, you must define your schema in the dashboard.
- Navigate to Data Tables in your dashboard.
- Create a new table (e.g.,
usersorproducts). - Define your columns and data types using the visual interface.
- Note the Table Name; you will use this identifier in your SDK requests.
3. Initialize the Client
Initialize the SDK by providing the API Key generated in Step 1. For a complete walkthrough on environment setup, see the Quickstart guide.
import { MantaClient } from "mantahq-sdk";
const manta = new MantaClient({
apiKey: "manta_sk_live_xxxx", // Replace with your actual API key
});
When targeting Manta's internal tables, the request object is straightforward. Unlike external databases, you do not need to provide a db parameter, as the SDK defaults to your Manta Studio workspace.
// Targeting internal Manta Tables (default behavior)
await manta.fetchAllRecords({
table: "users",
where: { status: "active" },
});
Understanding the snippet
- Default Routing: Because the
dbparameter is omitted, MantaHQ automatically executes the query against your internal data tables. - Table mapping: The
tablevalue must match the name of the table exactly as it appears in Manta Studio. - Managed Infrastructure: No connection strings or host configurations are required; Manta handles the scaling and availability of these tables automatically.
Key differences at a glance
| Feature | Manta Tables | External Postgres |
|---|---|---|
| Storage Location | Hosted by Manta | Your Infrastructure |
| SDK Syntax | table: "name" | db: "name", table: "name" |
| Setup Method | Visual Builder | Connection String / Manual |
| Best For | New projects & rapid prototyping | Existing production data |