Prerequisites
Before you begin, ensure you have:Node.js 18+
Download from nodejs.org
Supabase Account
Sign up at supabase.com
Google Sheets
For product catalog data (optional)
Google Drive
For technical documents storage (optional)
Installation Steps
Clone and install dependencies
Get the source code and install all required packages:The project uses the following key dependencies:
- Next.js 14 - React framework with App Router
- @supabase/supabase-js - Supabase client library
- @supabase/ssr - Server-side rendering support
- Tailwind CSS - Utility-first CSS framework
- shadcn/ui - High-quality React components
- Recharts - Charting library for analytics
Create Supabase project
- Go to supabase.com/dashboard
- Click New Project
- Choose your organization
- Enter project details:
- Name:
quality-hub-ginez - Database Password: Generate a strong password
- Region: Choose closest to your users
- Name:
- Wait for the project to initialize (2-3 minutes)
Save your database password in a secure location. You’ll need it for direct database access.
Configure environment variables
Create a Then update the file with your actual values:
.env.local file in the project root:.env.local
Finding your Supabase credentials
- Go to your Supabase project dashboard
- Navigate to Settings → API
- Copy the following:
- Project URL →
NEXT_PUBLIC_SUPABASE_URL - anon/public key →
NEXT_PUBLIC_SUPABASE_ANON_KEY - service_role key →
SUPABASE_SERVICE_ROLE_KEY(optional, for server-side operations)
- Project URL →
Setting up Google Sheets (Optional)
If you want to use Google Sheets for your product catalog:- Create a Google Sheet with your product data
- Go to File → Share → Publish to web
- Select the specific sheet and choose CSV format
- Copy the published URL to your
.env.localfile
Set up the database schema
Set up user roles and permissions (Advanced)
Quality Hub GINEZ includes a sophisticated role-based access control system. Run the role restructure migration:The system supports these roles:
admin- Full system accesspreparador- Production staffgerente_sucursal- Branch managerdirector_operaciones- Operations directorgerente_calidad- Quality & development managermostrador- Counter staffcajera- Cashierdirector_compras- Purchasing director
can_view,can_download,can_create,can_edit,can_delete,can_exportavailable_filters- Allowed filter optionsvisible_tabs- Accessible tabs/sections
View complete role configuration
View complete role configuration
The role system defines permissions for these modules:
- catalogo - Product catalog
- bitacora - Production logbook
- control_calidad - Quality control
- reportes - Reports and analytics
- configuracion - System configuration
Create your first admin user
After setting up the database:
- Sign up for an account through the app’s login page
- Note the user’s email address
- In Supabase SQL Editor, run:
Run the development server
Start the local development server:Open http://localhost:3000 in your browser. You should see the login page.
The development server includes hot module replacement (HMR), so your changes will be reflected immediately without refreshing the page.
Build and deploy for production
When you’re ready to deploy:
Deployment Options
- Vercel (Recommended)
- Docker
- Self-hosted
Quality Hub GINEZ is optimized for Vercel deployment:
- Push your code to GitHub
- Import the project in Vercel
- Add environment variables from
.env.local - Deploy
Post-Installation Configuration
Configure Authentication
In your Supabase project:- Go to Authentication → URL Configuration
- Add your production domain to Site URL
- Add redirect URLs for OAuth (if using social login)
- Configure email templates under Email Templates
Set up Storage (Optional)
If you plan to store documents in Supabase Storage:- Go to Storage in Supabase dashboard
- Create a bucket named
documents - Set up storage policies for access control
Performance Optimization
Enable caching for Google Sheets data
Enable caching for Google Sheets data
The product catalog fetches from Google Sheets on every page load. For better performance:
Optimize database queries
Optimize database queries
Add indexes for frequently queried columns:
Enable connection pooling
Enable connection pooling
For high-traffic deployments, enable Supabase connection pooling:
- Go to Database → Connection Pooling
- Enable pooling mode
- Use the pooled connection string for server-side operations
Verification Checklist
After installation, verify everything works:✓ Authentication
- Users can sign up
- Users can sign in
- Session persists across page refreshes
- Password reset emails are delivered
✓ Database Access
- Users can create production records
- Users can only see their own records (non-admin)
- Admins can see all records
- RLS policies are enforced correctly
✓ Modules
- Bitácora form loads and submits successfully
- Control de Calidad displays records with filters
- Reportes shows charts and KPIs
- Configuración allows profile editing
Troubleshooting
Error: Invalid Supabase URL or key
Error: Invalid Supabase URL or key
Solution: Verify your environment variables are correctly set:Make sure
.env.local is in the project root and contains valid values.RLS policy blocks all access
RLS policy blocks all access
Solution: Check that your policies reference the correct columns and that
auth.uid() returns the expected user ID.Debug with:Google Sheets data not loading
Google Sheets data not loading
Solution: Ensure your sheets are:
- Published to the web (File → Share → Publish to web)
- Set to CSV format in the publish dialog
- The URL ends with
&single=true&output=csv
Build fails with TypeScript errors
Build fails with TypeScript errors
Solution: Run type checking to see specific errors:Fix any type errors before building for production.
Next Steps
Quickstart Guide
Learn how to use the system as an end user
Architecture Overview
Understand the three-layer system architecture
Role Configuration
Customize roles and permissions for your organization
API Integration
Connect external systems via Supabase RPC functions
Need help? Check the project README at
/workspace/source/README.md for detailed architecture information and implementation notes.