Skip to main content

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

  1. Navigate to project directory
cd theplugg-admin
  1. Install dependencies
npm install
  1. 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'
  1. 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:

  1. Admin user account in the database
  2. Valid API key for admin endpoints
  3. 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