Skip to content

veerdosi/secure-flow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

121 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SecureFlow AI πŸ›‘οΈ

Real-time AI-powered security analysis platform for GitLab projects

SecureFlow AI Dashboard

πŸš€ Overview

SecureFlow AI continuously monitors your GitLab projects for security vulnerabilities using advanced AI analysis. Get real-time threat detection, interactive 3D threat models, and automated remediation suggestions with approval workflows.

✨ Key Features

  • πŸ€– Gemini AI Analysis - Google's Gemini Pro analyzes code for security vulnerabilities
  • ⚑ Real-Time Monitoring - GitLab webhooks trigger instant analysis on code pushes
  • 🎯 Interactive 3D Threat Models - Visualize attack surfaces and data flows with Three.js
  • πŸ“Š Live Security Dashboard - Real-time scores, threat levels, and vulnerability feeds
  • πŸ”§ Automated Remediation - AI-generated fix suggestions with approval workflows
  • πŸ“ˆ Compliance Tracking - OWASP, PCI, SOX, GDPR compliance scoring
  • πŸ” User Authentication - Secure JWT-based auth with Google OAuth integration
  • πŸ“± Responsive Design - Modern Next.js frontend with Tailwind CSS and Framer Motion
  • πŸ”” Smart Notifications - Email alerts for critical vulnerabilities

πŸ—οΈ Architecture

GitLab Webhook β†’ Express API β†’ Gemini AI β†’ MongoDB β†’ Next.js Dashboard
      ↓              ↓            ↓         ↓            ↓
  Code Push  β†’  AI Analysis  β†’  Results  β†’  Storage  β†’  Visualization

πŸ› οΈ Tech Stack

Frontend

  • Next.js 14 - React framework with app router and TypeScript
  • Tailwind CSS - Utility-first styling with cyber theme
  • Framer Motion - Smooth animations and transitions
  • Three.js - 3D threat model visualizations
  • Chart.js & Recharts - Security metrics and data visualization
  • Zustand - State management

Backend

  • Node.js/Express - REST API server with TypeScript
  • MongoDB/Mongoose - NoSQL database with ODM
  • Gemini AI - Google's generative AI for code analysis
  • GitLab API - Repository integration and webhooks
  • JWT & bcrypt - Authentication and password hashing
  • Nodemailer - Email notifications
  • Node-cron - Scheduled analysis tasks

DevOps & Deployment

  • Vercel - Frontend hosting with serverless functions
  • Render - Backend API hosting
  • MongoDB Atlas - Cloud database
  • GitHub Actions - CI/CD pipeline

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn
  • MongoDB (local or Atlas)
  • Gemini API key
  • GitLab API token

1. Clone & Install

git clone <repository-url>
cd secure-flow
npm install

2. Environment Setup

Copy .env.example to .env and configure:

# Database (required)
MONGODB_URI=mongodb://localhost:27017/secure-flow
# or MongoDB Atlas: mongodb+srv://user:pass@cluster.mongodb.net/secure-flow

# JWT Authentication (required)
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production

# Gemini AI (required) - Get from: https://aistudio.google.com/app/apikey
GEMINI_API_KEY=AIzaSyC...your-gemini-api-key-here
GEMINI_MODEL=gemini-pro

# Google OAuth (optional)
GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-google-client-secret
NEXT_PUBLIC_GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com

# API Configuration
NEXT_PUBLIC_API_URL=http://localhost:3001
CLIENT_URL=http://localhost:3000

Note: GitLab tokens are configured per-user in the app, not environment variables.

3. Database Setup

Local MongoDB:

# macOS
brew install mongodb/brew/mongodb-community
brew services start mongodb/brew/mongodb-community

# Ubuntu/Debian
sudo apt install mongodb
sudo systemctl start mongodb

MongoDB Atlas (recommended):

  1. Create account at MongoDB Atlas
  2. Create cluster and get connection string
  3. Update MONGODB_URI in .env

4. Development

# Start both frontend and backend
npm run dev

