This guide is intended for enterprise customers only who have specifically opted for self-hosting as part of their enterprise plan. If you’re on a standard plan, please use our hosted API at console.supermemory.ai.
Prerequisites
Before you start, you’ll need to gather several API keys and set up accounts with various services. This comprehensive guide will walk you through obtaining each required component.Enterprise Deployment Package
Your enterprise deployment package is provided by the supermemory team and contains:- Your unique Host ID (
NEXT_PUBLIC_HOST_ID
) - The compiled JavaScript bundle
- The deployment script
Cloudflare
Create Account
- Go to cloudflare.com and create an account
- Your Account ID is the long randon string in the URL bar
Create API Token
- Navigate to Cloudflare API Tokens
- Click “Create Token”
- Use the “Custom token” template
- Configure the token with these permissions:
- Account:AI Gateway:Edit
- Account:Hyperdrive:Edit
- Account:Workers KV Storage:Edit
- Account:Workers R2 Storage:Edit
- Click “Continue to summary” → “Create Token”
- Important: Copy and securely store the token immediately (it won’t be shown again)
Enable Workers
- In your Cloudflare dashboard, go to Workers & Pages
- If prompted, accept the Workers terms of service
- Choose a subdomain for your workers (e.g.,
yourcompany.workers.dev
)
CLOUDFLARE_ACCOUNT_ID
and CLOUDFLARE_API_TOKEN
are now ready.
Database
You’ll need to provide a PostgreSQL connection string via theDATABASE_URL
environment variable.
The database must:
- Support the pgvector extension for vector operations
- Be accessible from Cloudflare Workers
- Support SSL connections
- Allow connections from Cloudflare’s IP ranges
LLM Providers
OpenAI
- Go to platform.openai.com
- Sign in or create an account
- Navigate to API Keys in the left sidebar
- Click “Create new secret key”
- Name your key (e.g., “supermemory Self-Hosted”)
- Copy the key and store it securely
- Add billing information if you haven’t already
Anthropic
- Go to console.anthropic.com
- Create an account and complete verification
- Navigate to API Keys
- Click “Create Key”
- Name your key and copy it securely
Gemini
- Go to Google AI Studio
- Sign in with your Google account
- Click “Get API key” → “Create API key”
- Choose an existing Google Cloud project or create a new one
- Copy your API key
Groq
- Go to console.groq.com
- Sign up for an account
- Navigate to API Keys
- Click “Create API Key”
- Name your key and copy it
Email Service Setup
Resend
- Go to resend.com and create an account
- Navigate to API Keys
- Click “Create API Key”
- Name your key (e.g., “supermemory Production”)
- Copy the key for
RESEND_API_KEY
- Verify your sending domain in the Domains section
Connectors (Optional)
Google Drive
- Go to Google Cloud Console
- Create or select a project
- Enable the Google Drive API
- Go to Credentials → Create Credentials → OAuth client ID
- Configure the OAuth consent screen if required
- Choose Web application
- Add authorized redirect URIs for your domain
- Copy
GOOGLE_CLIENT_ID
andGOOGLE_CLIENT_SECRET
Microsoft OneDrive
- Go to Azure Portal
- Navigate to Microsoft Entra ID → App registrations
- Click “New registration”
- Name your app and set redirect URI
- Go to Certificates & secrets → New client secret
- Copy the Application (client) ID and Client secret
- Use for
MICROSOFT_CLIENT_ID
andMICROSOFT_CLIENT_SECRET
Notion
- Go to Notion Developers
- Click “Create new integration”
- Fill in the integration details
- Copy the Internal Integration Token
- Set up OAuth if needed for user connections
- Use for
NOTION_CLIENT_ID
andNOTION_CLIENT_SECRET
Setup deployment files
Extract the deployment package provided by the supermemory team to your preferred directory:Configure environment variables
The deployment script reads all environment variables from your shell at runtime. We ship an example file that lists the full set supported by the worker.Required values are mandatory for a successful deploy – leave optional ones empty if you don’t need the related feature.
Name | Required? | Description |
---|---|---|
NODE_ENV | ✅ | development , staging or production . |
NEXT_PUBLIC_HOST_ID | ✅ | Your unique Host ID provided by the supermemory team. |
BETTER_AUTH_SECRET | ✅ | Random 32-byte string – run openssl rand -base64 32 . |
BETTER_AUTH_URL | ✅ | Public base URL for the API (no trailing / ). Example: https://api.example.com . |
DATABASE_URL | ✅ | Postgres connection string (e.g. postgres://user:pass@host:5432/db ). |
CLOUDFLARE_ACCOUNT_ID | ✅ | Your Cloudflare account ID. |
CLOUDFLARE_API_TOKEN | ✅ | Token created in Prerequisites. |
OPENAI_API_KEY | ✅ | Key from platform.openai.com. |
RESEND_API_KEY | ✅ | E-mail provider key if you plan to send e-mails. |
ANTHROPIC_API_KEY | Needed to use Claude models. | |
GEMINI_API_KEY | Key for Google Gemini models. | |
GROQ_API_KEY | Key for Groq models. | |
AUTH_GITHUB_ID / AUTH_GITHUB_SECRET | Enable GitHub OAuth login. | |
AUTH_GOOGLE_ID / AUTH_GOOGLE_SECRET | Enable Google OAuth login. | |
GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRET | Needed for Google Drive connector. | |
MICROSOFT_CLIENT_ID / MICROSOFT_CLIENT_SECRET | Needed for OneDrive connector. | |
NOTION_CLIENT_ID / NOTION_CLIENT_SECRET | Needed for Notion connector. | |
CLOUDFLARE_AI_GATEWAY_NAME / CLOUDFLARE_AI_GATEWAY_TOKEN | Only if you want to route requests through an AI Gateway. | |
SENTRY_DSN | If you use Sentry for error reporting. |
Deploy
With your.env
in place, run the deployment script:
Updating Your Deployment
To update your supermemory deployment, follow the same process as the initial deployment described in the Deploy section above. You can reuse your existing.env
file and add/remove any new environment variables as needed.