Environment Configuration
To ensure Soteria (A.C.I.D) operates securely and connects its frontend and backend components correctly, you must configure environment variables for both the Intelligence Engine (Backend) and the Cyber Sentinel Dashboard (Frontend).
Configuration Overview
The system uses a split-deployment architecture. Environment variables are used to manage:
- Authentication & Security: JWT signing keys and admin credentials.
- Database Connectivity: Pathing for the SQLite/SQLAlchemy store.
- Cross-Service Communication: Linking the React frontend to the Flask API.
Backend Configuration (Intelligence Engine)
The backend is built with Flask and requires a .env file located in the /backend directory for local development. In production (e.g., Render), these should be set via the platform's environment settings.
Required Variables
| Variable | Description | Default (Dev) |
| :--- | :--- | :--- |
| SECRET_KEY | A unique string used to sign JWT tokens. Change this in production. | kyber-dev-secret-key... |
| SQLALCHEMY_DATABASE_URI | The connection string for the database. | sqlite:///kyber.db |
| FLASK_APP | The entry point for the API. | app.py |
| FLASK_ENV | Controls debug mode and error logging. | development |
Example .env for Backend
# Security
SECRET_KEY=your_super_secret_random_string_here
# Database
# Use sqlite for local dev, or a postgres/mysql URI for production
SQLALCHEMY_DATABASE_URI=sqlite:///kyber.db
# Flask Settings
FLASK_APP=app.py
FLASK_DEBUG=1
[!IMPORTANT] Admin Seeding: On initial startup, the system seeds a default admin account (
admin@kyber.io/admin123). It is highly recommended to change these credentials via the Admin Dashboard immediately after deployment.
Frontend Configuration (Cyber Sentinel)
The frontend is built with Vite and TypeScript. It uses the import.meta.env object to load configurations. Create a .env file in the /frontend directory.
Required Variables
| Variable | Description | Default (Dev) |
| :--- | :--- | :--- |
| VITE_API_URL | The full URL of your running Flask backend. | http://localhost:5001 |
Example .env for Frontend
# Points to the Backend Intelligence Engine
VITE_API_URL=https://your-backend-api.onrender.com
Environment-Specific Setup
Development Environment
For local development, the frontend defaults to port 5173 and the backend defaults to port 5001.
- Ensure the
VITE_API_URLin your frontend.envmatches the local address of your Flask server. - The backend will automatically create a local
kyber.dbfile upon first run.
Production Environment
When deploying to Vercel (Frontend) and Render (Backend):
- CORS Management: Ensure your backend allowed origins include your Vercel domain.
- Secret Rotation: Generate a high-entropy string (e.g., using
openssl rand -base64 32) for theSECRET_KEY. - Model Persistence: Ensure the
/ML_masterdirectory is present or included in your Docker build, as the backend relies onacidModel.pklto process requests.
Troubleshooting Connectivity
If the frontend cannot communicate with the scanner:
- Check the API URL: Open the browser console and verify that requests are being sent to the correct
VITE_API_URL. - Token Validation: Ensure that
soteria_tokenis present inlocalStorage. The system requires a valid JWT for the/analyzeand/batchendpoints. - Network Logs: Verify that the backend is returning a
200 OKon the/api/auth/validateheartbeat check.