Environment Setup — Complete Guide
Environment Setup — Complete Guide: free step-by-step lesson with examples, common mistakes, and interview tips — part of MEAN Stack Tutorial on Toolliyo Academy.
On this page
MEAN Stack Tutorial · Lesson 3 of 100
Environment Setup
Stack → Projects
Stack · 1 — Pieces · ~6 min · MEAN — Stack Foundations
What is this?
Environment setup installs Node LTS, Angular CLI, MongoDB, Git, and configures env vars (.env) for MeanVerse local development.
Why should you care?
A reproducible dev box prevents 'works on my machine' when onboarding backend and frontend developers.
See it live — copy this example
Paste into your MeanVerse project (Angular + Express + MongoDB), then run with ng serve / node / mongosh as noted.
# MeanVerse .env (never commit secrets)
PORT=3000
MONGO_URI=mongodb://127.0.0.1:27017/meanverse
JWT_SECRET=dev-only-change-in-prod
ANGULAR_APP=http://localhost:4200
# api/src/config/env.ts
import 'dotenv/config';
export const env = {
port: Number(process.env.PORT ?? 3000),
mongoUri: process.env.MONGO_URI!,
};
What happened?
- dotenv loads variables from .env into process.env.
- TypeScript config reads them once so routes do not scatter magic strings.
Practice next
- Install Node LTS, MongoDB Community, and VS Code.
- Clone MeanVerse repo and run npm install in api/ and web/.
- Copy .env.example to .env and fill MONGO_URI.
- Add REDIS_URL to .env for a future caching lesson.
- Fail fast in config if MONGO_URI is missing.
Remember
Node + MongoDB + CLI are the MEAN dev trio. .env keeps secrets out of source code. Document versions in README for the team.
Banking dev onboarding
Ten developers join MeanVerse; setup script must match production-like vars.
Outcome: Everyone runs the same stack locally in under an hour.
Interview prep for this lesson
Practice these questions aloud after reading—each links to a full structured answer.
Sign in to ask a question or upvote helpful answers.
No questions yet — be the first to ask!