Skip to content

DIYA73/devshield-saas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ DevShield SaaS

Enterprise-grade cybersecurity platform for API protection, real-time attack detection, and threat intelligence visualization.

DevShield is a comprehensive SaaS solution designed to protect modern APIs from cyber threats, detect suspicious activities in real-time, and provide actionable security insights through an intuitive dashboard.

License TypeScript React Node.js


🎯 Overview

DevShield provides enterprise-level API security through:

  • πŸ” API Protection: Intelligent request filtering, rate limiting, and authentication enforcement
  • 🎯 Attack Detection: Real-time threat identification using pattern recognition and behavioral analysis
  • πŸ“Š Threat Visualization: Interactive dashboards with live security metrics and attack timelines
  • πŸ”” Alert System: Instant notifications for critical security events
  • πŸ“ˆ Analytics: Comprehensive security insights and trend analysis

✨ Key Features

Security Core

  • API Gateway Protection: Intercepts and validates all API requests
  • DDoS Mitigation: Advanced rate limiting and traffic pattern analysis
  • SQL Injection Detection: Pattern-based query validation
  • XSS Prevention: Input sanitization and output encoding
  • CSRF Protection: Token-based request verification
  • JWT Authentication: Secure, stateless user authentication
  • Role-Based Access Control (RBAC): Granular permission management

Monitoring & Analytics

  • Real-Time Dashboard: Live threat feed with WebSocket updates
  • Attack Timeline: Visual representation of security events
  • Threat Heatmap: Geographic visualization of attack sources
  • Performance Metrics: API response times and system health
  • Historical Analysis: Trend identification and pattern discovery
  • Custom Alerts: Configurable notification rules

Administration

  • Multi-Tenant Architecture: Isolated environments for each customer
  • API Key Management: Secure credential generation and rotation
  • Whitelist/Blacklist: IP and domain-based access control
  • Audit Logging: Comprehensive security event tracking
  • Compliance Reports: Export security data for regulatory requirements

πŸ› οΈ Tech Stack

Frontend (devshield-frontend/)

βš›οΈ  React 18+ with TypeScript
🎨  TailwindCSS / Material-UI
πŸ“Š  Recharts / D3.js (Data Visualization)
πŸ”Œ  Socket.io Client (Real-time updates)
πŸ—‚οΈ  Redux Toolkit (State Management)
πŸ“‘  Axios (HTTP Client)

Backend (devshield-backend/)

πŸš€  Node.js + Express.js
πŸ“˜  TypeScript
πŸ—„οΈ  MongoDB + Mongoose
πŸ”Œ  Socket.io (WebSockets)
πŸ”  JWT + Passport.js (Authentication)
⚑  Redis (Caching & Rate Limiting)
πŸ“§  Nodemailer (Email Notifications)
πŸ§ͺ  Jest + Supertest (Testing)

DevOps & Infrastructure

🐳  Docker + Docker Compose
☁️  AWS / Azure / GCP ready
πŸ”„  GitHub Actions (CI/CD)
πŸ“Š  Prometheus + Grafana (Monitoring)
πŸ”  ELK Stack (Logging)

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm/yarn
  • MongoDB 5.0+
  • Redis 6.0+ (for caching and rate limiting)
  • Docker (optional, for containerized deployment)

Installation

1. Clone the Repository

git clone https://github.com/DIYA73/devshield-saas.git
cd devshield-saas

2. Backend Setup

cd devshield-backend
npm install

# Create environment file
cp .env.example .env

# Configure your .env file:
# PORT=5000
# MONGODB_URI=mongodb://localhost:27017/devshield
# REDIS_URL=redis://localhost:6379
# JWT_SECRET=your_secure_secret_key
# NODE_ENV=development

3. Frontend Setup

cd ../devshield-frontend
npm install

# Create environment file
cp .env.example .env

# Configure your .env file:
# REACT_APP_API_URL=http://localhost:5000
# REACT_APP_SOCKET_URL=http://localhost:5000

4. Start MongoDB and Redis

# Option A: Using Docker
docker-compose up -d mongodb redis

# Option B: Local installation
mongod
redis-server

5. Run the Application

Backend (Terminal 1):

cd devshield-backend
npm run dev

Frontend (Terminal 2):

cd devshield-frontend
npm start

6. Access the Application

Frontend: http://localhost:3000
Backend API: http://localhost:5000

🐳 Docker Deployment

Quick Deploy with Docker Compose:

docker-compose up -d

This will start:

  • Frontend (React) on port 3000
  • Backend (Node.js) on port 5000
  • MongoDB on port 27017
  • Redis on port 6379

πŸ“ Project Structure

devshield-saas/
β”œβ”€β”€ devshield-frontend/          # React TypeScript Frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/          # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ pages/               # Page components
β”‚   β”‚   β”œβ”€β”€ features/            # Redux slices
β”‚   β”‚   β”œβ”€β”€ services/            # API services
β”‚   β”‚   β”œβ”€β”€ utils/               # Helper functions
β”‚   β”‚   β”œβ”€β”€ hooks/               # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ types/               # TypeScript definitions
β”‚   β”‚   └── App.tsx              # Main app component
β”‚   β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ package.json
β”‚   └── tsconfig.json
β”‚
β”œβ”€β”€ devshield-backend/           # Node.js TypeScript Backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ controllers/         # Request handlers
β”‚   β”‚   β”œβ”€β”€ models/              # MongoDB schemas
β”‚   β”‚   β”œβ”€β”€ routes/              # API routes
β”‚   β”‚   β”œβ”€β”€ middleware/          # Custom middleware
β”‚   β”‚   β”œβ”€β”€ services/            # Business logic
β”‚   β”‚   β”œβ”€β”€ utils/               # Helper functions
β”‚   β”‚   β”œβ”€β”€ config/              # Configuration files
β”‚   β”‚   β”œβ”€β”€ validators/          # Input validation
β”‚   β”‚   └── server.ts            # Express app setup
β”‚   β”œβ”€β”€ tests/                   # Unit & integration tests
β”‚   β”œβ”€β”€ package.json
β”‚   └── tsconfig.json
β”‚
β”œβ”€β”€ backend/                     # Legacy or alternative backend
β”œβ”€β”€ screenshots/                 # Project screenshots
β”œβ”€β”€ docker-compose.yml           # Container orchestration
β”œβ”€β”€ .gitignore
β”œβ”€β”€ README.md
└── LICENSE

