Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Zapiony/PUCE_UZDI_2026/llms.txt

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

Both applications in the UZDI monorepo are configured through environment variable files that are never committed to version control. The backend reads its variables via @nestjs/config (which wraps dotenv), and the frontend reads its variables through Vite’s built-in import.meta.env mechanism. This page documents every variable, its purpose, and the exact format expected.

Backend Environment Variables (UZDI_BACK/.env)

Create a file named .env inside the UZDI_BACK directory. This file is loaded automatically by ConfigModule.forRoot({ isGlobal: true }) registered in AppModule.
VariableRequiredDefaultDescription
DATABASE_URL✅ YesFull PostgreSQL connection string used by TypeORM
PORT❌ No3000TCP port the NestJS HTTP server listens on

Example UZDI_BACK/.env

DATABASE_URL=postgresql://postgres:yourpassword@localhost:5432/uzdi_db
PORT=3000
The DATABASE_URL format follows the standard libpq URI scheme:
postgresql://<user>:<password>@<host>:<port>/<database>
PORT is consumed in main.ts as process.env.PORT ?? 3000:
await app.listen(process.env.PORT ?? 3000);

Frontend Environment Variables (UZDI_FRONT/.env or .env.local)

Create a file named .env or .env.local inside the UZDI_FRONT directory. Vite processes this file at build/serve time and inlines matching variables into the client bundle.
Vite only exposes variables whose names begin with VITE_ to browser code via import.meta.env. Variables without the VITE_ prefix are intentionally kept server-side and will be undefined in client code.
VariableRequiredDescription
VITE_API_BASE_URL✅ YesBase URL of the NestJS backend, without a trailing slash

Example UZDI_FRONT/.env

VITE_API_BASE_URL=http://localhost:3000
This variable is consumed in src/services/api.ts to construct the axios instance base URL:
const api = axios.create({
  baseURL: `${import.meta.env.VITE_API_BASE_URL}/api/v1`,
  headers: { 'Content-Type': 'application/json' },
})
All API calls are therefore prefixed with /api/v1, matching the global prefix set by app.setGlobalPrefix('api/v1') in the NestJS bootstrap.

CORS Configuration

The NestJS backend hardcodes the allowed CORS origin to http://localhost:5174 for development. This is the port configured in UZDI_FRONT/vite.config.ts:
// vite.config.ts
export default defineConfig({
  plugins: [vue()],
  server: {
    port: 5174,
  },
})
The corresponding CORS setup in UZDI_BACK/src/main.ts:
app.enableCors({
  origin: 'http://localhost:5174',
  methods: ['GET', 'POST', 'PATCH', 'PUT', 'DELETE', 'OPTIONS'],
  allowedHeaders: ['Content-Type', 'Authorization'],
  credentials: true,
});
If you change the Vite dev port, you must update the origin value in main.ts to match.

Production Deployment Notes

Before deploying to a production or staging environment, the following changes are required:

Update CORS Origin

Change the origin in main.ts from http://localhost:5174 to the deployed frontend domain, for example https://uzdi.puce.edu.ec. Consider reading this value from an environment variable like FRONTEND_URL for flexibility.

Secure DATABASE_URL

Use production PostgreSQL credentials in DATABASE_URL. Prefer a secrets manager or platform-specific secrets injection (e.g., Railway, Heroku Config Vars, AWS Secrets Manager) over a plain .env file on the server.

JWT Secret Variable

The current authentication flow uses a mock token string. When a proper JWT library (e.g., @nestjs/jwt) is introduced, its signing secret must also be provided as an environment variable — never hardcoded.

Set VITE_API_BASE_URL for Build

When building the frontend for production (npm run build), ensure VITE_API_BASE_URL points to the production API domain, e.g., https://api.uzdi.puce.edu.ec. Vite inlines this value at build time.

Security: Protecting .env Files

Never commit .env files. Both UZDI_BACK and UZDI_FRONT should have .env and .env.local listed in their respective .gitignore files. Committing database credentials or secrets to version control exposes them permanently in Git history, even if the file is later deleted.
The recommended approach is to keep a .env.example file in each project directory with placeholder values (no real credentials) committed to the repository, so new developers know exactly which variables to set:
# UZDI_BACK/.env.example
DATABASE_URL=postgresql://user:password@localhost:5432/uzdi_db
PORT=3000
# UZDI_FRONT/.env.example
VITE_API_BASE_URL=http://localhost:3000

Build docs developers (and LLMs) love