Initial Configuration

Post-installation setup guide for configuring Smart Shelf with admin users, application settings, and initial data.

Admin User Setup

1. Create First Admin User

Sign Up via Application:

  1. Navigate to your deployed Smart Shelf application
  2. Click "Sign Up" or "Create Account"
  3. Enter your admin email and password
  4. Verify your email address (check spam folder)

Promote User to Admin:

-- In Supabase SQL Editor, run:
UPDATE user_profiles 
SET role = 'admin' 
WHERE id = (
  SELECT id FROM auth.users 
  WHERE email = 'your-admin-email@company.com'
);

Alternative Method via Supabase Dashboard:

  1. Go to Authentication → Users
  2. Find your user record
  3. Click on the user
  4. Edit User Metadata:
    {
      "role": "admin"
    }
    

2. Complete Admin Profile

Login and Configure Profile:

  1. Log in with your admin credentials
  2. Navigate to User Profile/Settings
  3. Complete your profile information:
    Full Name: [Your Name]
    Phone: [Your Phone]
    Role: Admin (should be set automatically)
    Company: [Will be created in next step]
    

Company Configuration

1. Create Company Record

Via Admin Interface:

  1. Navigate to Admin → Company Settings
  2. Click "Create Company" or "Setup Company"
  3. Fill in company information:
    Company Name: Your Company Name
    Address: Complete business address
    Phone: Main business phone
    Email: Main business email
    Website: https://yourwebsite.com
    

Via SQL (if admin interface not available):

-- Create company record
INSERT INTO companies (
  name, 
  address, 
  phone, 
  email, 
  website,
  settings
) VALUES (
  'Your Company Name',
  '123 Business St, City, State 12345',
  '+1 (555) 123-4567',
  'info@yourcompany.com',
  'https://yourcompany.com',
  '{
    "currency": "USD",
    "timezone": "America/New_York",
    "date_format": "MM/DD/YYYY",
    "low_stock_threshold": 10
  }'::jsonb
);

-- Link admin user to company
UPDATE user_profiles 
SET company_id = (SELECT id FROM companies WHERE name = 'Your Company Name')
WHERE role = 'admin';

2. Configure Company Settings

Basic Settings:

{
  "currency": "USD",
  "timezone": "America/New_York",
  "date_format": "MM/DD/YYYY",
  "time_format": "12h",
  "low_stock_threshold": 10,
  "reorder_notification": true,
  "auto_reorder": false
}

Advanced Settings:

{
  "barcode_prefix": "COMP",
  "sku_prefix": "SKU",
  "order_number_prefix": "PO",
  "default_warehouse": "main",
  "backup_frequency": "daily",
  "retention_period": 365
}

Warehouse Setup

1. Create Main Warehouse

Via Admin Interface:

  1. Navigate to Admin → Warehouses
  2. Click "Add Warehouse"
  3. Configure main warehouse:
    Warehouse Name: Main Warehouse
    Code: MAIN
    Address: [Warehouse address]
    Manager: [Select user]
    Active: Yes
    

Via SQL:

-- Create main warehouse
INSERT INTO warehouses (
  company_id,
  name,
  code,
  address,
  manager_id,
  is_active,
  settings
) VALUES (
  (SELECT id FROM companies WHERE name = 'Your Company Name'),
  'Main Warehouse',
  'MAIN',
  '123 Warehouse Dr, City, State 12345',
  (SELECT id FROM user_profiles WHERE role = 'admin' LIMIT 1),
  true,
  '{
    "zones": ["A", "B", "C"],
    "capacity": 10000,
    "operating_hours": "8:00-17:00"
  }'::jsonb
);

2. Additional Warehouses (Optional)

For Multi-Location Businesses:

-- Add additional warehouses
INSERT INTO warehouses (company_id, name, code, address, is_active) VALUES
((SELECT id FROM companies LIMIT 1), 'North Warehouse', 'NORTH', 'North Location Address', true),
((SELECT id FROM companies LIMIT 1), 'South Warehouse', 'SOUTH', 'South Location Address', true);

Product Categories

1. Create Category Structure

Basic Categories:

