Railway is Platform as a Service (PaaS) that supports almost any application stack or open-source framework. Railway will host your infrastructure so you don’t have to deal with configuration, while allowing you to vertically and horizontally scale it.While Railway offers built-in PostgreSQL templates, this page shows you how to use Xata as a full-managed PostgreSQL service for Railway.
Add Xata PostgreSQL to your existing Railway project
You can also add Xata to your existing project. To do this, you would typically replace the PostgreSQL service from the Railway canvas. To do this:
Create a DATABASE_URL variable and set it to the PostgreSQL connection string, which you can copy from the Xata branch Overview page.
Use DATABASE_URL as your PostgreSQL connection string in your application. See the various framework and programming language guides on how to do this.
If you had PostgreSQL on your Railway canvas, you can remove it now.
Was this page helpful?
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"Xata","colors":{"primary":"#735adc","light":"#735adc","dark":"#735adc"},"logo":{"light":"https://mintcdn.com/xata/rYmGPszzEBdWMgvX/logo/light.svg?fit=max\u0026auto=format\u0026n=rYmGPszzEBdWMgvX\u0026q=85\u0026s=4ef098482078f4153c39dc17dd26476b","dark":"https://mintcdn.com/xata/rYmGPszzEBdWMgvX/logo/dark.svg?fit=max\u0026auto=format\u0026n=rYmGPszzEBdWMgvX\u0026q=85\u0026s=906164890c462dfd9eb1d334f76aa98d"},"favicon":"https://mintcdn.com/xata/rYmGPszzEBdWMgvX/favicon.svg?fit=max\u0026auto=format\u0026n=rYmGPszzEBdWMgvX\u0026q=85\u0026s=d86bc351b43f47f5187c041a7cb5539a","api":{},"background":{"decoration":"grid"},"navbar":{"links":[{"href":"https://xata.io/contact-support","label":"Support"},{"href":"https://www.xatastatus.com/","label":"Status"},{"href":"https://github.com/xataio","label":"GitHub"}],"primary":{"type":"button","label":"Xata Console","href":"https://console.xata.io/"}},"footer":{"socials":{"x":"https://twitter.com/xata","linkedin":"https://www.linkedin.com/company/xataio","github":"https://github.com/xataio","discord":"https://xata.io/discord","youtube":"https://www.youtube.com/@xataio"}},"fonts":{"family":"Geist"},"icons":{"library":"fontawesome"},"integrations":{"gtm":{"tagId":"GTM-PMD75RM"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"xata","hasAudioNarration":false,"actualSubdomain":"xata","customDomains":["xata.io"],"gitSource":{"type":"github","owner":"xataio","repo":"documentation","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6af1fe87ed5e3c6256df8643","clientVersion":"0.0.4094","searchFilterCounts":[{"language":"default","tag":"Guides","count":60},{"language":"default","tag":"API Reference","count":51},{"language":"default","tag":"Endpoints","count":51},{"language":"default","tag":"Open Source","count":34},{"language":"default","tag":"pgstream","count":34},{"language":"default","tag":"Organizations","count":22},{"language":"default","tag":"CLI Reference","count":19},{"language":"default","tag":"Manage","count":17},{"language":"default","tag":"Release Notes","count":15},{"language":"default","tag":"AI Agents","count":10}]},"assistantConfig":{"deflection":{"enabled":true,"email":"support@xata.io"}},"basePath":"/docs","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"comment-mode","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":true},"customCss":[{"filePath":"style.css","content":"#navigation-items li[id=\"/overview\"]>button[aria-controls]>div:last-child{display:none}"}],"page":{"pagePath":"quickstarts/railway","slug":"/quickstarts/railway","pageMetadata":{"title":"Use Xata with Railway","description":"Learn how to connect your Railway project with a Xata PostgreSQL database.","icon":"train","href":"/quickstarts/railway"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Learn how to connect your Railway project with a Xata PostgreSQL database.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{Heading,OptimizedImage,Tip}=_components;if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`what-is-railway`,children:`What is Railway`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.a,{href:`https://railway.com?utm_medium=integration\u0026utm_source=docs\u0026utm_campaign=xata`,children:`Railway`}),` is Platform as a Service (PaaS) that supports almost any application stack or open-source framework. Railway will host your infrastructure so you don’t have to deal with configuration, while allowing you to vertically and horizontally scale it.`]}),`\n`,_jsx(_components.p,{children:`While Railway offers built-in PostgreSQL templates, this page shows you how to use Xata as a full-managed PostgreSQL service for Railway.`}),`\n`,_jsx(Heading,{level:`2`,id:`prerequisites`,children:`Prerequisites`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Xata account`}),`\n`,_jsx(_components.li,{children:`Railway account`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`getting-started`,children:`Getting started`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Create a project and branch in the `,_jsx(_components.a,{href:`https://console.xata.io`,children:`Xata console`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`In the `,_jsx(_components.strong,{children:`Overview`}),` tab of the branch, copy the connection string.`]}),`\n`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-branch-overview.png?fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=c871b185aca450dd92f0f81713563924`,alt:`Branch overview showing connection string and database details`,className:`mint-rounded-lg`,\"data-og-width\":`2116`,width:`2116`,\"data-og-height\":`1928`,height:`1928`,\"data-path\":`images/guides/railway-branch-overview.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-branch-overview.png?w=280\u0026fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=ef443ea9936de75d743524a1bc08c8d8 280w, https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-branch-overview.png?w=560\u0026fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=01c12415454ef815735b2031c5142be3 560w, https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-branch-overview.png?w=840\u0026fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=74da17e4bf11a27170689f87b5498a1a 840w, https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-branch-overview.png?w=1100\u0026fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=96a494e5ac4a0a50e0fd6f4230de47d5 1100w, https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-branch-overview.png?w=1650\u0026fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=b74b3b06398a3d59c62674ae856497a1 1650w, https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-branch-overview.png?w=2500\u0026fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=0ce6de410b37efaafcaef348303a360b 2500w`}),`\n`,_jsxs(_components.ol,{start:`3`,children:[`\n`,_jsx(_components.li,{children:`In the Railway Marketplace you can find the following Xata specific templates:`}),`\n`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://railway.com/deploy/xata-postgresql-nodejs-drizzle?utm_medium=integration\u0026utm_source=docs\u0026utm_campaign=xata`,children:`Xata PostgreSQL for Node.js and Drizzle`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://railway.com/deploy/xata-postgresql-django?utm_medium=integration\u0026utm_source=docs\u0026utm_campaign=xata`,children:`Xata PostgreSQL for Django`})}),`\n`]}),`\n`,_jsxs(_components.ol,{start:`4`,children:[`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Deploy Now`}),` in the template page.`]}),`\n`,_jsxs(_components.li,{children:[`In the creation modal, use the connection string from step 2 as the `,_jsx(_components.code,{children:`DATABASE_URL`}),` setting.`]}),`\n`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-template-install.png?fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=60e926d3297218142dd497e5f8b67bb4`,alt:`Railway template installation modal showing database URL configuration`,className:`mint-rounded-lg`,\"data-og-width\":`2428`,width:`2428`,\"data-og-height\":`2146`,height:`2146`,\"data-path\":`images/guides/railway-template-install.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-template-install.png?w=280\u0026fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=52fbcfb26283582e555cff89c38b8327 280w, https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-template-install.png?w=560\u0026fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=91920127cab46efc90abd2fb8ad8bbce 560w, https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-template-install.png?w=840\u0026fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=38ad15351708b2cba22844e08c04d3c5 840w, https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-template-install.png?w=1100\u0026fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=1bc5f495abf109d189ccf3c886951773 1100w, https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-template-install.png?w=1650\u0026fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=648d6cdde551b8961153aa6b5b146d06 1650w, https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-template-install.png?w=2500\u0026fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=5658f68bc74c6e11b742bff3dc59cfed 2500w`}),`\n`,_jsxs(_components.ol,{start:`6`,children:[`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Deploy`}),`. Once the deployment is done, visit the resulting page at the assign domain. On success, it should show the PostgreSQL version.`]}),`\n`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-template-success.png?fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=4178f3de20371646120d873104ae1788`,alt:`Railway template success page showing PostgreSQL version and deployment confirmation`,className:`mint-rounded-lg`,\"data-og-width\":`2228`,width:`2228`,\"data-og-height\":`880`,height:`880`,\"data-path\":`images/guides/railway-template-success.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-template-success.png?w=280\u0026fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=c83b80f146a1903e3c062fbcb290fcd6 280w, https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-template-success.png?w=560\u0026fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=ef5b4f9c19249f18c2a291a3c8e2bd38 560w, https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-template-success.png?w=840\u0026fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=2159cc38f719b0cba8c7585beb34df6c 840w, https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-template-success.png?w=1100\u0026fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=54ae2714cda6699c8b5accd122ddb136 1100w, https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-template-success.png?w=1650\u0026fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=a844c932946e2af20bfdb4855928d8d1 1650w, https://mintcdn.com/xata/PDDxPY9xptrEGBCP/images/guides/railway-template-success.png?w=2500\u0026fit=max\u0026auto=format\u0026n=PDDxPY9xptrEGBCP\u0026q=85\u0026s=d5562af677ab5a1d8a3dce74a3015b6d 2500w`}),`\n`,_jsx(Tip,{children:_jsx(_components.p,{children:`The above screenshot is from the Node.js template. The other templates have a different success screen.`})}),`\n`,_jsx(Heading,{level:`2`,id:`add-xata-postgresql-to-your-existing-railway-project`,children:`Add Xata PostgreSQL to your existing Railway project`}),`\n`,_jsx(_components.p,{children:`You can also add Xata to your existing project. To do this, you would typically replace the PostgreSQL service from the Railway canvas. To do this:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Create a `,_jsx(_components.code,{children:`DATABASE_URL`}),` variable and set it to the PostgreSQL connection string, which you can copy from the Xata branch `,_jsx(_components.strong,{children:`Overview`}),` page.`]}),`\n`,_jsxs(_components.li,{children:[`Use `,_jsx(_components.code,{children:`DATABASE_URL`}),` as your PostgreSQL connection string in your application. See the various framework and programming language guides on how to do this.`]}),`\n`,_jsx(_components.li,{children:`If you had PostgreSQL on your Railway canvas, you can remove it now.`}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Use Xata with Railway","description":"Learn how to connect your Railway project with a Xata PostgreSQL database.","icon":"train","href":"/quickstarts/railway"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"What is Railway","slug":"what-is-railway","depth":2,"children":[]},{"title":"Prerequisites","slug":"prerequisites","depth":2,"children":[]},{"title":"Getting started","slug":"getting-started","depth":2,"children":[]},{"title":"Add Xata PostgreSQL to your existing Railway project","slug":"add-xata-postgresql-to-your-existing-railway-project","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/xata/42338cddc6e87248/tracking.js"],"dynamicCss":".mint-rounded-lg {\n border-radius: 0.5rem\n}","subdomain":"xata","siteName":"Xata","title":"Use Xata with Railway - Xata","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-04-14T19:41:51.467Z","originalFileLocation":"quickstarts/railway.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Learn how to connect your Railway project with a Xata PostgreSQL database.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Xata\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/xata/aBhvMQRuTYnJZzL3/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/xata/aBhvMQRuTYnJZzL3/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/xata/aBhvMQRuTYnJZzL3/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/xata/aBhvMQRuTYnJZzL3/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/xata/aBhvMQRuTYnJZzL3/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/xata/aBhvMQRuTYnJZzL3/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/xata/aBhvMQRuTYnJZzL3/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/xata/aBhvMQRuTYnJZzL3/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/xata/aBhvMQRuTYnJZzL3/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Use Xata with Railway - Xata\">\u003cmeta data-mint-head property=\"og:description\" content=\"Learn how to connect your Railway project with a Xata PostgreSQL database.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Xata\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://xata.io/docs/quickstarts/railway\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://xata.mintlify.site/docs/_mintlify/api/og/v2?division=Platforms\u0026amp;title=Use+Xata+with+Railway\u0026amp;description=Learn+how+to+connect+your+Railway+project+with+a+Xata+PostgreSQL+database.\u0026amp;theme=1df92fd69c10f331b7ecd2a0\u0026amp;signature=2f30dd8d98ec959c678f5527688e6bde48c88838ba8577c93885a894fe34e8b0\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Use Xata with Railway - Xata\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Learn how to connect your Railway project with a Xata PostgreSQL database.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://xata.mintlify.site/docs/_mintlify/api/og/v2?division=Platforms\u0026amp;title=Use+Xata+with+Railway\u0026amp;description=Learn+how+to+connect+your+Railway+project+with+a+Xata+PostgreSQL+database.\u0026amp;theme=1df92fd69c10f331b7ecd2a0\u0026amp;signature=2f30dd8d98ec959c678f5527688e6bde48c88838ba8577c93885a894fe34e8b0\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/xata/aBhvMQRuTYnJZzL3/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Xata\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#735adc\">\u003clink data-mint-head rel=\"canonical\" href=\"https://xata.io/docs/quickstarts/railway\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/quickstarts/railway.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://xata.io/#organization\",\"name\":\"Xata\",\"url\":\"https://xata.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/xata/rYmGPszzEBdWMgvX/logo/light.svg?fit=max\u0026auto=format\u0026n=rYmGPszzEBdWMgvX\u0026q=85\u0026s=4ef098482078f4153c39dc17dd26476b\"}},{\"@type\":\"WebSite\",\"@id\":\"https://xata.io/docs#website\",\"name\":\"Xata\",\"url\":\"https://xata.io/docs\",\"publisher\":{\"@id\":\"https://xata.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://xata.io/docs/quickstarts/railway#webpage\",\"url\":\"https://xata.io/docs/quickstarts/railway\",\"name\":\"Use Xata with Railway\",\"description\":\"Learn how to connect your Railway project with a Xata PostgreSQL database.\",\"dateModified\":\"2026-04-14T19:41:51.467Z\",\"isPartOf\":{\"@id\":\"https://xata.io/docs#website\"},\"breadcrumb\":{\"@id\":\"https://xata.io/docs/quickstarts/railway#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://xata.io/docs/quickstarts/railway#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Connect\",\"item\":\"https://xata.io/docs/quickstarts/drizzle\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Platforms\",\"item\":\"https://xata.io/docs/quickstarts/netlify\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Use Xata with Railway\",\"item\":\"https://xata.io/docs/quickstarts/railway\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://xata.io/docs/quickstarts/railway#article\",\"headline\":\"Use Xata with Railway\",\"name\":\"Use Xata with Railway\",\"description\":\"Learn how to connect your Railway project with a Xata PostgreSQL database.\",\"url\":\"https://xata.io/docs/quickstarts/railway\",\"mainEntityOfPage\":{\"@id\":\"https://xata.io/docs/quickstarts/railway#webpage\"},\"dateModified\":\"2026-04-14T19:41:51.467Z\",\"publisher\":{\"@id\":\"https://xata.io/#organization\"},\"isPartOf\":{\"@id\":\"https://xata.io/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Xata\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Xata","nav":{"global":null,"tabs":[{"tab":"Guides","icon":"book-open","directory":"card","groups":[{"group":"Introduction","icon":"sparkles","root":{"title":"Xata Documentation","icon":"book","sidebarTitle":"Overview","mode":"frame","href":"/overview"},"pages":[]},{"group":"Get Started","icon":"rocket","pages":[{"title":"Quickstart","icon":"rocket","href":"/quickstart"}]},{"group":"Core Concepts","icon":"layer-group","pages":[{"title":"Branching","icon":"code-branch","iconType":"regular","href":"/core-concepts/branching"},{"title":"Data Anonymization","icon":"user-secret","href":"/core-concepts/anonymization"},{"title":"Schema Changes","icon":"database","href":"/core-concepts/schema-changes"},{"title":"Scale to Zero","icon":"pause","href":"/core-concepts/scale-to-zero"},{"title":"Serverless Proxy","icon":"bolt","href":"/core-concepts/serverless-proxy"},{"title":"Deployment Models","icon":"cloud","href":"/core-concepts/deployment"}]},{"group":"Branching Workflows","icon":"code-branch","pages":[{"title":"Create Branch","icon":"github","href":"/automations/ga-pr"},{"title":"Create a production clone","icon":"copy","href":"/tutorials/create-production-clone"},{"title":"Data Anonymization","icon":"user-secret","href":"/core-concepts/anonymization"},{"title":"Create Streaming Replica","icon":"right-left","href":"/tutorials/streaming-replication"},{"title":"Make Schema Changes","icon":"code-merge","href":"/tutorials/schema-change"},{"title":"Find and fix slow queries on a Xata branch","icon":"gauge-high","href":"/tutorials/find-slow-queries"}]},{"group":"Connect","icon":"plug","pages":[{"group":"ORMs","icon":"database","expanded":false,"pages":[{"title":"Use Xata with Drizzle","icon":"droplet","href":"/quickstarts/drizzle"}]},{"group":"Platforms","icon":"cloud","expanded":false,"pages":[{"title":"Use Xata with Netlify","description":"Connect a Netlify site to Xata PostgreSQL, and give every deploy preview its own database branch.","icon":"cloud-arrow-up","href":"/quickstarts/netlify"},{"title":"Use Xata with Railway","icon":"train","href":"/quickstarts/railway"}]},{"group":"Tools","icon":"diagram-project","expanded":false,"pages":[{"title":"Use Xata with n8n","description":"Learn how to use Xata as the memory provider for AI agents in n8n.","icon":"diagram-project","href":"/quickstarts/n8n"}]}]},{"group":"Manage","icon":"sliders","pages":[{"title":"Account Management","icon":"circle-user","href":"/platform/account"},{"title":"Organizations","icon":"users","href":"/platform/organization"},{"title":"Organization roles","icon":"user-shield","href":"/platform/organization-roles"},{"title":"API Keys","icon":"key","href":"/platform/api-key"},{"title":"MCP Server","icon":"plug","href":"/platform/mcp"},{"title":"Projects","icon":"folder","href":"/platform/project"},{"title":"Branches","icon":"code-branch","href":"/platform/branch"},{"title":"Compute","icon":"microchip","href":"/platform/compute"},{"title":"Schemas","icon":"sitemap","href":"/platform/schemas"},{"title":"Migrations","icon":"code-merge","href":"/platform/migrations"},{"title":"SQL Editor","icon":"magnifying-glass","href":"/platform/sql-editor"},{"title":"Query insights","icon":"chart-simple","href":"/platform/query-insights"},{"title":"Metrics","icon":"chart-line","href":"/platform/metrics"},{"title":"Extensions","icon":"puzzle-piece","href":"/platform/extensions"},{"title":"Logs","icon":"file-lines","href":"/platform/logs"},{"title":"AWS PrivateLink","icon":"lock","href":"/platform/privatelink"},{"title":"Single sign-on","icon":"shield-halved","href":"/platform/sso"}]},{"group":"Import and Migrate","icon":"database","pages":[{"title":"Overview","icon":"list","href":"/migrations/overview"},{"title":"AWS RDS","icon":"aws","href":"/migrations/aws-rds"},{"title":"AWS Aurora","icon":"aws","href":"/migrations/aws-aurora"},{"title":"GCP Cloud SQL","icon":"google","href":"/migrations/gcp-cloudsql"},{"title":"Azure Database","icon":"microsoft","href":"/migrations/azure"},{"title":"Self-Hosted PostgreSQL","icon":"database","href":"/migrations/self-hosted"},{"title":"Greenmask (subsets)","icon":"scissors","href":"/migrations/greenmask"},{"title":"Neon","icon":"server","href":"/migrations/neon"},{"title":"Supabase","icon":"bolt","href":"/migrations/supabase"},{"title":"Parquet files","icon":"file","href":"/migrations/parquet"}]},{"group":"Workflows","icon":"gears","pages":[{"title":"GitHub App","icon":"github","href":"/automations/github-app"},{"title":"Vercel preview deployments","icon":"cloud-arrow-up","href":"/automations/vercel-github-app"},{"title":"Create Branch","icon":"github","href":"/automations/ga-pr"},{"title":"Scheduled Clone","icon":"github","href":"/automations/ga-clone"},{"title":"Merge Readiness","icon":"github","href":"/automations/ga-check"},{"title":"Scheduled Clone","icon":"calendar","href":"/automations/kubernetes-clone"},{"title":"Bulk Delete Branches","icon":"github","href":"/automations/ga-cleanup"}]},{"group":"AI Agents","icon":"robot","root":{"title":"Xata for Agents","icon":"robot","href":"/ai-agents/overview"},"pages":[{"title":"Agent onboarding","icon":"wand-magic-sparkles","href":"/ai-agents/onboarding"},{"title":"Agent Skills","icon":"star","href":"/ai-agents/agent-skills"},{"title":"Claude Code","icon":"terminal","href":"/ai-agents/claude-code"},{"title":"Codex","icon":"code","href":"/ai-agents/codex"},{"title":"Cursor","icon":"arrow-pointer","href":"/ai-agents/cursor"},{"title":"OpenCode","icon":"terminal","href":"/ai-agents/opencode"},{"title":"GitHub Copilot","icon":"github","href":"/ai-agents/github-copilot"},{"title":"Windsurf","icon":"wind","href":"/ai-agents/windsurf"},{"title":"Cline","icon":"check-double","href":"/ai-agents/cline"},{"title":"Devin","icon":"cloud","href":"/ai-agents/devin"}]},{"group":"Reference","icon":"book","pages":[{"title":"Changelog","icon":"ship","href":"/changelog"}]}]},{"tab":"API Reference","icon":"terminal","pages":[{"title":"API Reference","href":"/api-reference/organizations/get-list-of-organizations"}]},{"tab":"CLI Reference","icon":"square-terminal","pages":[{"title":"CLI Reference","href":"/cli"}]},{"tab":"Open Source","icon":"code-branch","menu":[{"item":"pgstream","icon":"right-left","description":"Postgres replication with schema-aware streaming.","pages":[{"title":"pgstream","href":"/opensource/pgstream/overview"}]}],"pages":[{"title":"Open Source","href":"/opensource/pgstream/overview"}]}]},"basePath":"","title":"Use Xata with Railway - Xata","buildId":"dpl_3pZeXn3XukjzFRgAX73A7GNDfRJ1","deploymentId":"dpl_3pZeXn3XukjzFRgAX73A7GNDfRJ1","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-g3ZzIKzc.js","lightbox-handle-r17bVUz3.js"]}