# Or individually:
npm run dev:client  # Next.js frontend (port 3000)
npm run dev:api     # Express backend (port 3001)

5. User Setup

  1. Register: Create account at http://localhost:3000
  2. GitLab Integration: Profile β†’ Settings β†’ Add GitLab token
  3. Add Projects: Dashboard β†’ Add GitLab Project β†’ Configure webhooks

πŸ”§ Project Structure

secure-flow/
β”œβ”€β”€ client/                 # Next.js frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/    # React components
β”‚   β”‚   β”œβ”€β”€ pages/         # Next.js pages
β”‚   β”‚   β”œβ”€β”€ hooks/         # Custom hooks
β”‚   β”‚   β”œβ”€β”€ types/         # TypeScript types
β”‚   β”‚   └── utils/         # Utility functions
β”‚   └── package.json
β”œβ”€β”€ api/                   # Express backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ models/        # MongoDB models
β”‚   β”‚   β”œβ”€β”€ routes/        # API routes
β”‚   β”‚   β”œβ”€β”€ services/      # Business logic
β”‚   β”‚   β”œβ”€β”€ middleware/    # Express middleware
β”‚   β”‚   └── utils/         # Helper functions
β”‚   └── package.json
β”œβ”€β”€ cloud-functions/       # Serverless functions
β”‚   └── webhook-handler/   # GitLab webhook handler
└── package.json          # Workspace root

πŸš€ Deployment

Automated Deployment

The project includes deployment configurations for:

Frontend (Vercel):

# Vercel deployment is automatic on git push
# Configure environment variables in Vercel dashboard

Backend (Render):

# Uses render.yaml configuration
# Set environment variables in Render dashboard:
# - MONGODB_URI
# - JWT_SECRET
# - GEMINI_API_KEY
# - CORS_ORIGIN (your Vercel URL)

Manual Deployment

# Build everything
npm run build

# Deploy client to Vercel
cd client && vercel deploy

# Deploy API to Render or your hosting provider
cd api && npm run build

πŸ“ API Endpoints

Authentication

POST /api/auth/register    # User registration
POST /api/auth/login       # User login
GET  /api/auth/me          # Get user profile
PUT  /api/auth/profile     # Update profile

Projects

GET    /api/projects           # List user projects
POST   /api/projects           # Add new project
PUT    /api/projects/:id       # Update project
DELETE /api/projects/:id       # Delete project

Analysis

GET  /api/analysis              # List analyses
POST /api/analysis/start        # Start new analysis
GET  /api/analysis/:id          # Get analysis details
GET  /api/analysis/:id/results  # Get analysis results

Webhooks

POST /api/webhooks/gitlab      # GitLab webhook endpoint

Approvals

GET  /api/approval/pending     # Get pending approvals
POST /api/approval/:id/approve # Approve remediation
POST /api/approval/:id/reject  # Reject remediation

πŸ” Security Features

  • JWT Authentication - Secure token-based auth
  • Rate Limiting - Prevents API abuse
  • CORS Protection - Configurable origin restrictions
  • Helmet Security - Security headers
  • Input Validation - Joi schema validation
  • Password Hashing - bcrypt with configurable rounds
  • Environment Isolation - Separate dev/prod configs

πŸ§ͺ Testing

# Run API tests
cd api && npm test

# Type checking
npm run type-check

# Linting
npm run lint

πŸ“ˆ Monitoring & Analytics

  • Real-time Analysis - Live vulnerability scanning
  • Scheduled Scans - Automated periodic analysis
  • Email Notifications - Critical vulnerability alerts
  • Compliance Tracking - OWASP and regulatory compliance
  • Performance Metrics - Analysis timing and success rates

🀝 Contributing

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

πŸ“„ License

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

πŸ†˜ Support

  • Documentation: Check this README and inline code comments
  • Issues: Report bugs via GitHub Issues
  • Email: Contact team for enterprise support

Built with ❀️ using Next.js, Express, MongoDB, and Gemini AI

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors