Deploy Cognee
Self-hosted AI memory for agents: Cognee API, Postgres + pgvector, auth on
Just deployed
/var/lib/postgresql/data
Just deployed
/cognee-storage
Deploy and Host Cognee on Railway
Cognee is an open-source AI memory engine (Apache-2.0). It takes documents, notes and conversations, builds a knowledge graph plus vector embeddings from them, and lets agents and apps search that memory through a REST API, the Python SDK or an MCP server. It works with OpenAI, Anthropic, Gemini, Ollama and other LLM providers.
About Hosting Cognee
This template runs the Cognee API server 1.6.8 (official cognee/cognee image, pinned by version and digest) built from a public GitHub repo, with Railway's Postgres for users, API keys, datasets and pgvector embeddings. Ingested files and the per-dataset graph files live on a volume at /cognee-storage, so they survive redeploys. Authentication and per-user datasets are on, the token-signing secrets and the admin password are generated, and open self-registration is closed. You only enter your LLM API key. Cognee runs its database migrations on every start, and /health checks Postgres, pgvector, the graph store and the file storage before Railway routes traffic.
Common Use Cases
- Long-term memory for AI agents and chatbots, shared across sessions and tools
- A searchable knowledge graph over internal documents, notes and tickets
- A memory backend for coding assistants through the Cognee MCP server in API mode
Dependencies for Cognee Hosting
- An LLM API key (OpenAI by default; other providers through
LLM_PROVIDERandLLM_MODEL) - PostgreSQL with pgvector (included: Railway's Postgres)
Deployment Dependencies
- Cognee repository and releases: https://github.com/topoteretes/cognee/releases/tag/v1.6.8
- Cognee documentation: https://docs.cognee.ai/
- Template repository: https://github.com/aalfath/cognee-railway-template
Implementation Details
After the deploy:
- Open
https://YOUR-DOMAIN/docsfor the interactive API docs. - Log in as the built-in admin
default_user@example.com. The password isDEFAULT_USER_PASSWORDin the Cognee service's variables:curl -X POST https://YOUR-DOMAIN/api/v1/auth/login -d username=default_user@example.com -d password=YOUR-PASSWORD. - Create an API key with the returned token:
POST /api/v1/auth/api-keyswithAuthorization: Bearer YOUR-TOKENand the body{"name":"agents"}. The key is shown once. - Send it as the
X-Api-Keyheader:POST /api/v1/add, then/api/v1/cognify, then/api/v1/search. For MCP clients, runcognee-mcp --transport http --api-url https://YOUR-DOMAIN --api-token YOUR-KEY --api-auth-scheme x-api-keyon your own machine.
Choose the embedding model before the first ingest: changing it later leaves old vectors at the old width. Without an LLM key, Cognee falls back to small local models. Set ALLOW_SIGNUP=true on the Cognee service only if you want anyone to create an account. Updates: Railway shows an update notice when the template repo's main changes; read its CHANGELOG.md and back up Postgres before you apply one.
Why Deploy Cognee 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 Cognee 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
LLM_API_KEY
Your OpenAI API key, used for the LLM and for embeddings. For another provider also set LLM_PROVIDER, LLM_MODEL and the EMBEDDING_* variables.

