Quick Start Guide
Get LegoCity running in 5 minutes.
1. Prerequisites Check
Verify you have the required tools:
powershell
# Check Node.js version (need 18+)
node --version
# Check pnpm (install if needed)
pnpm --version
# If pnpm not installed:
npm install -g pnpm
# Check MongoDB is running
mongosh --eval "db.version()"2. Clone & Install
bash
# Clone repository
git clone https://github.com/CTU-SematX/LegoCity.git
cd LegoCity/dashboard
# Install dependencies
pnpm install3. Configure Environment
Create .env file:
bash
cp .env.example .envMinimal configuration:
bash
# Database
DATABASE_URI=mongodb://127.0.0.1/legocity
# Security
PAYLOAD_SECRET=your-secret-key-min-32-chars
# Server
NEXT_PUBLIC_SERVER_URL=http://localhost:3000Generate Secret
bash
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"4. Start Development Server
bash
pnpm devYou should see:
✓ Ready in 3.2s
○ Local: http://localhost:30005. Access Dashboard
Open your browser:
- Frontend: http://localhost:3000
- Admin Panel: http://localhost:3000/admin
First Login
On first access, you'll be prompted to create an admin account:
- Email:
admin@example.com - Password: Choose a secure password
- Click "Create First User"
6. Load Sample Data (Optional)
bash
# Seed database with sample city data
pnpm seedThis creates:
- ✅ Sample sensors and zones
- ✅ Example dashboard pages
- ✅ Demo map views and layers
What's Next?
Explore the Dashboard
- Navigate to Admin Panel - http://localhost:3000/admin
- View Collections:
- Pages - Dashboard layouts
- Media - Images and assets
- Posts - Content articles
- Categories - Content organization
Configure Your City
- Connect Data Sources - Link NGSI-LD brokers
- Set Up Map Views - Configure Mapbox layers (see User Guide)
- Create Dashboard Pages - Build custom layouts with blocks
Start Development
- Development Setup - Complete dev environment
- Create Custom Blocks - Build UI components
- Write Plugins - Extend functionality
Troubleshooting
Port Already in Use
bash
# Kill process on port 3000
npx kill-port 3000
# Or use different port
PORT=3001 pnpm devMongoDB Connection Failed
bash
# Start MongoDB (Windows)
net start MongoDB
# Or start manually
mongod --dbpath C:\data\dbBuild Errors
bash
# Clear cache and reinstall
rm -rf node_modules .next
pnpm install
pnpm devNeed Help?
Up and running? Continue to the User Guide to learn how to use LegoCity.