API Strategy
Learn about the three API patterns available in TerraScale.
This guide walks you through setting up TerraScale and storing your first data.
TerraScale is a multi-tenant, multi-region Database-as-a-Service (DBaaS) platform that provides globally distributed, DynamoDB-compatible NoSQL database instances.
After signup, you’ll have a personal organization created automatically where you can start creating databases.
If you’re working with a team, create a dedicated organization:
my-app-prod)
us-east-1)Your database will be ready in seconds with “Active” status.
API keys allow your applications to access TerraScale databases.
database:read - For read-only accessdatabase:write - For write access (includes read)database:* - For full access (recommended for backends)Your API key will look like: ts_live_abc123xyz789...
Install the TerraScale client library for your platform:
dotnet add package TerraScale.Database.ClientUse the REST API directly with any HTTP client. See the API Reference section.
using TerraScale.Database.Client;using TerraScale.Database.Client.Configuration;using TerraScale.Database.Client.Models;
// Create the clientvar client = new TerraScaleDatabase(new TerraScaleDatabaseOptions{ ApiKey = "ts_live_your_api_key", Endpoint = "https://api.terrascale.io", DefaultDatabase = "my-database"});
// Store an itemvar item = new DatabaseItem{ PartitionKey = "user#123", SortKey = "profile", Attributes = new Dictionary<string, object?> { ["name"] = "John Doe", ["email"] = "john@example.com", ["age"] = 30 }};
var putResult = await client.PutItemAsync(item);if (putResult.IsSuccess){ Console.WriteLine("Item stored successfully!");}
// Retrieve the itemvar getResult = await client.GetItemAsync("user#123", "profile");if (getResult.IsSuccess){ var user = getResult.Value; Console.WriteLine($"Name: {user.GetAttribute<string>("name")}");}
// Clean upawait client.DisposeAsync();# Store an itemcurl -X PUT "https://api.terrascale.io/api/v1/databases/my-database/items" \ -H "Authorization: Bearer ts_live_your_api_key" \ -H "Content-Type: application/json" \ -d '{ "pk": "user#123", "sk": "profile", "data": { "name": "John Doe", "email": "john@example.com", "age": 30 } }'
# Retrieve the itemcurl "https://api.terrascale.io/api/v1/databases/my-database/items/user%23123/profile" \ -H "Authorization: Bearer ts_live_your_api_key"API Strategy
Learn about the three API patterns available in TerraScale.
C# SDK Guide
Deep dive into the C# SDK with advanced examples.
Repository Pattern
Use typed repositories for schema-validated entities.
Querying Data
Learn query operations for efficient data retrieval.
TerraScale is ideal for: