Build & Deployment Guide
Prerequisites
Before beginning the build process, ensure your environment meets the following requirements:
- Node.js: Version 18.0 or higher.
- Package Manager:
npm(included with Node) oryarn. - Supabase Account: A project created on Supabase to handle authentication and data storage.
Environment Configuration
TEIRAC requires specific environment variables to communicate with the Supabase backend. Create a .env file in the root directory of the project:
# .env
VITE_SUPABASE_URL=https://your-project-id.supabase.co
VITE_SUPABASE_ANON_KEY=your-anon-public-key
- VITE_SUPABASE_URL: Found in your Supabase Project Settings > API.
- VITE_SUPABASE_ANON_KEY: Found in your Supabase Project Settings > API (the
anonpublic key).
Local Development
To run the application locally for testing or development purposes:
-
Install dependencies:
npm install -
Start the development server:
npm run devThe application will be available at
http://localhost:5173. This environment supports Hot Module Replacement (HMR) for real-time updates.
Production Build
The production build optimizes the TypeScript code, minifies assets, and generates a performant Single-Page Application (SPA).
-
Generate the build:
npm run build -
Output: The command generates a
dist/directory containing the production-ready HTML, CSS, and JavaScript files. -
Preview (Optional): To test the production build locally before deploying, use:
npm run preview
Deployment
Since TEIRAC is a static Vite application, the contents of the dist folder can be hosted on any static site provider.
Vercel / Netlify / Cloudflare Pages
- Connect your GitHub repository to the platform.
- Set the Build Command to
npm run build. - Set the Output Directory to
dist. - Add your Environment Variables (
VITE_SUPABASE_URL,VITE_SUPABASE_ANON_KEY) in the platform's dashboard.
Manual Deployment (Static Hosting)
Upload the contents of the dist folder to your server. Ensure that your server is configured to redirect all requests to index.html to support client-side routing (React Router).
Supabase Database Setup
For the application to function correctly after deployment, your Supabase instance must have the following tables initialized:
| Table Name | Description |
| :--- | :--- |
| profiles | Stores user meta-data (full_name, role, department). |
| projects | Core project data (SPI, budget, status). |
| project_tasks | Task-specific data for project breakdowns. |
| project_risks | Risk tracking and mitigation logs. |
Database Schema Requirements
The application utilizes various modules (Budget, Estimates, RACI, etc.). Ensure your database schema supports the columns defined in the ImportModal.tsx mapping. For example, the project_tasks table should include:
wbs_code,task,owner,start_date,end_date, andstatus.
Authentication Settings
- Enable Email Auth in the Supabase Dashboard.
- Configure the Site URL in Supabase (Authentication > Settings) to match your deployed URL (e.g.,
https://your-app-url.com) to ensure password reset links and magic links function correctly.