-- Create main categories
INSERT INTO categories (company_id, name, description) VALUES
((SELECT id FROM companies LIMIT 1), 'Electronics', 'Electronic devices and components'),
((SELECT id FROM companies LIMIT 1), 'Office Supplies', 'General office supplies and equipment'),
((SELECT id FROM companies LIMIT 1), 'Raw Materials', 'Manufacturing raw materials'),
((SELECT id FROM companies LIMIT 1), 'Finished Goods', 'Completed products ready for sale');

-- Create subcategories
INSERT INTO categories (company_id, name, description, parent_id) VALUES
((SELECT id FROM companies LIMIT 1), 'Computers', 'Desktop and laptop computers', 
 (SELECT id FROM categories WHERE name = 'Electronics' LIMIT 1)),
((SELECT id FROM companies LIMIT 1), 'Mobile Devices', 'Smartphones and tablets',
 (SELECT id FROM categories WHERE name = 'Electronics' LIMIT 1));

Via Admin Interface:

  1. Navigate to Products → Categories
  2. Click "Add Category"
  3. Create hierarchical structure:
    Electronics
    ├── Computers
    ├── Mobile Devices
    └── Accessories
    
    Office Supplies
    ├── Stationery
    ├── Furniture
    └── Equipment
    

Supplier Configuration

1. Add Initial Suppliers

Via Admin Interface:

  1. Navigate to Suppliers → Add Supplier
  2. Add key suppliers:
    Supplier 1:
    Name: Tech Distributor Inc
    Contact: John Smith
    Email: orders@techdist.com
    Phone: +1 (555) 123-4567
    Payment Terms: Net 30
    
    Supplier 2:
    Name: Office Supply Co
    Contact: Jane Doe
    Email: sales@officesupply.com
    Phone: +1 (555) 987-6543
    Payment Terms: Net 15
    

Via SQL:

-- Add suppliers
INSERT INTO suppliers (
  company_id, 
  name, 
  contact_person, 
  email, 
  phone, 
  payment_terms,
  is_active
) VALUES
((SELECT id FROM companies LIMIT 1), 'Tech Distributor Inc', 'John Smith', 'orders@techdist.com', '+1 (555) 123-4567', 'Net 30', true),
((SELECT id FROM companies LIMIT 1), 'Office Supply Co', 'Jane Doe', 'sales@officesupply.com', '+1 (555) 987-6543', 'Net 15', true);

Initial Product Setup

1. Sample Products

Create Sample Products for Testing:

-- Add sample products
INSERT INTO products (
  company_id,
  sku,
  name,
  description,
  category_id,
  supplier_id,
  barcode,
  cost_price,
  selling_price,
  reorder_point,
  reorder_quantity
) VALUES
((SELECT id FROM companies LIMIT 1), 'SKU001', 'Laptop Computer', 'Business laptop computer', 
 (SELECT id FROM categories WHERE name = 'Computers' LIMIT 1),
 (SELECT id FROM suppliers WHERE name = 'Tech Distributor Inc' LIMIT 1),
 '123456789012', 800.00, 1200.00, 5, 10),
 
((SELECT id FROM companies LIMIT 1), 'SKU002', 'Office Chair', 'Ergonomic office chair',
 (SELECT id FROM categories WHERE name = 'Office Supplies' LIMIT 1),
 (SELECT id FROM suppliers WHERE name = 'Office Supply Co' LIMIT 1),
 '123456789013', 150.00, 250.00, 10, 20);

-- Initialize inventory for sample products
INSERT INTO inventory (product_id, warehouse_id, quantity) VALUES
((SELECT id FROM products WHERE sku = 'SKU001'), (SELECT id FROM warehouses WHERE code = 'MAIN'), 25),
((SELECT id FROM products WHERE sku = 'SKU002'), (SELECT id FROM warehouses WHERE code = 'MAIN'), 50);

2. Bulk Product Import (Optional)

Prepare CSV Import:

sku,name,description,category,supplier,barcode,cost_price,selling_price,reorder_point,reorder_quantity
SKU003,Wireless Mouse,Bluetooth wireless mouse,Electronics,Tech Distributor Inc,123456789014,25.00,45.00,20,50
SKU004,Printer Paper,A4 printer paper - 500 sheets,Office Supplies,Office Supply Co,123456789015,8.00,15.00,100,200

Import via Admin Interface:

  1. Navigate to Products → Import
  2. Upload CSV file
  3. Map columns to product fields
  4. Review and confirm import

