Prerequisites
Before installing CONFOR, ensure your system meets these requirements:Required Software
- Node.js 20 or higher (Download)
- Docker and Docker Compose (recommended) or standalone PostgreSQL 15+
- Git for cloning the repository
Recommended System Requirements
- RAM: 4GB minimum, 8GB recommended
- CPU: 2 cores minimum, 4 cores recommended
- Storage: 10GB minimum (more for geospatial data)
- OS: Linux, macOS, or Windows with WSL2
Installation Methods
Choose your preferred installation method:- Docker (Recommended)
- Manual Setup
- PM2 Production
Docker provides the easiest setup with all dependencies included.
Method 1: Docker Installation (Recommended)
Install Dependencies
Install Node.js packages:
The project uses pnpm by default, but npm and yarn are also supported.
Start Docker Services
Launch PostgreSQL and Redis containers:This starts:Expected output:
- PostgreSQL 15 on port 5432
- Redis 7 on port 6379 (optional, for caching)
Configure Environment Variables
Create a Add the following configuration:
.env file in the project root:.env
Generate Prisma Client
Generate the Prisma database client:This reads
prisma/schema.prisma and generates type-safe database models.Run Database Migrations
Apply database migrations to create tables:Expected output:
The first migration includes PostGIS extension activation and table partitioning setup for audit logs.
Seed Initial Data
Load default data including admin user, roles, and modules:This creates:
- Default admin user:
- Email:
[email protected] - Password:
Admin1234
- Email:
- System roles: ADMIN, USER, VIEWER
- Module permissions: Dashboard, Users, Patrimony, etc.
- Default organization: “Por defecto”
Start Development Server
Launch the Next.js development server:The application will be available at:
Start Geo Worker (Optional)
In a separate terminal, start the geospatial processing worker:The worker processes:
- Shapefile imports - Extracting, validating, and storing geometries
- Area recalculations - Updating Level 2/3 totals from Level 4 changes
For testing, run a single cycle with:
Method 2: Manual Setup (Without Docker)
Install PostgreSQL
Install PostgreSQL 15+ with PostGIS:Ubuntu/Debian:macOS (Homebrew):Windows:
Download from PostgreSQL.org and install PostGIS via Stack Builder.
Method 3: PM2 Production Deployment
For production deployments on Windows or Linux servers:Database Schema Overview
CONFOR uses a comprehensive PostgreSQL schema with 40+ tables:Core Authentication Tables
User- User accounts with organization membershipRole- Custom roles per organizationPermission- Granular module-level permissionsSession- Active user sessionsAuditLog- Partitioned audit trail (monthly partitions)
Forest Patrimony Tables
ForestPatrimonyLevel2- Top-level properties (Finca/Predio)ForestPatrimonyLevel3- Compartments (Lote)ForestPatrimonyLevel4- Stands (Rodal)ForestPatrimonyLevel5- Plots (Subunidad)ForestBiologicalAssetLevel6- Biological assets and inventory
Geospatial Tables
ForestGeometryN4- Polygon geometries (MultiPolygon, EPSG:4326)GeoImportJob- Shapefile import job trackingGeoImportJobItem- Individual feature import statusForestGeometryRecalcJob- Area recalculation queue
Variation Tracking
LandPatrimonialVariation- Land use changes and valuationGeoLandVariationJob- Split/merge geometric operations
Environment Variables Reference
Required Variables
Optional Variables
Post-Installation Steps
Login as Admin
Navigate to
http://localhost:3000 and login:- Email:
[email protected] - Password:
Admin1234
Configure Roles and Permissions
Navigate to Roles to customize permissions for your organization.Default roles:
- ADMIN - Full system access
- USER - Standard user with read/write
- VIEWER - Read-only access
Troubleshooting
Database Connection Fails
Error:Error: P1001: Can't reach database server
Solutions:
- Verify PostgreSQL is running:
docker compose psorsystemctl status postgresql - Check DATABASE_URL format in
.env - Ensure firewall allows port 5432
- Test connection:
psql -U postgres -h localhost
PostGIS Extension Not Found
Error:ERROR: could not open extension control file
Solution:
Prisma Migration Fails
Error:Migration failed to apply
Solution:
- Reset database (development only):
- Manually apply migrations:
Port Already in Use
Error:EADDRINUSE: address already in use :::3000
Solutions:
- Kill existing process:
- Use different port:
Geo Worker Not Processing Jobs
Symptoms: Shapefile imports stuck in PENDING status Solutions:- Verify worker is running:
- Check job queue:
- Manually trigger processing:
Next Steps
Quick Start Guide
Create your first forest patrimony structure
User Management
Add team members and configure access control
Shapefile Import
Upload geospatial data for your forest stands
API Reference
Integrate CONFOR with external systems
Getting Help
For additional support:- GitHub Issues: Report bugs or request features
- Documentation: Comprehensive guides for all features
- Community: Join discussions with other CONFOR users
- Support: Contact your system administrator or vendor