Skip to main content

Backend environment variables

The backend reads all configuration from a .env file located at back/.env. Copy the provided example file to get started:
cd back
cp .env.example .env
Then edit .env with your PostgreSQL connection details and a secure secret key.

Variable reference

HOSTDB
string
required
Hostname of your PostgreSQL server. Use localhost when running PostgreSQL on the same machine.
USERDB
string
required
PostgreSQL username that has access to the gestor database. Defaults to postgres in the example file.
PASSWORDDB
string
required
Password for the PostgreSQL user specified in USERDB.
DATABASEDB
string
required
Name of the PostgreSQL database. Must be set to gestor (or whatever name you gave when creating the database manually).
PORTDB
number
required
Port PostgreSQL is listening on. The default PostgreSQL port is 5432.
TOKEN
string
required
Secret key used to sign JWT tokens and as the pepper for Argon2 password hashing. Must be a long, random, unpredictable string in production.
Never commit your .env file to version control. The TOKEN value is used for both JWT signing and password hashing — if it is leaked, all existing password hashes and issued tokens are compromised. Rotate it immediately if exposed.

Example .env file

back/.env
USERDB=postgres
HOSTDB=localhost
DATABASEDB=gestor
PASSWORDDB=your_password_here
PORTDB=5432

TOKEN=your_long_random_secret_here

Database setup

1. Create the database

TaskFlow Pro uses a PostgreSQL database named gestor. Create it manually using pgAdmin or the psql CLI before running migrations.
CREATE DATABASE gestor;
The database name must match the value you set for DATABASEDB in your .env file. If you use a different name, update both.

2. Run migrations

Migrations create all tables and relationships. Run them from the back/ directory after your .env is configured.
cd back
npx knex migrate:latest
Knex tracks applied migrations in the knex_migrations table, so re-running this command is safe — it only applies new migrations.

3. Seed the database

The seeder (back/seeds/01_seder_inicial.js) populates the database with three users, two sample projects, five tasks with varying statuses and priorities, and three comments.
npx knex seed:run
The following accounts are created by the seeder:
NameEmailPasswordRole
Admin User[email protected]Admin123!Admin (role 3)
María García[email protected]Maria123!Project Manager (role 2)
Carlos López[email protected]Carlos123!Developer (role 1)
The seeder does not clear existing data before inserting. Running npx knex seed:run on a database that already has users will fail with a duplicate key error. If you need to re-seed, truncate the users, projects, tasks, and comments tables first.

Frontend configuration

The frontend does not use environment variables. All API requests are hardcoded to:
http://localhost:3001/api/v1
Ensure the backend server is running on port 3001 before starting the frontend dev server.

Build docs developers (and LLMs) love