Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/vanegasjoseignacio2-cyber/Eco-It/llms.txt

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

This guide walks you through everything you need to get a fully functional Eco-It development environment running on your local machine. By the end you will have the Express backend listening on port 3000, the Vite dev server on port 5173, a live connection to MongoDB, and all third-party integrations (Cloudinary, OpenRouter, Google OAuth) ready to use.
1

Prerequisites

Make sure the following tools are installed and available on your PATH before proceeding:
RequirementMinimum versionNotes
Node.js18.xLTS recommended; required by both workspaces
pnpm10.xThe repo is pinned to pnpm — do not use npm or yarn
MongoDB6.xLocal instance or a free MongoDB Atlas cluster
Cloudinary accountFree tier is sufficient for development
OpenRouter API keyRegister at openrouter.ai to access Gemini models
Google OAuth credentialsCreate a project in Google Cloud Console and enable the OAuth 2.0 API
Verify your versions before continuing:
node -v    # should print v18.x.x or higher
pnpm -v    # should print 10.x.x or higher
2

Clone the Repository

Clone the Eco-It monorepo from GitHub and move into the project root:
git clone https://github.com/vanegasjoseignacio2-cyber/Eco-It.git
cd Eco-It
The repository root contains two workspace packages (backend/ and frontend/) alongside the root package.json and pnpm-workspace.yaml that ties them together.
3

Install Dependencies

Run a single install command from the repository root. pnpm resolves dependencies for both the backend and frontend workspaces in one pass:
pnpm install
This also installs the root-level concurrently package that powers the unified pnpm dev script. You do not need to cd into each workspace separately.
4

Configure Environment Variables

Eco-It requires two .env files — one for the backend and one for the frontend.Backend — backend/.envCreate the file and populate every variable shown below:
# ── Database ────────────────────────────────────────────────────────────
MONGODB_URI=mongodb://localhost:27017/eco-it
# For MongoDB Atlas: mongodb+srv://<user>:<password>@cluster.mongodb.net/eco-it

# ── Auth ─────────────────────────────────────────────────────────────────
JWT_SECRET=replace_with_a_long_random_string_at_least_64_characters

# ── Google OAuth 2.0 ─────────────────────────────────────────────────────
GOOGLE_CLIENT_ID=your_google_client_id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your_google_client_secret

# ── AI (OpenRouter / Google Gemini) ──────────────────────────────────────
OPENROUTER_API_KEY=sk-or-v1-your_openrouter_api_key

# ── Cloudinary ───────────────────────────────────────────────────────────
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret

# ── CORS / Frontend origin ───────────────────────────────────────────────
FRONT_URL=http://localhost:5173

# ── Server ───────────────────────────────────────────────────────────────
PORT=3000
JWT_SECRET must be a long, cryptographically random string (64+ characters recommended). This secret signs and verifies every authentication token in the platform — a weak or guessable value leaves all user sessions vulnerable. Generate one with openssl rand -hex 64 and never commit it to version control.
Frontend — frontend/.envThe Vite app only needs a single variable that points to the backend:
VITE_BACKEND_URL=http://localhost:3000
In development you rarely need VITE_BACKEND_URL directly, because the Vite dev server is configured to proxy every request that starts with /api to http://localhost:3000. This means all fetch('/api/...') calls in the React app are silently forwarded to Express without CORS issues. See the Architecture page for details on the proxy configuration.
5

Run in Development

Start both the backend and frontend with a single command from the repository root:
pnpm dev
Under the hood this runs concurrently "pnpm dev:backend" "pnpm dev:frontend", which maps to:You should see console output similar to:
✅ Conectado a MongoDB
Servidor corriendo en http://localhost:3000
Socket.io activo

  VITE v8.x.x  ready in xxx ms
  ➜  Local:   http://localhost:5173/
Open http://localhost:5173 in your browser to access the Eco-It frontend.
6

Build for Production

To generate an optimized production bundle of the React frontend, run from the repository root:
pnpm build
This executes vite build inside the frontend/ workspace and outputs static assets to frontend/dist/. The directory is ready to be deployed to any static hosting provider (Netlify, Vercel, S3, etc.).For the backend, start it in production mode with:
pnpm --filter backend start
This runs node index.js (without nodemon) and reads the environment variables from backend/.env or from your hosting provider’s secrets manager.

Build docs developers (and LLMs) love