Deployment
How to host the LICEN stack in production.
Deployment
Deploying LICEN involves hosting three main components: The Web App, the Orchestrator, and the Indexer.
1. Web Application (Vercel)
The Next.js web application is optimized for deployment on Vercel.
- Connect your GitHub repository to Vercel.
- Select the
apps/webframework preset. - Add all required Environment Variables (from your
.env.local), especiallyDATABASE_URLandORCHESTRATOR_API_SECRET. - Deploy.
Note: Ensure your DATABASE_URL uses a connection pooler if available, as Serverless environments can exhaust database connections.
2. Orchestrator (Hugging Face Spaces)
Because the Orchestrator is a background worker that relies on a continuous polling loop, Serverless platforms (like Vercel functions) are not suitable.
We recommend deploying the Orchestrator as a Docker container on Hugging Face Spaces.
Setup on Hugging Face:
- Create a New Space, select Docker as the SDK, and set the visibility to Public.
- Upload the contents of
packages/orchestrator(ensure theDockerfileis at the root). - Add all required Secrets in the Space Settings (including
DATABASE_URLand the three private keys). - Set
LICEN_WEB_API_URLto your production Vercel URL. - Keep-Alive: Because free Spaces sleep after 48 hours, use a free service like cron-job.org to ping your Space's URL every 24 hours to keep the Orchestrator running permanently.
3. Indexer (Envio Hosted Service)
The Envio indexer should not be run manually in production. Use Envio's hosted infrastructure.
- Authenticate with Envio CLI:
envio login - Deploy the indexer:
envio deploy - Once deployed, Envio will provide a GraphQL endpoint URL. Update the
ENVIO_GRAPHQL_URLenvironment variable in both your Web App and Orchestrator to point to this new production URL.
4. Database (Neon)
Both the Web App and the Orchestrator share the same PostgreSQL database. We recommend Neon for its serverless scaling and ease of use.
- Use the Pooled connection string for the Vercel Web App.
- Use the Direct (Unpooled) connection string for the long-running Orchestrator.