Skip to content

πŸ›‘οΈ AI-Powered Defence Intelligence Platform | Next.js 15 | Real-time threat detection, border security & surveillance systems for Pakistan's national defense.

Notifications You must be signed in to change notification settings

fewgets/PakShieldAI-Website

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ PakShield Defence AI - Frontend

PakShield Defence AI Next.js TypeScript Tailwind CSS

An Advanced AI-Powered Defence Intelligence Platform for Pakistan

Features β€’ Installation β€’ Configuration β€’ Deployment β€’ API Integration


πŸ“‹ Overview

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.

🎯 Key Modules

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

✨ Features

🎨 Modern UI/UX

  • 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

πŸ” Security Features

  • Real-time Threat Monitoring
  • AI-Powered Analytics
  • Secure Authentication (Auth module ready)
  • End-to-end Encrypted Communications

πŸ“Š Advanced Analytics

  • Interactive Charts with Recharts
  • Live Data Visualization
  • Historical Trend Analysis
  • Customizable Dashboards

πŸš€ Performance

  • Server-Side Rendering (SSR)
  • Static Site Generation (SSG)
  • Optimized Image Loading
  • Code Splitting & Lazy Loading
  • Edge Runtime Support

πŸ› οΈ Technology Stack

Core Framework

Next.js 15.2.4    - React framework with App Router
React 19          - UI library
TypeScript 5      - Type-safe development

Styling & UI

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

Data & State Management

SWR                       - Data fetching & caching
React Hook Form           - Form handling
Zod                       - Schema validation

Additional Tools

Geist Font                - Modern typography
Vercel Analytics          - Performance monitoring
Next Themes               - Theme management

πŸ“¦ Installation

Prerequisites

  • Node.js 18.x or higher
  • pnpm (recommended) or npm
  • Git

Step 1: Clone the Repository

git clone https://github.com/21Afnan/PakShield_Defence_AI.git
cd PakShield_Defence_AI/Frontend

Step 2: Install Dependencies

pnpm install
# or
npm install

Step 3: Configure Environment

Create 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_id

Step 4: Start Development Server

pnpm dev
# or
npm run dev

Visit http://localhost:3000 to see the application.


βš™οΈ Configuration

API Configuration

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"
  }
}

Theme Configuration

Customize colors and themes in /tailwind.config.ts:

theme: {
  extend: {
    colors: {
      primary: "hsl(var(--primary))",
      secondary: "hsl(var(--secondary))",
      // Add your custom colors
    }
  }
}

πŸš€ Deployment

Deploy to Vercel (Recommended)

Option 1: Using Vercel CLI

# Install Vercel CLI
npm i -g vercel

# Deploy to production
vercel --prod

Option 2: Using Git Integration

  1. Push your code to GitHub
  2. Import repository on Vercel
  3. Configure environment variables
  4. Deploy automatically

Environment Variables on Vercel

Add these in your Vercel project settings:

NEXT_PUBLIC_API_BASE_URL = https://your-backend-url.ngrok-free.app

Build for Production

pnpm build
pnpm start

πŸ”Œ API Integration

Using the API Config Hook

import { 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()
  }
}

Available API Endpoints

Threat Intelligence

  • GET /email-classify - Email phishing detection
  • POST /ids-predict - Network intrusion detection

Border Security

  • POST /border/drones/detect - Drone detection from images
  • POST /border/humans/detect - Night thermal person detection
  • POST /border/suspicious/detect - Suspicious activity detection

AI Surveillance

  • POST /surveillance/face/recognize - Face recognition
  • POST /surveillance/weapon/detect - Weapon detection
  • POST /surveillance/anomaly/detect - Anomaly detection

πŸ“ Project Structure

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

🎨 Component Library

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

Available Components

  • βœ… 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

Available Scripts

# Development server
pnpm dev

# Build for production
pnpm build

# Start production server
pnpm start

# Run linting
pnpm lint

# Type checking
pnpm type-check

Code Quality

  • ESLint for code linting
  • TypeScript for type safety
  • Prettier for code formatting (recommended)

πŸ”§ Troubleshooting

API Connection Issues

  1. Verify backend is running
  2. Check ngrok tunnel is active
  3. Update apiBase in /public/config/config.json
  4. Check CORS settings on backend

Build Errors

# Clear cache and reinstall
rm -rf .next node_modules
pnpm install
pnpm build

Type Errors

# Regenerate types
pnpm type-check

πŸ“Š Performance Optimization

Implemented Optimizations

  • βœ… Image optimization with Next.js Image
  • βœ… Font optimization with Geist
  • βœ… Code splitting and lazy loading
  • βœ… SWR for data caching
  • βœ… Vercel Analytics integration

Performance Metrics

  • First Contentful Paint (FCP): < 1.5s
  • Largest Contentful Paint (LCP): < 2.5s
  • Time to Interactive (TTI): < 3.5s
  • Lighthouse Score: 95+

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

This project is part of the PakShield Defence AI initiative.


πŸ‘₯ Team

Project: PakShield Defence AI
Repository: github.com/21Afnan/PakShield_Defence_AI
Owner: 21Afnan


πŸ“ž Support

For issues and questions:

  • Create an issue on GitHub
  • Contact the development team

Built with ❀️ for Pakistan's Defence

Made with Next.js Powered by AI Secure

About

πŸ›‘οΈ AI-Powered Defence Intelligence Platform | Next.js 15 | Real-time threat detection, border security & surveillance systems for Pakistan's national defense.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published