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.

FutsalManager consists of two independent services: a Node.js/Express REST API and an Angular single-page application. Both run locally during development and can be deployed separately to any hosting platform. Follow the steps below to get a working local environment from scratch.
You need PostgreSQL and Redis running before starting the backend. PostgreSQL stores all application data. Redis is used for response caching and rate-limit tracking on the authentication endpoints. The backend will start without Redis, but rate limiting and caching will not function correctly.
1

Clone the repository

Clone the project to your local machine and navigate into it.
git clone https://github.com/danielsl4/TFG_DAM_2526.git
cd TFG_DAM_2526
The repository contains two top-level directories: backend/ and frontend/. Each has its own dependencies and must be installed separately.
cd backend && npm install
cd ../frontend && npm install
2

Configure backend environment variables

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

# PostgreSQL — use DATABASE_URL for a connection string, or set individual variables
DATABASE_URL=postgresql://user:password@localhost:5432/futsalmanager

# If your provider does not support DATABASE_URL, set these individually instead:
# PGHOST=localhost
# PGPORT=5432
# PGDATABASE=futsalmanager
# PGUSER=user
# PGPASSWORD=password

# JSON Web Token secret — use a long, random string
JWT_SECRET=change_this_to_a_long_random_secret

# Redis — use REDIS_URL for a connection string
REDIS_URL=redis://localhost:6379

# If your provider exposes host/port separately, you can use:
# REDIS_HOST=localhost
# REDIS_PORT=6379

# Cloudinary — required for image uploads in the admin panel
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret

# Server port (optional, defaults to 3000)
PORT=3000
Never commit your .env file. Add backend/.env to your .gitignore before making any commits.
3

Initialize the database

Run the database initialisation script from the backend/ directory. This creates all required tables and seed data.
node init_db.js
If the script completes without errors, your PostgreSQL database is ready. Re-running the script on an existing database is safe — it uses CREATE TABLE IF NOT EXISTS statements.
The admin user must be created manually. Register a regular account via the app or the POST /register endpoint, then update that user’s role to admin directly in the database: UPDATE users SET role = 'admin' WHERE username = 'your_username';
4

Start the backend

Start the Express API server from the backend/ directory.
npm start
When the server is running you will see:
Servidor modular iniciado en http://localhost:3000
The API is now available at http://localhost:3000. All routes (/login, /register, /matches, /teams, etc.) are mounted and ready.
5

Configure the frontend environment

The Angular application reads the API base URL from an environment file. Open frontend/src/environments/environment.ts and set apiUrl to point at your running backend.
// frontend/src/environments/environment.ts
export const environment = {
  production: false,
  apiUrl: 'http://localhost:3000'
};
If you deploy the backend to a remote host, update apiUrl accordingly (and update environment.prod.ts for production builds).
6

Start the frontend

Install the Angular CLI globally if you do not already have it, then serve the application.
npm install -g @angular/cli
ng serve
The application will be available at http://localhost:4200. Changes to source files are reflected automatically without restarting the server.

Verify your setup

Open http://localhost:4200 in your browser. You should see the FutsalManager home page with the match schedule. Navigate to /standings and /statistics to confirm the backend is responding correctly.

Architecture

Understand how the frontend, backend, PostgreSQL, and Redis work together.

Admin guide

Create your first season, add teams, and schedule your first match.

Build docs developers (and LLMs) love