Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Manuelfg1985/Proyecto_Final_26/llms.txt

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

This guide walks you through everything needed to get the Agencia de Habilidades para el Futuro API running on your machine and start interacting with applicant data. By the end you will have cloned the repository, configured your Firebase and JWT environment variables, started the local server, obtained an admin token by logging in, listed existing applicants from the public endpoint, and created a new applicant record using an authenticated request.
1

Clone the repository and install dependencies

Clone the project from GitHub and install its Node.js dependencies with npm install.
git clone https://github.com/Manuelfg1985/Proyecto_Final_26.git
cd Proyecto_Final_26
The install step pulls in Express 5, the Firebase SDK, jsonwebtoken, bcryptjs, cors, and dotenv — everything listed in package.json.
2

Configure your environment variables

Copy the provided example file to create your own .env:
cp ".env example" .env
Open .env in your editor and fill in every variable. The full list of required values is:
VariableDescription
PORTHTTP port the server listens on (default 3000)
APY_KEYFirebase project API key
AUTH_DOMAINFirebase auth domain (e.g. your-project.firebaseapp.com)
PROJECT_IDFirebase project ID
STORAGE_BUCKETFirebase storage bucket (e.g. your-project.appspot.com)
MESSAGING_SENDER_IDFirebase messaging sender ID
APP_IDFirebase App ID
JWT_SECRETSecret key used to sign and verify JWT tokens
ADMIN_EMAILEmail address of the admin user
ADMIN_PASSWORDPassword for the admin user
All Firebase values come from your Firebase project’s Project Settings → General → Your apps panel. See the Configuration page for a step-by-step guide.
3

Start the development server

Launch the API with the start script defined in package.json:
npm start
You should see the server URL printed to your terminal:
http://localhost:3000
The server listens on PORT from your .env, falling back to 3000 if the variable is not set.
4

Confirm the server is running

Hit the health-check endpoint to verify the process started correctly:
curl http://localhost:3000/up
Expected response:
{
  "status": "ok",
  "message": "Servidor activo"
}
Any other response (connection refused, 404, etc.) indicates a configuration problem — double-check that the server process is still running and that you are using the correct port.
5

Log in and retrieve a JWT token

Authenticate as the admin user to get a signed JWT. Replace the email and password with the values you set in ADMIN_EMAIL and ADMIN_PASSWORD in your .env.
curl -X POST http://localhost:3000/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"[email protected]","password":"MiPassword123"}'
Expected response:
{
  "message": "Login exitoso",
  "token": "<JWT>"
}
Copy the token value — you will include it in the Authorization header for all write operations. Tokens expire after 1 hour; simply call /api/auth/login again to get a fresh one.If the credentials are incorrect the API returns 401 Credenciales inválidas. Make sure your .env values match exactly what you are sending in the request body.
6

List all applicants (public)

The list endpoint is public — no token needed. Fetch all applicant records currently stored in Firestore:
curl http://localhost:3000/api/postulantes
Example response:
[
  {
    "id": "abc123FirestoreDocId",
    "name": "María",
    "surname": "González",
    "email": "[email protected]",
    "birthdate": "1990-05-14",
    "telephone": "+54 11 1234-5678",
    "city": "Buenos Aires",
    "province": "Buenos Aires",
    "applied_position": "Diseñadora UX",
    "application_date": "2024-07-01T10:00:00.000Z",
    "status": "pending"
  }
]
An empty Firestore collection returns []. The id field is the Firestore document ID and is used by the single-record endpoints (GET /api/postulantes/:id, PUT /api/postulantes/:id, DELETE /api/postulantes/:id).
7

Create a new applicant (authenticated)

Creating an applicant requires the JWT you obtained in step 5. Pass it in the Authorization header as a Bearer token:
curl -X POST http://localhost:3000/api/postulantes \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <token>" \
  -d '{
    "name": "Carlos",
    "surname": "Ramírez",
    "email": "[email protected]",
    "birthdate": "1995-03-22",
    "telephone": "+54 351 9876-5432",
    "city": "Córdoba",
    "province": "Córdoba",
    "applied_position": "Desarrollador Backend"
  }'
Expected response:
{
  "message": "User created successfully",
  "data": {
    "name": "Carlos",
    "surname": "Ramírez",
    "email": "[email protected]",
    "birthdate": "1995-03-22",
    "telephone": "+54 351 9876-5432",
    "city": "Córdoba",
    "province": "Córdoba",
    "applied_position": "Desarrollador Backend",
    "application_date": "2024-07-02T14:30:00.000Z",
    "status": "pending"
  }
}
The application_date is set automatically to the current date and time, and status defaults to "pending" — you do not need to include either field in the request body unless you want to override the defaults.
See the Create Applicant reference page for the complete field list, data types, which fields are required, and all possible error responses.

Build docs developers (and LLMs) love