Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Luisanchez0/modulo_Horario/llms.txt

Use this file to discover all available pages before exploring further.

Módulo Horario is configured entirely through environment variables. Each service reads its configuration at startup and will fail immediately if any required variable is missing. For local development, copy services/.env.example to services/.env and fill in the values. For production, use AWS Secrets Manager or HashiCorp Vault — never commit .env files to version control.
The root services/.env file provides shared variables (database passwords, shared secrets) that Docker Compose injects into each service. Service-level .env.example files show the full variable set for each individual service.

Shared variables (root .env)

These variables are defined once in services/.env and referenced by docker-compose.yml across multiple services.
VariableRequiredDescription
MYSQL_ROOT_PASSWORDYesRoot password for the MySQL container. Used by usuarios-service and aulas-service.
MYSQL_DATABASEYesDefault MySQL database name. Set to docentes_db.
POSTGRES_USERYesPostgreSQL username. Used by horario-service and materias-service.
POSTGRES_PASSWORDYesPostgreSQL password.
POSTGRES_DBYesDefault PostgreSQL database name. Set to postgres.
JWT_SECRETYesSecret key for signing and verifying JWT tokens. Generate with openssl rand -hex 32.
ADMIN_CREATION_KEYYesKey required in the X-Admin-Key header to create admin accounts. Generate with openssl rand -hex 16.
INTERNAL_API_KEYYesShared key used for authenticated inter-service HTTP calls. Generate with openssl rand -hex 16.
CORS_ALLOW_ORIGINSYesComma-separated list of allowed CORS origins. Restrict to actual domains in production.

Service variables

usuarios-service manages user accounts, authentication, and JWT issuance. It connects to MySQL.
VariableTypeRequiredDefaultDescription
APP_PORTintegerNo8001Port the service binds to.
DATABASE_URLstringYesMySQL connection string. Format: mysql+pymysql://user:password@host:port/database
JWT_SECRETstringYesSecret key for HS256 JWT signing. Must match across any service that verifies tokens.
ADMIN_CREATION_KEYstringYesKey checked by POST /auth/register-admin via the X-Admin-Key header.
INTERNAL_API_KEYstringYesKey used to authenticate incoming requests from other services.
CORS_ALLOW_ORIGINSstringYesComma-separated list of origins permitted by the CORS middleware.
Example (usuarios-service/.env.example):
APP_PORT=8001
DATABASE_URL=mysql+pymysql://usuario:password@localhost:3307/docentes_db
JWT_SECRET=cambia_esta_clave
ADMIN_CREATION_KEY=clave_admin_segura
INTERNAL_API_KEY=horarios-internal-key
CORS_ALLOW_ORIGINS=http://localhost:5173,http://localhost:8001,http://localhost:8002,http://localhost:8003,http://localhost:8004
Docker Compose injection:
usuarios-service:
  environment:
    DATABASE_URL: mysql+pymysql://root:${MYSQL_ROOT_PASSWORD}@mysql/docentes_db
    JWT_SECRET: ${JWT_SECRET}
    ADMIN_CREATION_KEY: ${ADMIN_CREATION_KEY}
    INTERNAL_API_KEY: ${INTERNAL_API_KEY}
    CORS_ALLOW_ORIGINS: ${CORS_ALLOW_ORIGINS}
    APP_PORT: 8001
