This guide walks you through cloning the repository, configuring your environment, starting a local PostgreSQL database via Docker Compose, and sending your firstDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Distribuidos-Org/ms-alumnos/llms.txt
Use this file to discover all available pages before exploring further.
create_alumno message over NATS — all in about five minutes. By the end you will have a fully running instance of ms-alumnos ready to accept requests from any NATS publisher.
Prerequisites
Make sure the following are available on your machine before you begin:Leave this terminal open (or run with
- Node.js 18 or later — nodejs.org
- Yarn — installed in the next step if missing
- Docker — docs.docker.com/get-docker
- A running NATS server — nats.io
-d to detach). ms-alumnos will connect to nats://localhost:4222 when NATS_SERVERS is set to that address.Clone and install dependencies
Clone the repository and install all Node.js dependencies:Yarn will resolve and cache all packages declared in
package.json, including NestJS, TypeORM, the NATS client, bcrypt, and Joi.Configure environment variables
Copy the example environment file and open it in your editor:The default values work for a standard local setup. The full contents of Key variables to review:
If you are only running a single NATS server, you can simplify
.env.example are:| Variable | Default | Notes |
|---|---|---|
PORT | 3002 | Validated at startup by envs.ts but not used to open an HTTP port — the service is NATS-only. |
NATS_SERVERS | nats://localhost:4222,nats://localhost:4223 | Comma-separated list of NATS server URLs. |
DB_HOST | localhost | Must match where your Docker container is reachable. |
DB_PORT | 5435 | Mapped host port for the PostgreSQL container (container internally uses 5432). |
NATS_SERVERS to just nats://localhost:4222.Start PostgreSQL with Docker Compose
The included Docker will pull the You should see the
docker-compose.yml defines a postgres:15 service that reads its credentials and port directly from your .env file:postgres:15 image (first run only), create a named volume db_data for persistence, and expose the database on the host port defined by DB_PORT (default 5435). Verify the container is running:db service listed with a running status.Start the microservice
Launch On successful startup, NestJS logs the NATS servers the service connected to:The service is now listening for NATS message patterns. No HTTP port is opened — all traffic is NATS-only.
ms-alumnos in watch mode so it reloads on code changes:Send your first message
Use the Run it with Node.js:A successful response will print the newly created student record returned by the service (with the password field omitted or hashed, depending on your response DTO).
nats npm package to publish a create_alumno request and inspect the response. Create a temporary file (e.g. test-create.mjs) with the following content: