An Advanced AI-Powered Defence Intelligence Platform for Pakistan
Features β’ Installation β’ Configuration β’ Deployment β’ API Integration
PakShield Defence AI is a cutting-edge Next.js 15 application that provides a comprehensive dashboard for national security operations. The platform integrates multiple AI-powered modules for threat intelligence, border security, and surveillance systems.
| Module | Description | Status |
|---|---|---|
| π Threat Intelligence | Email phishing detection, network intrusion detection, live monitoring | β Active |
| π‘οΈ Border Security | Drone detection, suspicious activity tracking, thermal imaging | β Active |
| πΉ AI Surveillance | Face recognition, weapon detection, anomaly detection | β Active |
- Dark/Light Theme with system preference detection
- Responsive Design optimized for all devices
- Smooth Animations powered by Framer Motion
- Accessible Components using Radix UI primitives
- Real-time Updates with SWR data fetching
- Real-time Threat Monitoring
- AI-Powered Analytics
- Secure Authentication (Auth module ready)
- End-to-end Encrypted Communications
- Interactive Charts with Recharts
- Live Data Visualization
- Historical Trend Analysis
- Customizable Dashboards
- Server-Side Rendering (SSR)
- Static Site Generation (SSG)
- Optimized Image Loading
- Code Splitting & Lazy Loading
- Edge Runtime Support
Next.js 15.2.4 - React framework with App Router
React 19 - UI library
TypeScript 5 - Type-safe development
Tailwind CSS 4.1.9 - Utility-first CSS framework
Radix UI - Accessible component primitives
shadcn/ui - Beautiful component library
Framer Motion - Animation library
Lucide React - Icon library
SWR - Data fetching & caching
React Hook Form - Form handling
Zod - Schema validation
Geist Font - Modern typography
Vercel Analytics - Performance monitoring
Next Themes - Theme management
- Node.js 18.x or higher
- pnpm (recommended) or npm
- Git
git clone https://github.com/21Afnan/PakShield_Defence_AI.git
cd PakShield_Defence_AI/Frontendpnpm install
# or
npm installCreate a .env.local file in the Frontend directory:
# Application
NEXT_PUBLIC_APP_NAME="PakShield Defence AI"
NEXT_PUBLIC_APP_URL=http://localhost:3000
# API Configuration
NEXT_PUBLIC_API_BASE_URL=https://your-ngrok-url.ngrok-free.app
# Analytics (Optional)
NEXT_PUBLIC_VERCEL_ANALYTICS_ID=your_analytics_idpnpm dev
# or
npm run devVisit http://localhost:3000 to see the application.
The API endpoints are configured in /public/config/config.json:
{
"apiBase": "https://your-backend-url.ngrok-free.app",
"endpoints": {
"threat.emailProtection": "/email-classify",
"threat.intrusionDetection": "/ids-predict",
"border.droneDetection": "/border/drones/detect",
"border.suspiciousActivity": "/border/suspicious/detect",
"video.faceRecognition": "/surveillance/face/recognize",
"video.weaponDetection": "/surveillance/weapon/detect",
"video.anomalyDetection": "/surveillance/anomaly/detect"
}
}Customize colors and themes in /tailwind.config.ts:
theme: {
extend: {
colors: {
primary: "hsl(var(--primary))",
secondary: "hsl(var(--secondary))",
// Add your custom colors
}
}
}# Install Vercel CLI
npm i -g vercel
# Deploy to production
vercel --prod- Push your code to GitHub
- Import repository on Vercel
- Configure environment variables
- Deploy automatically
Add these in your Vercel project settings:
NEXT_PUBLIC_API_BASE_URL = https://your-backend-url.ngrok-free.app
pnpm build
pnpm startimport { useAppConfig, resolveEndpoint } from "@/lib/config"
export default function MyComponent() {
const { config, isLoading, error } = useAppConfig()
const handleDetection = async (file: File) => {
const endpoint = resolveEndpoint(config, "border.droneDetection")
const formData = new FormData()
formData.append("file", file)
const response = await fetch(endpoint, {
method: "POST",
body: formData,
})
return response.json()
}
}GET /email-classify- Email phishing detectionPOST /ids-predict- Network intrusion detection
POST /border/drones/detect- Drone detection from imagesPOST /border/humans/detect- Night thermal person detectionPOST /border/suspicious/detect- Suspicious activity detection
POST /surveillance/face/recognize- Face recognitionPOST /surveillance/weapon/detect- Weapon detectionPOST /surveillance/anomaly/detect- Anomaly detection
Frontend/
βββ app/ # Next.js App Router
β βββ (auth)/ # Authentication pages
β βββ (dashboard)/ # Dashboard pages
β β βββ threat-intelligence/ # Threat Intel module
β β βββ border-security/ # Border Security module
β β βββ ai-surveillance/ # Surveillance module
β βββ layout.tsx # Root layout
β βββ globals.css # Global styles
β
βββ components/ # React components
β βββ ui/ # shadcn/ui components
β βββ auth/ # Authentication components
β βββ cards/ # Card components
β βββ modules/ # Module-specific components
β βββ layout/ # Layout components
β
βββ lib/ # Utility functions
β βββ config.ts # API configuration
β βββ utils.ts # Helper functions
β βββ modules.ts # Module definitions
β
βββ hooks/ # Custom React hooks
β βββ use-mobile.ts # Mobile detection
β βββ use-toast.ts # Toast notifications
β
βββ public/ # Static assets
β βββ config/ # Configuration files
β βββ images/ # Image assets
β
βββ styles/ # Additional styles
βββ next.config.mjs # Next.js configuration
βββ tailwind.config.ts # Tailwind configuration
βββ tsconfig.json # TypeScript configuration
This project uses shadcn/ui components. To add new components:
npx shadcn@latest add button
npx shadcn@latest add card
npx shadcn@latest add dialog- β Accordion, Alert Dialog, Avatar
- β Button, Card, Checkbox, Collapsible
- β Dialog, Dropdown Menu, Forms
- β Navigation Menu, Popover, Progress
- β Select, Separator, Slider, Switch
- β Tabs, Toast, Tooltip, Toggle
# Development server
pnpm dev
# Build for production
pnpm build
# Start production server
pnpm start
# Run linting
pnpm lint
# Type checking
pnpm type-check- ESLint for code linting
- TypeScript for type safety
- Prettier for code formatting (recommended)
- Verify backend is running
- Check ngrok tunnel is active
- Update
apiBasein/public/config/config.json - Check CORS settings on backend
# Clear cache and reinstall
rm -rf .next node_modules
pnpm install
pnpm build# Regenerate types
pnpm type-check- β Image optimization with Next.js Image
- β Font optimization with Geist
- β Code splitting and lazy loading
- β SWR for data caching
- β Vercel Analytics integration
- First Contentful Paint (FCP): < 1.5s
- Largest Contentful Paint (LCP): < 2.5s
- Time to Interactive (TTI): < 3.5s
- Lighthouse Score: 95+
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is part of the PakShield Defence AI initiative.
Project: PakShield Defence AI
Repository: github.com/21Afnan/PakShield_Defence_AI
Owner: 21Afnan
For issues and questions:
- Create an issue on GitHub
- Contact the development team