horario-service manages academic schedules and depends on all three other services for docente, materia, and aula data. It connects to PostgreSQL.
VariableTypeRequiredDefaultDescription
APP_PORTintegerNo8004Port the service binds to.
APP_NAMEstringNoHorario ServiceApplication name shown in logs and error responses.
DATABASE_URLstringYesPostgreSQL connection string. Format: postgresql://user:password@host:port/database
USUARIOS_SERVICE_URLstringYesBase URL of usuarios-service for docente lookups and token verification.
MATERIAS_SERVICE_URLstringYesBase URL of materias-service for subject lookups.
AULAS_SERVICE_URLstringYesBase URL of aulas-service for classroom lookups.
INTERNAL_API_KEYstringYesKey sent in outgoing inter-service requests. Must match the key expected by other services.
UPSTREAM_TIMEOUT_SECONDSintegerNo5Timeout in seconds for HTTP calls to upstream services.
CORS_ALLOW_ORIGINSstringYesComma-separated list of allowed CORS origins.
Example (horario-service/.env.example):
APP_PORT=8004
DATABASE_URL=postgresql://usuario:password@localhost:5433/horarios_db
APP_NAME="Horario Service"
USUARIOS_SERVICE_URL=http://localhost:8001
MATERIAS_SERVICE_URL=http://localhost:8002
AULAS_SERVICE_URL=http://localhost:8003
INTERNAL_API_KEY=horarios-internal-key
UPSTREAM_TIMEOUT_SECONDS=5
CORS_ALLOW_ORIGINS=http://localhost:5173,http://localhost:8001,http://localhost:8002,http://localhost:8003,http://localhost:8004
Docker Compose injection:
horario-service:
  environment:
    DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/horarios_db
    APP_NAME: Horario Service
    APP_PORT: 8004
    USUARIOS_SERVICE_URL: http://usuarios-service:8001
    MATERIAS_SERVICE_URL: http://materias-service:8002
    AULAS_SERVICE_URL: http://aulas-service:8003
    INTERNAL_API_KEY: ${INTERNAL_API_KEY}
    CORS_ALLOW_ORIGINS: ${CORS_ALLOW_ORIGINS}
    UPSTREAM_TIMEOUT_SECONDS: 5
materias-service manages academic subjects. It connects to PostgreSQL and delegates authentication to usuarios-service.
VariableTypeRequiredDefaultDescription
APP_PORTintegerNo8002Port the service binds to.
DATABASE_URLstringYesPostgreSQL async connection string. Format: postgresql+asyncpg://user:password@host:port/database
USUARIOS_SERVICE_URLstringYesBase URL of usuarios-service used to validate tokens on protected routes.
UPSTREAM_TIMEOUT_SECONDSintegerNo5Timeout in seconds for calls to usuarios-service.
CORS_ALLOW_ORIGINSstringYesComma-separated list of allowed CORS origins.
Docker Compose injection:
materias-service:
  environment:
    DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/materias_db
    USUARIOS_SERVICE_URL: http://usuarios-service:8001
    UPSTREAM_TIMEOUT_SECONDS: 5
    CORS_ALLOW_ORIGINS: ${CORS_ALLOW_ORIGINS}
    APP_PORT: 8002
aulas-service manages classrooms. It connects to MySQL and delegates authentication to usuarios-service.
VariableTypeRequiredDefaultDescription
APP_PORTintegerNo8003Port the service binds to.
DATABASE_URLstringYesMySQL connection string. Format: mysql+pymysql://user:password@host:port/database
USUARIOS_SERVICE_URLstringYesBase URL of usuarios-service for authentication delegation.
UPSTREAM_TIMEOUT_SECONDSintegerNo5Timeout in seconds for calls to usuarios-service.
CORS_ALLOW_ORIGINSstringYesComma-separated list of allowed CORS origins.
Docker Compose injection:
aulas-service:
  environment:
    DATABASE_URL: mysql+pymysql://root:${MYSQL_ROOT_PASSWORD}@mysql/aulas_db
    USUARIOS_SERVICE_URL: http://usuarios-service:8001
    UPSTREAM_TIMEOUT_SECONDS: 5
    CORS_ALLOW_ORIGINS: ${CORS_ALLOW_ORIGINS}
    APP_PORT: 8003

Production values

VariableHow to generate
JWT_SECRETopenssl rand -hex 32
ADMIN_CREATION_KEYopenssl rand -hex 16
INTERNAL_API_KEYopenssl rand -hex 16
MYSQL_ROOT_PASSWORDUse a password manager or openssl rand -base64 24
POSTGRES_PASSWORDUse a password manager or openssl rand -base64 24
Never set CORS_ALLOW_ORIGINS=* in production. Always specify the exact domains your frontend is served from. Wildcard CORS disables the same-origin protection for all browsers.

Build docs developers (and LLMs) love