Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/J0S3-LEON/pf_pruebasAseguramientoCalid_SDD/llms.txt

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

This guide walks you through getting the complete MindFlow stack — PostgreSQL database, NestJS backend, and Next.js frontend — running on your local machine. By the end you will have a working instance where you can register a student account, start an EMA session, submit a fatigue score, and see the Task Decomposer in action. The whole process takes fewer than ten minutes on a machine that already meets the prerequisites.

Prerequisites

Before you begin, make sure the following tools are installed and available on your PATH:
ToolMinimum versionCheck
Node.js20.xnode --version
npm9.xnpm --version
DockerAny recent stabledocker --version
Docker ComposeV2 (bundled with Docker Desktop)docker compose version
MindFlow’s backend requires Node.js ≥ 20. Earlier versions are not supported because the codebase uses native features available only in the Node.js 20 LTS line.

Choose your path

Running with Docker Compose is the recommended path. A single command brings up PostgreSQL 18, the NestJS backend, and the Next.js frontend inside an isolated Docker network — no local database installation required.
Before building, run docker compose config to validate your Compose file and verify that all required environment variable substitutions resolve correctly. This catches missing .env values before the build starts.
1

Clone the repository

git clone https://github.com/J0S3-LEON/pf_pruebasAseguramientoCalid_SDD.git
cd pf_pruebasAseguramientoCalid_SDD
2

Configure environment variables

Copy the example file and fill in the required values:
cp .env.example .env
Open .env in your editor. The variables are split by layer:Backend variables
VariableDescription
DATABASE_URLFull PostgreSQL connection string, e.g. postgresql://user:pass@db:5432/mindflow
JWT_SECRETRandom string of at least 32 characters used to sign JWT tokens
FRONTEND_URLOrigin(s) allowed by CORS — use http://localhost:3000 locally; comma-separated for multiple
PORTPort the backend listens on inside the container — defaults to 3001
AI_SERVICE_API_KEYAPI key for the external LLM service used by the Task Decomposer
Frontend variables
VariableDescription
NEXT_PUBLIC_API_URLPublic URL of the backend including the /api/v1 prefix, e.g. http://backend:3001/api/v1
NEXT_PUBLIC_APP_URLPublic URL of the frontend, e.g. http://localhost:3000
AUTH_SECRETIndependent random secret (≥ 32 chars) used by Auth.js — must differ from JWT_SECRET
AUTH_DEBUGSet to false; only enable true during local Auth.js troubleshooting
Never commit the .env file to version control. It is already listed in .gitignore. The NEXT_PUBLIC_* variables are baked into the frontend bundle at build time — configure them before running docker compose build.
3

Build and start all services

docker compose build
docker compose up -d
Docker Compose will start three services on the internal mindflow network:
  • db — PostgreSQL 18 Alpine on port 5432 (internal only)
  • backend — NestJS API on port 3001 (internal only)
  • frontend — Next.js on port 3000 (the only service exposed externally)
You can follow logs with:
docker compose logs -f backend frontend
4

Run database migrations

Wait for the backend service to report healthy, then apply the Prisma migrations:
docker compose exec backend npm run prisma:migrate:deploy --workspace @mindflow/backend
This runs all pending versioned migrations against the PostgreSQL container. The command is idempotent — running it again on an up-to-date database is safe.
The backend container includes a startup retry loop that attempts to connect to PostgreSQL up to 5 times with a 5-second interval. If migrations fail because the database is still initialising, wait a few seconds and re-run the command.
5

Open MindFlow in your browser

Navigate to http://localhost:3000.
  1. Click Register and create a student account with a valid email and a password of at least 8 characters.
  2. Log in — you will receive a signed JWT valid for 24 hours.
  3. From the Dashboard, create an academic task with a name and deadline.
  4. Click Start EMA Session to open the EMA chatbot.
  5. Enter a fatigue score between 1 and 5. If you enter 4 or 5, watch the Task Decomposer split your task into 2–7 micro-objectives of ≤ 25 minutes each.

What’s next?

Now that MindFlow is running locally, you can explore the rest of the documentation:
  • Architecture — understand the three-tier system design, NestJS modules, and Prisma data models.
  • Introduction — dive deeper into EMA, the Task Decomposer threshold logic, and the full glossary of system components.

Build docs developers (and LLMs) love