A developer I know needed a database for their Next.js app. PostgreSQL needed hosting. Supabase had too many features. Firebase was NoSQL. Then she found Xata — a serverless database with a spreadsheet-like UI, built-in search, and a TypeScript SDK that felt like magic.
What Xata Offers for Free
Xata free tier:
- 15 GB data storage + 15 GB search storage
- 750 requests/second — handles serious traffic
- Built-in full-text search powered by Elasticsearch
- File attachments — store images/files directly in records
- Branching — test schema changes safely
- TypeScript-first SDK with autocomplete
- REST API for any language
Quick Start
# Install CLI
npm install -g @xata.io/cli
# Login and init
xata auth login
xata init --db https://YOUR-workspace.xata.sh/db/myapp
REST API
# Insert a record
curl -X POST 'https://YOUR-workspace.xata.sh/db/myapp:main/tables/posts/data' \
-H 'Authorization: Bearer xau_YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"title": "Getting Started with Xata",
"content": "Xata is a serverless database...",
"author": "Alice",
"published": true
}'
# Search across all columns
curl -X POST 'https://YOUR-workspace.xata.sh/db/myapp:main/tables/posts/search' \
-H 'Authorization: Bearer xau_YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"query": "serverless database",
"fuzziness": 1
}'
TypeScript SDK
import { getXataClient } from './xata'; // Auto-generated
const xata = getXataClient();
// Insert
const post = await xata.db.posts.create({
title: 'My First Post',
content: 'Hello, Xata!',
author: 'Alice',
published: true
});
// Query with filters
const recentPosts = await xata.db.posts
.filter({ published: true })
.sort('created_at', 'desc')
.getPaginated({ pagination: { size: 10 } });
// Full-text search with highlighting
const results = await xata.db.posts.search('serverless', {
fuzziness: 1,
highlight: { enabled: true }
});
// Returns results with <em>serverless</em> highlighted in matches
// Aggregate
const stats = await xata.db.posts.aggregate({
totalPosts: { count: '*' },
byAuthor: { topValues: { column: 'author', size: 5 } }
});
File Attachments
// Upload an image directly to a record
const user = await xata.db.users.create({
name: 'Alice',
avatar: {
base64Content: imageBase64,
mediaType: 'image/png',
name: 'avatar.png'
}
});
// Access the file URL
console.log(user.avatar?.url); // CDN URL for the image
Schema Branching
# Create a branch
xata branch create feature-comments
# Add a table on the branch
xata schema edit --branch feature-comments
# Add 'comments' table with columns
# Compare changes
xata branch diff feature-comments
# Merge to main
xata branch merge feature-comments
Perfect For
- Next.js/Remix apps — TypeScript SDK with autocomplete
- Content platforms — built-in search, no Elasticsearch setup
- MVPs — spreadsheet UI for non-technical team members to view/edit data
- Jamstack sites — serverless, no infrastructure to manage
Need to fill your database with web data? Check out my web scraping actors on Apify — automated data collection from any website.
Need a custom data pipeline? Email me at spinov001@gmail.com — I build scraping-to-database solutions.
Top comments (0)