Participate in our content hackathon before it ends on September 30th, for a chance to win incredible prizes!
Modern applications are complex. We make the data part easy with the functionality your application needs to evolve and scale.
Stop worrying about managing database infrastructure. In seconds you can have a fully managed and scalable database built on Postgres, the database that's trusted by millions of developers and businesses around the world. Get started with our generous free tier today and scale up or down as needed.
Features include a powerful, lightning-fast full-text search engine (powered by Elasticsearch), support for rich data types, and vector search capabilities. Easily create AI-enabled applications with ChatGPT embedded in your database. Xata automatically replicates all of your data from Postgres to additional data stores, so you don't have to.
// Typings and client automatically up to date
import { getXataClient } from "./xata";
const xata = getXataClient();
// Fuzzy-search with column weights
const records = await xata.search.all("next.js", {
tables: [
{
table: "posts",
target: [
{ column: "content", weight: 2 },
{ column: "title", weight: 5 },
],
},
],
fuzziness: 2,
prefix: "phrase",
});
from xata.client import XataClient
xata = XataClient()
records = xata.data().search_branch({
"query": "next.js",
"tables": [
{
"table": "posts",
"target": [
{ "column": "content", "weight": 2 },
{ "column": "title", "weight": 5 },
],
}
],
"fuzziness": 2,
"prefix": "phrase",
})
// POST https://{workspace}.{region}.xata.sh/db/{db}:{branch}/search
{
"query": "next.js",
"tables": [
{
"table": "posts",
"target": [
{ "column": "content", "weight": 2 },
{ "column": "title", "weight": 5 },
],
}
],
"fuzziness": 2,
"prefix": "phrase",
}
// Typings and client automatically up to date
import { getXataClient } from "./xata";
const xata = getXataClient();
// Use the ask function to query ChatGPT with your data
const result = await xata.db.Tutorial.ask("How do I retrieve a single record?", {
rules: [
"Do not answer questions about pricing or the free tier. Respond that Xata has several options available, please check https://xata.io/pricing for more information.",
"When you give an example, this example must exist exactly in the context given.",
],
searchType: "keyword",
search: {
boosters: [
{
valueBooster: {
column: "section",
value: "guide",
factor: 18
}
}
]
}
from xata.client import XataClient
xata = XataClient()
result = xata.data().ask(
"Tutorial",
"How do I retrieve a single record?",
rules = [
"Do not answer questions about pricing or the free tier. Respond that Xata has several options available, please check https://xata.io/pricing for more information.",
"When you give an example, this example must exist exactly in the context given.",
],
options = {
"searchType": "keyword",
"search": {
"boosters": [
{
"valueBooster": {
"column": "section",
"value": "guide",
"factor": 18
}
}
]
}
}
}
)
// POST https://{workspace}.{region}.xata.sh/db/{db}:{branch}/tables/{table}/ask
{
"question": "How do I retrieve a single record?",
"rules": [
"Do not answer questions about pricing or the free tier. Respond that Xata has several options available, please check https://xata.io/pricing for more information.",
"When you give an example, this example must exist exactly in the context given.",
],
"searchType": "keyword",
"search": {
"boosters": [
{
"valueBooster": {
"column": "section",
"value": "guide",
"factor": 18
}
}
]
}
}
// Typings and client automatically up to date
import { getXataClient } from "./xata";
const xata = getXataClient();
// Find nearest neighbors of the given vector embedding
const results = await xata.db.docs.vectorSearch(
"embeddings",
[0.1, 0.2, 0.3],
{ size: 5 }
);
from xata.client import XataClient
xata = XataClient()
resp = xata.data().vector_search("docs", {
"queryVector": [0.1, 0.2, 0.3],
"column": "embeddings",
"size": 5
})
// POST https://{workspace}.{region}.xata.sh/db/{db}:{branch}/tables/{table}/vectorSearch
{
"queryVector": [0.1, 0.2, 0.3],
"column": "embeddings",
"size": 5
}
// Typings and client automatically up to date
import { getXataClient } from "./xata";
const xata = getXataClient();
// Run multiple pre-defined transactions
const result = await xata.transactions.run([
{ insert: { table: 'titles', record: { originalTitle: 'A new film' } } },
{ insert: { table: 'titles', record: { id: 'new-0', originalTitle: 'The squeel' }, createOnly: true } },
{ update: { table: 'titles', id: 'new-0', fields: { originalTitle: 'The sequel' }, ifVersion: 0 } },
{ update: { table: 'titles', id: 'new-1', fields: { originalTitle: 'The third' }, upsert: true } },
{ get: { table: "titles", id: "new-0", columns: ['id', 'originalTitle']}},
{ delete: { table: 'titles', id: 'new-0' } }
]);
from xata.client import XataClient
xata = XataClient()
result = xata.data().transaction({
"operations": [
{ "insert": { "table": "titles", "record": { "originalTitle": "A new film" } } },
{ "insert": { "table": "titles", "record": { "id": "new-0", "originalTitle": "The squeel" }, "createOnly": true } },
{ "update": { "table": "titles", "id": "new-0", "fields": { "originalTitle": "The sequel" }, "ifVersion": 0 } },
{ "update": { "table": "titles", "id": "new-1", "fields": { "originalTitle": "The third" }, "upsert": true } },
{ "get": { "table": "titles", "id": "new-0", "columns": ["id", "originalTitle"] } },
{ "delete": { "table": "titles", "id": "new-0" } }
]
})
// POST https://{workspace}.{region}.xata.sh/db/{db}:{branch}/transaction
{
"operations": [
{ "insert": { "table": "titles", "record": { "originalTitle": "A new film" } } },
{ "insert": { "table": "titles", "record": { "id": "new-0", "originalTitle": "The squeel" }, "createOnly": true } },
{ "update": { "table": "titles", "id": "new-0", "fields": { "originalTitle": "The sequel" }, "ifVersion": 0 } },
{ "update": { "table": "titles", "id": "new-1", "fields": { "originalTitle": "The third" }, "upsert": true } },
{ "get": { "table": "titles", "id": "new-0", "columns": ["id", "originalTitle"] } },
{ "delete": { "table": "titles", "id": "new-0" } }
]
}
const record = await xata.db.Users.create({
name: 'Keanu',
photo: {
name: 'file.png',
mediaType: 'image/png',
base64Content:
'iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAEklEQVR42mNk+M9QzwAEjDAGACCDAv8cI7IoAAAAAElFTkSuQmCC'
}
});
from xata.client import XataClient
xata = XataClient()
record = xata.records().insert("Users", {
"name": "Keanu",
"photo": {
"name": "file.png",
"mediaType": "image/png",
"base64Content": "iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAEklEQVR42mNk+M9QzwAEjDAGACCDAv8cI7IoAAAAAElFTkSuQmCC",
}
});
// POST https://{workspace}.{region}.xata.sh/db/{db}:{branch}/tables/{table}/data
{
"name": "Keanu",
"photo": {
"name": "file.png",
"mediaType": "image/png",
"base64Content": "iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAEklEQVR42mNk+M9QzwAEjDAGACCDAv8cI7IoAAAAAElFTkSuQmCC"
}
}
Branch your database like your code. Run xata branch
from our CLI then xata pull
and xata push
to start collaborating with your team.
Hey team. I'm making a feature branch so we can collaborate.
# Create a branch in code or the UI
xata branch create my-changes
# Made changes in the UI? Pull them down
xata pull my-changes
# Made changes in the code? Push them up
xata push my-changes
xata pull
CLIupdated TS Types in src/xata.ts
xata pull
CLIcreated new migration files in .xata/migrations
Create a PR like normal in GitHub. Xata keeps track of your schema changes in the background and will create a comment with your schema and status in the PR.
I made some changes to the Xata schema in the UI. Time to run xata pull my-changes
to get back Types! Now I'll commit the generated migration files into a PR along with my app code.
Alexis
committedadd desc column
into my-changes
just now"addColumn": {
"column": {
"name": "description",
"type": "string"
},
"table": "Posts"
}
Xata
botnoticed a migration on GitHub. Creating a preview branch for this PR.Vercel and Netlify integrations generate a preview branch with your PR and deployment preview, eliminating the need for separate dev and staging environments
Xata
botcommented 3 minutes ago on GitHub
Preview branches created for your PR. Learn more about Xata for GitHub.
Database | State | Preview |
---|---|---|
preview-my-changes | ✅ Ready | View on Xata |
The pull request creates a cloned Xata database with data. Feel free to mess around, it won't affect production data. The Vercel preview build automatically points to the linked Xata database. 🎉
Vercel
botcommented 3 minutes ago on GitHub
The latest updates on your project. Learn more about Vercel for GitHub.
Name | State | Preview |
---|---|---|
my-website | ✅ Ready | View on Xata |
Merge your pull request as usual. Our system will run checks, perform a zero-downtime migration, and close any open branches, automatically.
Alexis
merged commit3daa381
into main
just nowXata
botnoticed a merge. Deleting branchpreview-my-changes
Xata
botnoticed a merge. Merging branchmy-changes
to main
Merged the pull request. Xata automatically merged the database changes to the main
branch with zero downtime.
Xata uses the best tools for the job, extending your Postgres database to support more use cases. Here are some popular use cases among our customers.
With a dedicated rich type for embeddings, built-in vector similarity search and a native OpenAI integration, Xata makes it very easy to add AI capabilities to your app.
Learn MoreWhether you write your web app in Python, TypeScript, or JavaScript, you’ll enjoy the best database developer experience. It also comes with built-in support images and attachments.
Learn MoreData from Postgres is automatically replicated to Elasticsearch, the world’s most advanced search engine. The Xata search API makes it very easy to fine tune your app search.
Learn MoreThe Data API, the edge-ready TypeScript SDK, the Vercel, Netlify, and CloudFlare integrations make Xata a pleasure to use together with any serverless platform.
Learn MoreIn seconds, spin up a Postgres database that is ready to scale up (or down) with your workload. With high availability, redundancy and edge caching, the only thing you have to worry about is your application code.
Start freeJoin tens of thousands of developers who are working with Xata to build better products
Guillermo Rauch
@rauchg
Founder & CEO, Vercel
Matt Pocock
@mattpocockuk
TypeScript Educator
Matt Biilmann
@biilmann
CEO, Netlify
Benedicte (Queen) Raae 👑
@raae
Dominus Kelvin
@K.O.O
Web Dev Educator
Neha Narkhede
@nehanarkhede
Co-Founder, Confluent
Zeno Rocha
@zenorocha
Founder & CEO at resend.com
Mohamed Sahel
@mohamedsahel_
Full Stack Developer
Rick Blalock
@rblalock
Dan Cook
@dotxlem
Nakam
@Nakam360
Carlos Alberto Carnero Delgado
@PentiumBug
By Alexis Rico
You can write code in the Xata Playground using Python, TypeScript, and SQL.
By Kostas Botsas
Extracting text from File Attachments and indexing it with Python.
By Alexis Rico
Ask your data questions and get intuitive, efficient answers with OpenAI, Vercel AI and Xata
By Alejandro Martínez
Use the new JSON column type for improved data storage in Xata.
Join our community of subscribers to stay up to date with the latest news, tips and thought leadership, delivered directly to your inbox.