User Management

1. Add Team Members

Invite Users via Admin Interface:

  1. Navigate to Admin → Users
  2. Click "Invite User"
  3. Configure user details:
    Email: user@yourcompany.com
    Role: Employee/Manager
    Warehouse Access: Main Warehouse
    Permissions: [Select appropriate permissions]
    

Add Users via SQL:

-- Note: Users must sign up first, then update their profiles
-- This is just for updating existing users

UPDATE user_profiles 
SET 
  company_id = (SELECT id FROM companies LIMIT 1),
  role = 'manager',
  full_name = 'Manager Name'
WHERE id = '[user-id-from-auth-users]';

2. Configure User Roles

Role Definitions:

-- Admin: Full system access
-- Manager: Operational management + reporting
-- Employee: Daily operations
-- Viewer: Read-only access

-- Example: Set user as manager
UPDATE user_profiles 
SET role = 'manager' 
WHERE email = 'manager@yourcompany.com';

Application Settings

1. System Preferences

Configure via Admin Interface:

  1. Navigate to Admin → Settings
  2. Configure system preferences:
    Default Currency: USD
    Timezone: America/New_York
    Date Format: MM/DD/YYYY
    Low Stock Alert: 10 units
    Auto Reorder: Disabled
    Email Notifications: Enabled
    

2. Notification Settings

Email Notifications:

{
  "low_stock_alerts": true,
  "order_status_updates": true,
  "user_activity": false,
  "system_maintenance": true,
  "daily_reports": true
}

Alert Thresholds:

{
  "low_stock_threshold": 10,
  "critical_stock_threshold": 5,
  "overstock_threshold": 1000,
  "expiry_warning_days": 30
}

Security Configuration

1. Password Policies

Configure in Supabase Dashboard:

  1. Go to Authentication → Settings
  2. Set password requirements:
    Minimum Length: 8 characters
    Require Uppercase: Yes
    Require Numbers: Yes
    Require Special Characters: Yes
    

2. Session Management

Configure Session Settings:

Session Timeout: 8 hours
Remember Me: 30 days
Max Concurrent Sessions: 3
Two-Factor Authentication: Optional

Backup and Maintenance

1. Database Backups

Supabase Automatic Backups:

  • Enable daily backups in Supabase dashboard
  • Set retention period (7-30 days recommended)
  • Configure backup notifications

2. Monitoring Setup

Application Monitoring:

  • Set up error tracking (Sentry recommended)
  • Configure uptime monitoring
  • Enable performance monitoring

Verification Checklist

Basic Setup Verification

  • Admin user created and can log in
  • Company information configured
  • Main warehouse set up
  • Product categories created
  • Suppliers added
  • Sample products created with inventory
  • User roles configured properly

Functional Verification

  • Product search works
  • Inventory tracking updates correctly
  • Barcode scanning functional (if using)
  • Reports generate successfully
  • User permissions enforced correctly
  • Email notifications working

Security Verification

  • RLS policies enforced
  • User authentication working
  • Password policies applied
  • Session management configured
  • Data isolation between companies verified

Troubleshooting Initial Setup

Common Issues

Admin User Access

-- Check user role assignment
SELECT u.email, p.role, p.company_id 
FROM auth.users u
JOIN user_profiles p ON u.id = p.id
WHERE u.email = 'your-admin-email@company.com';

-- Fix missing company assignment
UPDATE user_profiles 
SET company_id = (SELECT id FROM companies LIMIT 1)
WHERE company_id IS NULL;

Company Data Access

-- Verify company data visibility
SELECT c.name, COUNT(p.id) as product_count, COUNT(w.id) as warehouse_count
FROM companies c
LEFT JOIN products p ON c.id = p.company_id
LEFT JOIN warehouses w ON c.id = w.company_id
GROUP BY c.id, c.name;

Permission Issues

  • Check RLS policies are enabled and working
  • Verify user is assigned to correct company
  • Confirm role-based permissions in application

Next Steps

After completing initial configuration:

  1. User Guide - Learn daily operations
  2. Features - Explore all Smart Shelf capabilities
  3. API Documentation - Integrate with other systems
  4. Maintenance - Keep your system running smoothly

Initial configuration complete! Your Smart Shelf system is now ready for daily operations. Start with the User Guide to begin managing your inventory.