Installation & Setup Guide
Relevant source files
The following files were used as context for generating this wiki page:
This guide provides comprehensive instructions for setting up the ElmecV2 Request Management System. It covers local environment preparation, backend configuration using Supabase, and web deployment via Netlify.
The installation process ensures that all architectural components—including the React Native/Expo frontend, the PostgreSQL database with Row Level Security (RLS), and real-time communication services—are correctly integrated.
Prerequisites
Before beginning the installation, ensure the following software is installed on your local machine:
- Node.js: Version 18 or superior.
- Package Manager: npm or yarn.
- Expo CLI: Installed globally via
npm install -g @expo/cli. - Git: For version control and cloning.
- Mobile Development: Expo Go app (physical device) or an Android/iOS emulator.
Sources: README.md:57-67
Local Development Setup
1. Repository Initialization
Clone the repository and install the necessary dependencies.
git clone https://github.com/RogerDevAndroid/elmecV2-Demo.git
cd elmecV2-Demo
npm install
Sources: README.md:71-78
2. Environment Variables
Create a .env file in the root directory based on the .env.example template. This file stores configuration keys for Supabase and the Expo project environment.
# Supabase Configuration
EXPO_PUBLIC_SUPABASE_URL=your_supabase_url
EXPO_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
# Environment
EXPO_PUBLIC_ENVIRONMENT=development
# Expo
EAS_PROJECT_ID=your_eas_project_id
Sources: README.md:80-97, supabase/setup-instructions.md:21-27
Backend Configuration (Supabase)
Supabase serves as the Backend as a Service (BaaS), providing the database, authentication, and storage layers.
Database Initialization
The database schema must be initialized by executing SQL migrations located in /supabase/migrations/. These should be run in the following sequence:
| Order | Migration File | Description |
|---|---|---|
| 1 | 001_create_users_table.sql | Core user profiles and roles |
| 2 | 002_create_requests_table.sql | Request management schema |
| 3 | 003_create_chat_system.sql | Chat rooms and messaging |
| 4 | 004_create_notifications_system.sql | Real-time notification logs |
| 5 | 005_create_calculator_data.sql | Engineering tool data |
| 6 | 006_create_analytics_and_logs.sql | Performance and audit logging |
Sources: supabase/setup-instructions.md:32-41, scripts/setup-supabase-complete.js:106-121
Automated Setup Script
Alternatively, developers can use the provided automation script to verify connections, run migrations, and create demo users using the Supabase Service Role Key.
# Set SUPABASE_SERVICE_ROLE_KEY in .env.local first
npm run setup-supabase
Sources: scripts/setup-supabase-complete.js:14-25, STATUS-DEPLOY.md:35
Authentication Setup
In the Supabase Dashboard under Authentication -> Settings, ensure "Email confirmation" is disabled for demo environments.
The following demo accounts are typically created for testing:
- Admin:
i.pineda@elmec.com.mx/Elmec2024!Admin - Agent:
j.gonzalez@elmec.com.mx/Elmec2024!Agent - Customer:
cliente@gmail.com/Elmec2024!Client
Sources: supabase/setup-instructions.md:63-88, DEPLOY-NETLIFY.md:121-137
Deployment (Netlify)
The application is deployed as a web platform using Netlify, utilizing a CI/CD pipeline connected to the GitHub repository.
Build and Deployment Flow
The following diagram illustrates the deployment lifecycle from local commit to the live Netlify site.
The build process targets the netifly branch and outputs the production-ready assets into the dist directory.
Sources: DEPLOY-NETLIFY.md:33-40, NETLIFY-DASHBOARD-SETUP.md:32-37
Required Environment Variables in Netlify
To connect the deployed site to the backend, the following variables must be configured in Site settings > Environment variables:
| Variable Key | Value Example | Scope |
|---|---|---|
EXPO_PUBLIC_SUPABASE_URL | https://pdpqkgrqlubyzkcivifk.supabase.co | Production |
EXPO_PUBLIC_SUPABASE_ANON_KEY | eyJhbGciOiJIUzI1Ni... | Production |
EXPO_PUBLIC_ENVIRONMENT | production | Production |
NODE_ENV | production | Production |
EXPO_PUBLIC_EAS_PROJECT_ID | elmec-mobile-app-demo | Production |
Sources: DEPLOY-NETLIFY.md:58-85, NETLIFY-DASHBOARD-SETUP.md:53-85
Execution Commands
Once the environment is configured, the application can be launched using the following scripts defined in package.json.
Development Commands
# Start development server
npm start
# Run specifically on platforms
npm run android
npm run ios
npm run web
Sources: README.md:104-118
Production & Deployment Commands
# Local production build
npm run build:production
# Deploy to Netlify via CLI
npm run deploy
# Preview the deployment before going live
npm run deploy:preview
Sources: README.md:123-132, STATUS-DEPLOY.md:38-40
Final Verification Checklist
After setup, verify the installation through the following steps:
- Site Accessibility: Ensure the Netlify URL loads the login screen.
- Authentication: Attempt login with an Admin or Agent demo account.
- Real-time Data: Verify that the Dashboard loads data from Supabase successfully.
- Supabase Redirects: Ensure the Netlify site URL is added to Supabase Authentication > URL Configuration to allow successful OAuth and callback redirects.
Sources: DEPLOY-NETLIFY.md:111-140, NETLIFY-DASHBOARD-SETUP.md:131-140
The installation is considered complete when the frontend successfully communicates with the Supabase backend services, as confirmed by successful user authentication and data retrieval.