Prerequisites
Before setting up VIJ Admin, ensure you have:Required Software
Required Software
- Node.js 18+ - Required for running Next.js
- npm, yarn, pnpm, or bun - Package manager
- MongoDB 5.0+ - Database for storing error logs
- Git - For cloning the repository
MongoDB Setup
MongoDB Setup
You need a MongoDB instance. Choose one of:Option 1: MongoDB Atlas (Cloud)
- Create free account at mongodb.com/atlas
- Create a cluster
- Get connection string
Optional: Google Gemini API Key
Optional: Google Gemini API Key
For AI-powered error analysis:
- Visit ai.google.dev
- Create an API key
- Keep it for environment configuration
AI features are optional. VIJ works perfectly without them.
Installation
1
Clone the repository
Clone the VIJ Admin repository:
2
Install dependencies
Install all required npm packages:This will install:
- Next.js 14+ framework
- MongoDB driver
- Google Generative AI SDK
- UI components and utilities
3
Configure environment variables
Create a Add the following configuration:
.env.local file in the project root:.env.local
4
Start the development server
Run the Next.js development server:The dashboard will be available at http://localhost:3000
You should see the VIJ Admin dashboard! The home page will be empty until you start sending logs from your applications.
5
Verify database connection
Check the terminal output for MongoDB connection status:If you see connection errors, verify:
- MongoDB is running
- Connection string is correct
- Network/firewall allows connection
Configuration
Environment Variables
Configure VIJ Admin through environment variables:MongoDB connection string.Format:
mongodb://[username:password@]host[:port]/database[?options]Examples:Base URL where your VIJ Admin dashboard is accessible.Usage: Used for API endpoints and client-side routing.Examples:
Google Gemini API key for AI-powered error analysis.Get a key: ai.google.devExample:
Without this key, AI features will be disabled but all other functionality works normally.
MongoDB Configuration
VIJ Admin automatically creates the following indexes for optimal performance:Database Schema
Error logs are stored in thelogs collection with this structure:
Next.js Configuration
The VIJ Admin uses these Next.js settings:App Router Structure
API Routes
All API routes are automatically available:POST /api/logs- Receive error logs from SDKGET /api/logs- Fetch logs with filteringGET /api/stats- Get dashboard statisticsGET /api/groups- Get grouped errors
These routes are documented in detail in the API Reference.
Initial Setup Checklist
After installation, verify your setup:1
Check dashboard access
Open http://localhost:3000 in your browser.You should see:
- Dashboard home page
- Navigation menu (Dashboard, Logs, Groups)
- Empty state (no errors yet)
2
Verify API endpoints
Test the API is responding:
Getting a method error is good! It means the API is running.
3
Test log ingestion
Send a test log:Then check the dashboard - you should see your test error!
4
Verify database
Check MongoDB has the data:
5
Test AI features (if configured)
If you set
GEMINI_API_KEY, click on a log entry and verify you see:- AI Summary
- Possible Cause
- Suggested Fix
AI analysis may take a few seconds on first load.
Project Structure
Understanding the VIJ Admin codebase:Customization
Theming
VIJ Admin uses Tailwind CSS. Customize colors intailwind.config.js:
tailwind.config.js
Adding Custom Filters
Extend filtering inapp/logs/page.tsx:
Custom Metadata Fields
Display custom metadata incomponents/ErrorDetails.tsx:
Troubleshooting
MongoDB connection failed
MongoDB connection failed
Error:
MongoServerError: connect ECONNREFUSEDSolutions:-
Verify MongoDB is running:
-
Check connection string in
.env.local - Verify firewall/network settings
- For Atlas: Check IP whitelist
Module not found errors
Module not found errors
Error:
Module not found: Can't resolve 'X'Solutions:Environment variables not loading
Environment variables not loading
Issue: Environment variables undefinedSolutions:
- Ensure file is named
.env.local(not.env) - Restart dev server after changes
- Use
NEXT_PUBLIC_prefix for client-side variables - Check for typos in variable names
AI features not working
AI features not working
Issue: No AI analysis appearingSolutions:
- Verify
GEMINI_API_KEYis set - Check API key is valid on ai.google.dev
- Check browser console for errors
- Verify you have API quota available
- Check server logs for AI-related errors
Port already in use
Port already in use
Error:
Port 3000 is already in useSolutions: