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.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.
Prerequisites
Before you begin, make sure the following tools are installed and available on yourPATH:
| Tool | Minimum version | Check |
|---|---|---|
| Node.js | 20.x | node --version |
| npm | 9.x | npm --version |
| Docker | Any recent stable | docker --version |
| Docker Compose | V2 (bundled with Docker Desktop) | docker compose version |
Choose your path
- Docker Compose
- Bare Node.js
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.Docker Compose will start three services on the internal
Configure environment variables
Copy the example file and fill in the required values:Open
Frontend variables
.env in your editor. The variables are split by layer:Backend variables| Variable | Description |
|---|---|
DATABASE_URL | Full PostgreSQL connection string, e.g. postgresql://user:pass@db:5432/mindflow |
JWT_SECRET | Random string of at least 32 characters used to sign JWT tokens |
FRONTEND_URL | Origin(s) allowed by CORS — use http://localhost:3000 locally; comma-separated for multiple |
PORT | Port the backend listens on inside the container — defaults to 3001 |
AI_SERVICE_API_KEY | API key for the external LLM service used by the Task Decomposer |
| Variable | Description |
|---|---|
NEXT_PUBLIC_API_URL | Public URL of the backend including the /api/v1 prefix, e.g. http://backend:3001/api/v1 |
NEXT_PUBLIC_APP_URL | Public URL of the frontend, e.g. http://localhost:3000 |
AUTH_SECRET | Independent random secret (≥ 32 chars) used by Auth.js — must differ from JWT_SECRET |
AUTH_DEBUG | Set to false; only enable true during local Auth.js troubleshooting |
Build and start all services
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)
Run database migrations
Wait for the 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.
backend service to report healthy, then apply the Prisma migrations: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.
Open MindFlow in your browser
Navigate to http://localhost:3000.
- Click Register and create a student account with a valid email and a password of at least 8 characters.
- Log in — you will receive a signed JWT valid for 24 hours.
- From the Dashboard, create an academic task with a name and deadline.
- Click Start EMA Session to open the EMA chatbot.
- 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.