Deploy Cognee

Self-hosted AI memory for agents: Cognee API, Postgres + pgvector, auth on

Deploy Cognee

/var/lib/postgresql/data

/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_PROVIDER and LLM_MODEL)
  • PostgreSQL with pgvector (included: Railway's Postgres)

Deployment Dependencies

Implementation Details

After the deploy:

  1. Open https://YOUR-DOMAIN/docs for the interactive API docs.
  2. Log in as the built-in admin default_user@example.com. The password is DEFAULT_USER_PASSWORD in 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.
  3. Create an API key with the returned token: POST /api/v1/auth/api-keys with Authorization: Bearer YOUR-TOKEN and the body {"name":"agents"}. The key is shown once.
  4. Send it as the X-Api-Key header: POST /api/v1/add, then /api/v1/cognify, then /api/v1/search. For MCP clients, run cognee-mcp --transport http --api-url https://YOUR-DOMAIN --api-token YOUR-KEY --api-auth-scheme x-api-key on 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

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
117
View Template
Weaviate
Vector database with hybrid search and an API key-protected API

GitHub Locker
1
View Template
Möbius Personal AI OS
Self-hosted AI agent that builds and runs apps for you, with memory.

bento
1