Production Deployment
This page assumes you are deploying the broader NeuroLab platform. It does not describe infrastructure contained in this docs repository itself.
Deploying NeuroLab to production requires a distributed approach to ensure scalability, security, and reliability. We recommend using managed services to reduce operational overhead.
Deployment Architecture
In a production environment, the services are typically distributed as follows:
- Backend API: Render or Heroku (Node.js)
- AI Service: Render (Web Service) or AWS EC2 (Python/FastAPI)
- Frontend (Platform & Docs): Vercel or Netlify
- Databases: MongoDB Atlas, InfluxDB Cloud, and Upstash (Redis)
- Object Storage: AWS S3 or Google Cloud Storage (GCS)
1. Database Setup
Before deploying the services, set up your production databases:
MongoDB Atlas
- Create a cluster on MongoDB Atlas.
- Create a database user and whitelist the IP addresses of your deployment services.
- Obtain the
MONGODB_URI.
InfluxDB Cloud
- Sign up for InfluxDB Cloud.
- Create an Organization and a Bucket named
eeg_data. - Generate an API Token with read/write access.
Redis (Upstash)
- Create a Redis database on Upstash.
- Obtain the
REDIS_URL.
2. Backend Deployment (Render)
- Connect your GitHub repository to Render.
- Create a new Web Service and select the
backend/directory. - Use the following settings:
- Environment:
Node - Build Command:
npm ci - Start Command:
npm start
- Environment:
- Add your
.envvariables in the Render dashboard.
3. AI Service Deployment
The AI Service is memory-intensive. Ensure you select an instance with at least 4GB of RAM (8GB+ recommended).
- Create a new Web Service on Render and select the
AI Service/backenddirectory. - Use the following settings:
- Environment:
Python - Build Command:
pip install -r requirements.txt -r requirements-ml.txt -r requirements-runtime.txt - Start Command:
uvicorn main:app --host 0.0.0.0 --port 8000
- Environment:
- Configure the environment variables, ensuring
AI_API_URLpoints to your production backend.
4. Frontend Deployment (Vercel)
Vercel is the recommended platform for the platform and docs sites.
- Connect your repository to Vercel.
- For Docs: Select the
docs/directory.- Vercel will automatically detect the Next.js project.
- For Platform: Select the
platform/directory.- Set the build command to
npm run buildand output directory todist.
- Set the build command to
- Add the
NEXT_PUBLIC_API_URLvariable pointing to your production backend.
5. Security & Optimization
SSL/TLS
All services should be served over HTTPS. Render and Vercel handle SSL certificates automatically.
CORS Configuration
In production, you must restrict allowed origins to your specific domains. Update the ALLOWED_ORIGINS variable in both Backend and AI Service.
Secret Management
Never commit secrets to your repository. Use the secret management features provided by Render and Vercel.
6. CI/CD with GitHub Actions
NeuroLab includes GitHub Actions workflows to automate testing and container builds.
- Backend CI: Runs on every PR to ensure tests pass.
- Docker Publish: Automatically builds and pushes Docker images to GitHub Container Registry (GHCR) when a new release is created.
Next Steps
Now that your platform is deployed, you can explore the core concepts and API references: