Admin Dashboard Setup
This guide will help you set up the ThePlugg admin dashboard locally.
Prerequisites
- Node.js 18 or higher
- npm or yarn
Installation
- Navigate to project directory
cd theplugg-admin
- Install dependencies
npm install
- Configure API endpoint
Edit src/config/api.ts and update the base URL:
export const API_BASE_URL = 'http://localhost:3000';
// or production: 'https://api.thepluggnamibia.com'
- Start development server
npm start
The app will open at http://localhost:3001 (or another port if 3001 is busy).
Environment Variables
Create a .env file if needed:
REACT_APP_API_URL=http://localhost:3000
Build for Production
npm run build
This creates an optimized production build in the build/ directory.
Authentication
The admin dashboard requires:
- Admin user account in the database
- Valid API key for admin endpoints
- Session management (implemented via API)
Troubleshooting
Port already in use
Change the port by setting environment variable:
PORT=3002 npm start
API connection errors
- Verify API server is running
- Check API base URL configuration
- Verify CORS settings on backend
Build errors
npm install
npm run build