πŸ” Security Architecture

Request Flow

Client Request
    ↓
API Gateway (Express)
    ↓
Rate Limiter (Redis)
    ↓
Authentication (JWT)
    ↓
Input Validation
    ↓
Threat Detection Engine
    ↓
Business Logic
    ↓
Database (MongoDB)
    ↓
Response + Logging

Threat Detection Pipeline

  1. Request Analysis: Parse HTTP headers, body, and parameters
  2. Pattern Matching: Check against known attack signatures
  3. Behavioral Analysis: Compare against user baseline behavior
  4. Risk Scoring: Calculate threat level (0-100)
  5. Action Determination: Allow, block, or flag for review
  6. Logging & Alerting: Record event and notify if critical

πŸ“Š API Endpoints

Authentication

POST   /api/auth/register          # Create new account
POST   /api/auth/login             # User login
POST   /api/auth/logout            # User logout
POST   /api/auth/refresh-token     # Refresh JWT
POST   /api/auth/forgot-password   # Password reset

API Protection

POST   /api/shield/protect         # Enable protection for an API
GET    /api/shield/status          # Check protection status
PUT    /api/shield/config          # Update security rules
DELETE /api/shield/disable         # Disable protection

Threat Management

GET    /api/threats                # List detected threats
GET    /api/threats/:id            # Get threat details
POST   /api/threats/:id/review     # Mark threat as reviewed
POST   /api/threats/:id/whitelist  # Add to whitelist

Analytics

GET    /api/analytics/dashboard    # Dashboard metrics
GET    /api/analytics/timeline     # Threat timeline
GET    /api/analytics/heatmap      # Geographic threat map
GET    /api/analytics/export       # Export security reports

WebSocket Events

connect                            # Client connection
threat:detected                    # Real-time threat alert
metrics:update                     # Live dashboard update
attack:blocked                     # Attack prevention notification

πŸ§ͺ Testing

Run Backend Tests:

cd devshield-backend
npm test                # Run all tests
npm run test:watch      # Watch mode
npm run test:coverage   # Coverage report

Run Frontend Tests:

cd devshield-frontend
npm test

End-to-End Tests:

npm run test:e2e

πŸ“ˆ Performance & Scalability

  • Request Processing: <50ms average latency
  • Threat Detection: <100ms analysis time
  • WebSocket Updates: <10ms real-time delivery
  • Horizontal Scaling: Load balancer ready
  • Database Optimization: Indexed queries, connection pooling
  • Caching Strategy: Redis for frequently accessed data
  • CDN Integration: Static asset delivery optimization

🌐 Deployment

Production Checklist

  • Environment variables configured
  • Database backups automated
  • SSL/TLS certificates installed
  • Rate limiting configured
  • Monitoring alerts set up
  • Logging infrastructure ready
  • Security headers enabled
  • CORS policies configured
  • API documentation published

Recommended Platforms

  • Frontend: Vercel, Netlify, AWS Amplify
  • Backend: AWS EC2, DigitalOcean, Heroku, Render
  • Database: MongoDB Atlas, AWS DocumentDB
  • Cache: Redis Cloud, AWS ElastiCache
  • Monitoring: Datadog, New Relic, Sentry

πŸ”„ CI/CD Pipeline

GitHub Actions workflow automatically:

  • βœ… Runs TypeScript type checking
  • βœ… Executes unit and integration tests
  • βœ… Performs security vulnerability scanning
  • βœ… Builds production bundles
  • βœ… Deploys to staging/production
  • βœ… Runs smoke tests post-deployment

🀝 Contributing

We welcome contributions! 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 AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Development Guidelines:

  • Write TypeScript (strict mode)
  • Follow ESLint/Prettier configuration
  • Write tests for new features
  • Update documentation
  • Follow conventional commits

πŸ—ΊοΈ Roadmap

Phase 1 (Current)

  • Core API protection
  • Basic threat detection
  • Real-time dashboard
  • User authentication

Phase 2 (In Progress)

  • Machine learning-based anomaly detection
  • Advanced DDoS mitigation
  • Multi-region deployment
  • Custom rule engine

Phase 3 (Planned)

  • Mobile app (React Native)
  • Blockchain-based audit logs
  • AI-powered threat prediction
  • Integration marketplace

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ‘©β€πŸ’» Author

Diya


πŸ™ Acknowledgments

  • OWASP Top 10 security guidelines
  • Node.js security best practices
  • Open-source security community
  • Contributors and supporters

πŸ“ž Support & Contact


⭐ If you find DevShield useful, please consider starring the repository!

πŸ›‘οΈ Securing APIs, one request at a time.

About

πŸ›‘οΈ Enterprise cybersecurity SaaS platform β€’ Real-time API protection & attack detection β€’ React/TypeScript frontend β€’ Node.js backend β€’ MongoDB β€’ WebSocket threat visualization.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors