Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Danielsl4/TFG_DAM_2526/llms.txt

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

This guide walks you through setting up a complete local instance of FutsalLeague Manager — backend API, Angular frontend, PostgreSQL database, and Redis cache — so you can start managing seasons and matches right away.
Redis is required before starting the backend. The API uses Redis (via ioredis) for caching match data and standings, and for enforcing rate limits on authentication endpoints. The server will log a connection warning and some features will degrade if Redis is unavailable.
1

Clone the repository and install dependencies

Clone the monorepo and install packages for both the backend and the Angular frontend independently.
git clone https://github.com/Danielsl4/TFG_DAM_2526.git
cd TFG_DAM_2526
Install backend dependencies:
cd backend
npm install
Install frontend dependencies:
cd ../frontend
npm install
2

Configure environment variables

Create a .env file in the backend/ directory. The API reads all configuration from environment variables using dotenv.
# backend/.env

# Server
PORT=3000

# PostgreSQL — use a full connection string
DATABASE_URL=postgresql://DB_USER:DB_PASSWORD@DB_HOST:DB_PORT/DB_NAME

# JWT signing secret — use a long, random string in production
JWT_SECRET=your_jwt_secret_here

# Redis connection string
REDIS_URL=redis://localhost:6379

# Cloudinary (for team and player image uploads)
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret

# Nodemailer (for email verification and password reset)
EMAIL_USER=[email protected]
EMAIL_PASS=your_email_password

# CORS — set to the Angular dev server origin
FRONTEND_URL=http://localhost:4200
Never commit your .env file to version control. Add it to .gitignore before your first commit.
3

Initialize the database

Run the initialization script from the backend/ directory. It creates all required PostgreSQL enums and tables in the correct dependency order, using IF NOT EXISTS guards so it is safe to re-run.
cd backend
node init_db.js
The script creates the following enums and tables:Enums: match_phase, match_status, event_type, role, vote_typeTables (15 total): seasons, groups, teams, players, team_players, fields, matches, match_events, users, user_points, team_followers, team_stats, player_stats, match_votes, audit_logsA successful run prints:
Starting table creation...
All tables have been created successfully.
4

Start the backend

Start the Express API server from the backend/ directory.
cd backend
npm start
The server starts on http://localhost:3000 by default (override with the PORT env var). On startup it registers all route modules and initializes the cron job scheduler.
Servidor modular iniciado en http://localhost:3000
The following route prefixes are available once the server is running:
PrefixPurpose
/login, /registerAuthentication
/usersUser management
/matchesMatch management and referee tools
/teamsTeam detail and follower tracking
/playersPlayer profiles
/standingsLeague standings
/statisticsGlobal statistics
/adminAdmin panel API
/seasonsSeason management
/groupsGroup management
/fieldsField management
5

Start the frontend

In a separate terminal, start the Angular development server from the frontend/ directory.
cd frontend
ng serve
The app is served at http://localhost:4200. The Angular CLI watches for file changes and hot-reloads automatically. Make sure FRONTEND_URL in your .env matches this origin so the backend CORS headers allow requests from the browser.
6

Create the first admin account

On a fresh database there are no users. Navigate to http://localhost:4200/register to create the first account.After registering, promote the account to admin role directly in the database:
UPDATE users SET role = 'admin', is_verified = TRUE
WHERE email = '[email protected]';
Log in and navigate to http://localhost:4200/admin. The admin panel gives you full access to create your first season, add groups, register teams and players, configure fields, and schedule matches.
Setting is_verified = TRUE in the same statement lets you skip email verification during local development when you haven’t configured a mail provider yet.

Build docs developers (and LLMs) love