---
title: "Deploy Cognee"
description: "Self-hosted AI memory for agents: Cognee API, Postgres + pgvector, auth on"
category: "AI/ML"
url: https://railway.com/deploy/cognee
---

# Deploy Cognee

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

**[Deploy Cognee on Railway](https://railway.com/template/cognee)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/cognee/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** AI/ML

## Template content

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### Cognee https://cdn.jsdelivr.net/gh/topoteretes/cognee@v1.6.8/cognee-frontend/src/app/icon.svg

- **Source:** https://github.com/aalfath/cognee-railway-template
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# 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

* 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:

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.



## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/cognee
