The Sealearn backend is configured entirely through environment variables loaded at startup viaDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/DerBasilisk/SEA-ServicioEvaluaconAsistida/llms.txt
Use this file to discover all available pages before exploring further.
dotenv. Every service the platform depends on — MongoDB, Redis, OAuth providers, AI inference, file storage, and transactional email — is wired through the values described below. Copy the example block at the bottom of this page into a .env file at the root of the backend/ directory before running the server for the first time.
Server
The HTTP port the Express server listens on. When deploying to a managed platform (Railway, Render, Fly.io) this variable is usually injected automatically; set it explicitly only when running on a bare VM or container.
Primary origin of the React frontend, added to the CORS allow-list. During local development this is typically
http://localhost:5173 (the default Vite dev-server port). In production set it to your Vercel deployment URL, e.g. https://sealearn.vercel.app.The
www. variant of the frontend origin, also included in the CORS allow-list. Set this to the same value as CLIENT_URL if you do not use a www subdomain; leaving it empty causes the server to fall back to http://localhost:5173.The base URL of the frontend used when building OAuth callback redirect URLs after a successful login. This value is appended with a path such as
/oauth-success?token=… before the user is redirected from the API back to the browser.The publicly accessible base URL of the backend API itself (e.g.
https://api.sealearn.app). Used by the email service to construct verification and password-reset links that point back to API endpoints.Database
Full MongoDB connection string used by Mongoose. Accepts any valid MongoDB URI, including MongoDB Atlas SRV strings (
mongodb+srv://…) and local mongodb://localhost:27017/sealearn URIs. The process exits immediately if the connection cannot be established at startup.Authentication
Secret key used to sign and verify JSON Web Tokens. Tokens issued by Sealearn are valid for 7 days. Use a randomly generated string of at least 32 characters; never reuse the same value across environments.
OAuth 2.0 client ID obtained from the Google Cloud Console. Required for the Google Sign-In flow (
passport-google-oauth20). Leave unset if you are not enabling Google login.OAuth 2.0 client secret paired with
GOOGLE_CLIENT_ID. Keep this value out of source control.The absolute callback URL registered in the Google Cloud Console, e.g.
https://api.sealearn.app/api/auth/google/callback. Must exactly match one of the authorised redirect URIs configured in your OAuth application.Application ID from the Discord Developer Portal. Required for Discord OAuth (
passport-discord). Leave unset if you are not enabling Discord login.OAuth secret paired with
DISCORD_CLIENT_ID.Absolute callback URL registered in the Discord Developer Portal, e.g.
https://api.sealearn.app/api/auth/discord/callback.AI Services
The AI service uses Groq as its primary inference provider and falls back to Gemini automatically when every Groq key’s circuit breaker is open. You can set any combination of the three Groq key slots — the pool skips keys that are absent or rate-limited. However, at least one Groq key or a Gemini key must be present for AI-powered question generation and evaluation to work.
First Groq API key used to call
llama-3.3-70b-versatile. The AI service maintains an internal pool of all three key slots, rotating through them round-robin and protecting each with an independent circuit breaker that opens after 3 consecutive failures and resets after 60 seconds.Second Groq API key. Having multiple keys significantly increases the sustained request throughput before rate limits are hit.
Third Groq API key. Any key slot left empty is silently filtered out of the pool at startup — there is no requirement to populate all three.
Google Gemini API key used to call
gemini-2.0-flash. This model acts as the automatic fallback when all Groq keys are exhausted. It is also used directly for theory-slide generation and open-response evaluation in some code paths.API key for the Resend transactional email service. Used to send account-verification emails (link valid for 24 hours) and password-reset emails (link valid for 1 hour). Without this key neither of those flows will complete.
The verified sender address used in the
from field of outgoing emails, e.g. SEA <noreply@sealearn.app>. The domain must be verified inside your Resend dashboard before emails can be delivered.File Uploads
The Cloudinary cloud name found in your Cloudinary Console. Used to construct upload and delivery URLs for user-uploaded assets such as avatars and lesson media.
Cloudinary API key paired with
CLOUDINARY_CLOUD_NAME.Cloudinary API secret. Required for authenticated upload operations. Keep this out of client-side code and version control.
Real-Time / Cache
Full Redis connection URL. Accepts standard
redis:// and TLS rediss:// schemes. For managed Redis use an Upstash URL (rediss://…) or the connection string provided by your hosting platform.Example .env File
Copy this template into backend/.env and fill in your own values. Lines prefixed with # are optional features that can be enabled later.