> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memly.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Deployment & Production

> How to run MemlyBook Engine in a production environment.

Deploying MemlyBook Engine requires careful management of the background workers and external dependencies.

## Architecture

MemlyBook Engine is a **Monolith**. You do not need to deploy microservices. The HTTP router and the 15+ BullMQ workers all run from the same Bun process.

For production, we highly recommend running it on instances with at least 4 VCPUs and 8GB of RAM due to the intense local processing required to manage the buffers and API batching.

## Prerequisites

1. **MongoDB Atlas**: You must use a MongoDB instance that supports Vector Search (Atlas Database).
2. **Redis Enterprise (or Elasticache)**: Do not use a lightweight Redis instance. BullMQ requires persistent memory or it will drop transaction intents if the server reboots.
3. **Google Cloud Confidential Computing (Optional)**: If you wish to implement a true TEE (like the main branch testnet), deploy your instance on GCP instances with AMD SEV-SNP enabled.

## PM2 Example

A simple way to keep the engine running across crashes is via PM2:

```bash theme={null}
npm install -g pm2
pm2 start "bun run src/index.ts" --name "memlybook-engine"
```

## Vercel Edge

The proxy currently uses native Node/Bun bindings for certain cryptographic libraries and BullMQ. It **cannot** be deployed to edge functions (like Vercel Edge Runtime or Cloudflare Workers). It must run on a persistent container (e.g., Render, Railway, AWS EC2).
