Skip to content

Niyama - Comprehensive Policy as Code Platform with AI-powered policy generation using Google Gemini, brutalist UI design, and compliance mapping

Notifications You must be signed in to change notification settings

adhit-r/niyama-policy-as-code

Repository files navigation

Niyama - Policy as Code Platform

CI/CD Pipeline Security Scan Test Coverage

🎯 Production-Ready Policy as Code Platform

Niyama is a comprehensive Policy as Code platform built with modern technologies and best practices. The system has been developed using a multi-agent approach with 5 specialized agents, resulting in a production-ready platform with advanced AI capabilities, comprehensive testing, and full observability.

πŸš€ Key Features

AI-Powered Policy Generation

  • Advanced Google Gemini integration for intelligent policy generation
  • Compliance framework mapping (SOC2, HIPAA, GDPR)
  • Policy optimization and performance analytics
  • Intelligent recommendations and security insights

Multi-Tenant Architecture

  • Fine-grained RBAC with organization-specific roles
  • JWT authentication with refresh token support
  • Permission-based access control
  • Scalable user and organization management

Comprehensive Testing

  • 80%+ test coverage across frontend and backend
  • Cross-browser E2E testing with Playwright
  • Performance testing with k6
  • Security scanning and quality gates

Production-Ready Infrastructure

  • Kubernetes manifests with monitoring
  • Docker containers optimized for security
  • CI/CD pipeline with automated testing
  • Prometheus/Grafana observability stack

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend      β”‚    β”‚   Backend       β”‚    β”‚   AI Service    β”‚
β”‚   (React + TS)  │◄──►│   (Go + Gin)    │◄──►│   (Gemini API)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚                       β”‚
         β”‚                       β”‚                       β”‚
         β–Ό                       β–Ό                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Nginx         β”‚    β”‚   PostgreSQL    β”‚    β”‚   Redis Cache   β”‚
β”‚   (Static)      β”‚    β”‚   (Database)    β”‚    β”‚   (AI Cache)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Technology Stack

Frontend

  • React 18 with TypeScript
  • Vite for fast development and building
  • Tailwind CSS for styling
  • React Query for state management
  • Vitest for unit testing
  • Playwright for E2E testing

Backend

  • Go 1.21 with Gin framework
  • GORM for database ORM
  • PostgreSQL for primary database
  • Redis for caching and sessions
  • JWT for authentication
  • Testify for testing

DevOps & Infrastructure

  • Docker with multi-stage builds
  • Kubernetes for orchestration
  • GitHub Actions for CI/CD
  • Prometheus for monitoring
  • Grafana for visualization
  • k6 for performance testing

AI & Analytics

  • Google Gemini API for policy generation
  • Compliance framework mapping
  • Policy performance analytics
  • Intelligent recommendations

πŸ“ Project Structure

niyama/
β”œβ”€β”€ backend-go/           # Go backend service
β”‚   β”œβ”€β”€ internal/
β”‚   β”‚   β”œβ”€β”€ config/       # Configuration management
β”‚   β”‚   β”œβ”€β”€ database/     # Database connection and models
β”‚   β”‚   β”œβ”€β”€ handlers/     # HTTP handlers
β”‚   β”‚   β”œβ”€β”€ middleware/   # Authentication and RBAC
β”‚   β”‚   β”œβ”€β”€ models/       # Data models
β”‚   β”‚   └── services/     # Business logic
β”‚   └── main.go
β”œβ”€β”€ frontend/             # React frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/   # Reusable components
β”‚   β”‚   β”œβ”€β”€ pages/        # Page components
β”‚   β”‚   β”œβ”€β”€ services/     # API services
β”‚   β”‚   └── test/         # Test setup
β”‚   └── package.json
β”œβ”€β”€ k8s/                  # Kubernetes manifests
β”œβ”€β”€ tests/                # E2E and performance tests
β”œβ”€β”€ .github/workflows/    # CI/CD pipeline
└── docs/                 # Documentation

πŸš€ Quick Start

Prerequisites

  • Go 1.21+
  • Node.js 18+
  • Docker
  • Kubernetes cluster (optional)

Development Setup

  1. Clone the repository

    git clone https://github.com/adhit-r/niyama-policy-as-code.git
    cd niyama-policy-as-code
  2. Start the backend

    cd backend-go
    go mod download
    go run main.go
  3. Start the frontend

    cd frontend
    npm install
    npm run dev
  4. Access the application

Docker Deployment

# Build and run with Docker Compose
docker-compose up -d

Kubernetes Deployment

# Apply Kubernetes manifests
kubectl apply -f k8s/

πŸ§ͺ Testing

Run Tests

# Frontend tests
cd frontend
npm run test

# Backend tests
cd backend-go
go test ./...

# E2E tests
npx playwright test

# Performance tests
k6 run tests/performance/load-test.js

Test Coverage

  • Frontend: 80%+ coverage with Vitest
  • Backend: 80%+ coverage with Go testing
  • E2E: Cross-browser testing with Playwright
  • Performance: Load testing with k6

πŸ”’ Security

  • Authentication: JWT with refresh tokens
  • Authorization: RBAC with fine-grained permissions
  • Security Scanning: OWASP ZAP, gosec, npm audit
  • Container Security: Non-root users, minimal images
  • Network Security: Kubernetes network policies

πŸ“Š Monitoring

  • Metrics: Prometheus for metrics collection
  • Visualization: Grafana dashboards
  • Logging: Structured logging with slog
  • Health Checks: Kubernetes health probes
  • Alerting: Prometheus alerting rules

πŸ€– AI Capabilities

  • Policy Generation: AI-powered policy creation
  • Compliance Mapping: Automated compliance framework mapping
  • Performance Analytics: Policy performance insights
  • Recommendations: Intelligent optimization suggestions
  • Security Insights: Automated security recommendations

πŸ“ˆ Performance

  • Frontend: Optimized with React.memo and useMemo
  • Backend: Connection pooling and caching
  • Database: Optimized queries with GORM
  • Caching: Redis for AI responses and sessions
  • CDN: Static asset optimization

πŸ›‘οΈ Compliance

  • SOC2: Security and availability controls
  • HIPAA: Healthcare data protection
  • GDPR: Data privacy and protection
  • Custom Frameworks: Extensible compliance mapping

πŸ“š Documentation

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure all tests pass
  6. Submit a pull request

πŸ“„ License

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

πŸŽ‰ Acknowledgments

This project was developed using a multi-agent approach with 5 specialized agents:

  • Agent 1: Backend Infrastructure Specialist
  • Agent 2: Frontend & UI Specialist
  • Agent 3: DevOps & Infrastructure Specialist
  • Agent 4: Testing & Quality Specialist
  • Agent 5: AI & Advanced Features Specialist

πŸ“ž Support

For support and questions:

  • Create an issue on GitHub
  • Check the documentation
  • Review the troubleshooting guide

Status: βœ… Production Ready
Version: 1.0.0
Last Updated: 2024

About

Niyama - Comprehensive Policy as Code Platform with AI-powered policy generation using Google Gemini, brutalist UI design, and compliance mapping

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published