enterprise_assest_managemen.../BACKEND_SETUP.md

3.7 KiB

Backend Setup Complete! 🎉

What's Working

Services Running

Database & Collections

  • Database schema imported from schema/init.sql
  • All tables created successfully
  • Directus collections configured
  • Sample data loaded:
    • 1 Organization (Demo Organization)
    • 4 Asset Categories (IT Equipment, Office Furniture, etc.)
    • 4 Locations (Main Office, IT Department, etc.)
    • 3 Vendors (Dell Technologies, Office Solutions, etc.)

Authentication

  • Admin Email: admin@assetmanagement.com
  • Admin Password: AssetAdmin2024!

🧪 Testing the Connection

Option 1: Frontend Testing

  1. Open your frontend at http://localhost:5173
  2. Try logging in with the admin credentials above
  3. Navigate to "Add Asset" and create a test asset
  4. Check if the asset appears in the Assets list

Option 2: Directus Admin Testing

  1. Visit http://localhost:8055/admin
  2. Login with admin credentials
  3. Browse the collections (Organizations, Assets, etc.)
  4. Create test data directly in Directus
  5. Check if it appears in your frontend

Option 3: API Testing

# Run our test script
./scripts/test-frontend-connection.sh

🔧 Available Commands

# Start all services
make up

# Check service status
make status

# View logs
make logs

# Stop services
make down

# Reset database (if needed)
make db-reset

# Setup collections (already done)
./scripts/setup-directus-collections.sh

📊 Database Schema Highlights

Main Tables

  • organizations: SaaS tenant management
  • assets: Core asset registry
  • asset_categories: Asset classification
  • locations: Physical asset locations
  • vendors: Supplier management
  • work_orders: Maintenance requests
  • asset_reminders: Maintenance scheduling

Key Features

  • Multi-tenant (organization-based)
  • Full asset lifecycle tracking
  • QR code generation
  • Work order management
  • Financial tracking (depreciation, costs)
  • Component-level tracking

🐛 Troubleshooting

Frontend Can't Connect

  1. Check if Directus is running: curl http://localhost:8055/server/health
  2. Verify .env file has correct API URL
  3. Check browser network tab for CORS errors

Authentication Issues

  1. Verify admin credentials in docker-compose.yml
  2. Check Directus logs: docker-compose logs directus
  3. Reset admin user if needed

Missing Collections

  1. Run: ./scripts/setup-directus-collections.sh
  2. Check Directus admin panel for collections
  3. Verify database tables exist

No Sample Data

  1. Run: make db-reset (will recreate everything)
  2. Check init.sql execution in container logs

🚀 Next Steps

  1. Test Asset Creation: Use the frontend Add Asset form
  2. Configure Permissions: Set up user roles in Directus admin
  3. Customize Fields: Add custom fields via Directus admin
  4. Setup Relations: Configure foreign key relationships
  5. Deploy: Configure for production environment

📁 Project Structure

enterprise-asset-management/
├── frontend/               # Vue.js application
│   ├── src/
│   │   ├── repositories/   # API communication
│   │   ├── stores/         # State management
│   │   └── views/          # Pages (Dashboard, AddAsset, etc.)
│   └── .env               # Frontend configuration
├── schema/
│   └── init.sql           # Database schema & sample data
├── scripts/               # Setup and utility scripts
└── docker-compose.yml     # Service orchestration

Your enterprise asset management system is now fully operational! 🎯