Prerequisites
Before installing Alternativa Verde, ensure you have the following installed on your system:- Node.js (v18 or higher recommended)
- pnpm package manager
- PostgreSQL database (v12 or higher)
If you don’t have pnpm installed, you can install it globally with:
npm install -g pnpmInstallation Steps
Install Dependencies
Clone or download the Alternativa Verde application, navigate to the project directory, and install all required dependencies:This will install all necessary packages including:
- React for the user interface
- Express for the API server
- PostgreSQL client for database connectivity
- Additional utilities for charting and data export
Create PostgreSQL Database
Connect to your PostgreSQL instance and create the database:Or using psql:
Configure Environment Variables
Create a Edit the
.env file in the project root by copying the example file:.env file with your database connection details:Load Database Schema
Load the consolidated database schema which includes all tables, indexes, and extensions:This creates the following tables:
collection_centers- Collection center locationscollection_center_members- Team members and rolesgenerators- Material generators (clients)vehicles- Collection center vehiclestickets- Material entry recordsdispatches- Material exit recordsapp_configuration- Application settings
The schema automatically installs the
pg_trgm extension for efficient text searching.Start the Application
Start both the frontend application and the API server:This command runs:
- Frontend: React application (typically on port 5173)
- API Server: Express backend (typically on port 3000)
Database Structure Overview
The Alternativa Verde database uses PostgreSQL with the following key tables:| Table | Purpose |
|---|---|
collection_centers | Stores collection center information (name, location, active status) |
collection_center_members | Team members with roles (collectors, administrators) |
generators | Material generators (clients) with collection modes |
vehicles | Collection center vehicles for material transport |
tickets | Entry tickets for incoming materials |
dispatches | Exit records for dispatched materials |
app_configuration | Active collection center setting |
Next Steps
Now that you have Alternativa Verde installed, proceed to the Quick Start guide to configure your first collection center and create your first ticket:Quick Start Guide
Get operational in minutes by setting up your collection center and creating your first ticket
Troubleshooting
Connection refused to PostgreSQL
Connection refused to PostgreSQL
Make sure PostgreSQL is running and the connection details in your
.env file are correct. Test the connection with:Port already in use
Port already in use
If the default ports are already in use, you can modify the port configuration in the Vite and Express configuration files.
pnpm command not found
pnpm command not found
Install pnpm globally: