Deploy Spring AI RAG Starter
Ask questions about your PDFs and docs. Java, Spring AI and pgvector.
pgvector
Just deployed
/var/lib/postgresql
Just deployed
Deploy and Host Spring AI RAG Starter on Railway
Spring AI RAG Starter is a ready-to-run Java service for asking questions about your own documents. Upload PDFs, text or Markdown files, then search them in plain English from a built-in web page or a REST API. It is built on Spring Boot 4, Spring AI 2 and Postgres with pgvector.
About Hosting Spring AI RAG Starter
The template deploys two services: the API, built from source with a Dockerfile, and a pgvector database with a persistent volume, connected over Railway's private network. The embedding model is bundled inside the app, so search works without any outside AI service or API key. Each deployment generates its own access key (APP_API_KEY in the API service's Variables tab) that protects every endpoint. Give the API at least 1 GB of memory. For written answers with citations, set AI_CHAT=openai and add your OPENAI_API_KEY.
Common Use Cases
- Search a team handbook, policies or internal docs in plain English
- Add question answering over PDFs to an existing app through the REST API
- Start a Java RAG project from a working, deployed baseline
Dependencies for Spring AI RAG Starter Hosting
- Postgres with the pgvector extension (included in this template)
- Optional: an OpenAI API key for written answers
Implementation Details
[Include any code snippets or implementation details. This section is optional. Exclude if nothing to add.]
Why Deploy Spring AI RAG Starter on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Spring AI RAG Starter on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
pgvector
pgvector/pgvector:pg18PGDATA
Folder inside the volume where Postgres stores its data. Leave as is.
POSTGRES_DB
Name of the database created on first start.
POSTGRES_USER
Database user created on first start.
SSL_CERT_DAYS
How many days the database’s SSL certificate is valid.
PGPORT_PRIVATE
Database port on the private network.
RAILWAY_DEPLOYMENT_DRAINING_SECONDS
Seconds Postgres gets to shut down cleanly during redeploys.

