Skip to content

crydensync/crydensync-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 

Repository files navigation

crydensync-ai - AI-Powered Auth Intelligence

Status License Go Version AI Privacy

πŸ”— Quick Links


🎯 Purpose

AI-powered analytics, security, and automation for CrydenSync.

Natural language queries. Anomaly detection. Smart rate limiting. Security audits.

Ask your user database in plain English. Get answers instantly. Respect privacy.


πŸ“Š Status

  • Phase: Planning
  • Progress: 0%
  • Target: After cryden v1.0.0

πŸ—ΊοΈ Roadmap

v0.1.0 - Basic Queries (Month 1)

  • Natural language to SQL parser
  • Basic count queries
  • Date range filters
  • Aggregation (sum, avg, max, min)
  • CLI interface (csax ai query)

v0.2.0 - Intelligence (Month 2)

  • Anomaly detection
  • Smart rate limiting
  • Security audit automation
  • Test case generation
  • Setup wizard

v0.3.0 - Analytics (Month 3)

  • User behavior analytics
  • Trend detection
  • Predictive insights
  • Export to CSV/JSON
  • Scheduled reports

v0.4.0 - Automation (Month 4)

  • Auto-remediation
  • Smart alerts
  • Webhook triggers
  • Custom rules engine

v1.0.0 - Production (Month 6)

  • Admin UI dashboard
  • API endpoints
  • Full documentation
  • 90% test coverage
  • Performance benchmarks

✨ AI Features

1. Natural Language Queries

$ csax ai query "show me total users from Lagos, Nigeria"

πŸ“Š Results: 1,247 users from Lagos

$ csax ai query "users who logged in with Google OAuth last week"

πŸ“‹ 89 users found:
- john@gmail.com (Jan 15)
- amara@gmail.com (Jan 14)
- chidi@gmail.com (Jan 13)

$ csax ai query "MFA adoption rate by region"

🌍 MFA Adoption:
Lagos: 47%
Nairobi: 52%
Cairo: 38%
Cape Town: 61%
  1. Anomaly Detection
// AI learns normal behavior
detector := ai.NewAnomalyDetector()

// Detects unusual patterns:
// - Login from new country
// - Unusual login time (3 AM)
// - Rapid failed attempts
// - Different device/browser

risk := detector.Analyze(loginEvent)
if risk > 0.8 {
    // Trigger MFA, send alert
}
  1. Smart Rate Limiting
// Traditional: static 5 attempts/minute
// AI-powered: adaptive based on behavior

limiter := ai.NewAdaptiveRateLimiter()

// Normal user: 5/min
// Suspicious: 2/min
// Trusted device: 10/min
// API call: 100/min
  1. Security Audit Automation
$ csax ai audit

πŸ€– Scanning auth configuration...

❌ CRITICAL: JWT secret is default
❌ CRITICAL: Rate limiting disabled
⚠️ WARNING: Password policy too weak

πŸ”§ Auto-fix? [Y/n]: Y

βœ… Fixed: Generated secure secret
βœ… Fixed: Enabled rate limiting
βœ… Fixed: Updated password policy

πŸ›‘οΈ Security score: 95/100
  1. Test Case Generation
$ csax ai test

πŸ€– Generating auth tests...

βœ… Generated: 15 login test cases
βœ… Generated: 12 signup test cases
βœ… Generated: 8 session test cases
βœ… Generated: 6 rate limit test cases

πŸ“ Edge cases covered:
- SQL injection attempts
- Brute force patterns
- Token expiry scenarios
  1. Natural Language Audit Logs
$ csax ai logs "show me suspicious activity this week"

πŸ€– Analyzing 12,847 log entries...

🚨 3 Suspicious Events:

1. usr_123 - 15 failed logins (brute force)
2. usr_456 - Login from 2 countries (token theft)
3. IP 45.67.89.12 - 1000 requests (DDoS)

πŸ”§ Actions taken:
- Blocked IP
- Locked accounts
- Sent alerts
  1. Setup Wizard
$ csax ai setup

πŸ€– Cryden AI Setup Assistant

Q: What database are you using?
A: PostgreSQL

Q: Need email verification?
A: Yes

Q: Social login providers?
A: Google, GitHub

✨ Generating configuration...

βœ… Created: config/auth.yaml
βœ… Created: .env.example
βœ… Created: docker-compose.yml
  1. Smart Documentation
$ csax ai docs

πŸ€– Generating API documentation...

βœ… docs/api/auth.md
βœ… docs/api/tokens.md
βœ… examples/login.md
βœ… examples/signup.md

πŸ”„ Auto-updates when code changes!

πŸ—οΈ Architecture

graph TB
    subgraph Input
        A[CLI Command]
        B[API Request]
        C[Admin UI]
    end
    
    subgraph AI Engine
        D[NLP Parser]
        E[Query Builder]
        F[Privacy Filter]
        G[Anomaly Detector]
    end
    
    subgraph Storage
        H[Database]
        I[Cache]
        J[Logs]
    end
    
    subgraph Output
        K[Results]
        L[Alerts]
        M[Reports]
    end
    
    A --> D
    B --> D
    C --> D
    
    D --> E
    E --> F
    F --> H
    F --> I
    F --> J
    
    G --> H
    G --> L
    
    H --> K
    I --> K
    J --> K
Loading

πŸ”§ Development

# Clone
git clone https://github.com/crydensync/crydensync-ai
cd crydensync-ai

# Install dependencies
go mod download

# Setup local AI model (optional)
./scripts/setup-ai.sh

# Run tests
go test ./...

# Start CLI
go run cmd/ai/main.go

πŸ“¦ Dependencies

Component Technology Purpose Local AI Ollama, Llama.cpp Privacy-first NLP Embeddings Sentence transformers Similarity search Anomaly detection Isolation Forest Security monitoring NLP parsing Transformers Natural language Optional cloud OpenAI API Enhanced AI (opt-in)


πŸ”’ Privacy & Security

**CrydenSync AI is privacy-first:**

βœ… **Local models** - Your data never leaves your server
βœ… **PII redaction** - Email, phone, IP never exposed
βœ… **Permission-aware** - Role-based access control
βœ… **Opt-in cloud** - OpenAI only if you choose
βœ… **Audit trail** - All queries logged
βœ… **GDPR compliant** - No data retention without consent

**Not:**
❌ Data harvesting
❌ Black box decisions
❌ Vendor lock-in

πŸ“Š Example Queries

User Analytics

csax ai query "total users by region"
csax ai query "daily active users this month"
csax ai query "user growth trend last 6 months"
csax ai query "users who signed up but never logged in"

Security Monitoring

csax ai query "suspicious login attempts last hour"
csax ai query "users with rate limit violations"
csax ai query "MFA adoption rate"
csax ai query "failed logins by country"

Compliance

csax ai query "GDPR data requests this quarter"
csax ai query "users who consented to marketing"
csax ai query "inactive users over 90 days"
csax ai query "data export requests by month"

Business Intelligence

csax ai query "most popular OAuth provider"
csax ai query "user retention by cohort"
csax ai query "login frequency distribution"
csax ai query "preferred login time of day"

🎯 Success Metrics

Metric Target Query response time < 2 seconds Accuracy 95% Privacy compliance 100% User adoption 50% of Cryden users Test coverage 90%+


πŸ†˜ Getting Help


🀝 Contributing

We welcome contributions! Please:

  1. Read CONTRIBUTING.md
  2. Check open issues
  3. Join Discord

We need AI/ML engineers, Go developers, and security experts!

Current needs:

Β· 🧠 NLP parsing implementation Β· πŸ” Anomaly detection models Β· πŸ”’ Privacy filter design Β· πŸ§ͺ Test generation logic Β· πŸ“Š Analytics dashboard (React) Β· πŸ“ Documentation

First Time Contributor?

Look for issues labeled:

Β· good-first-issue Β· ai-models Β· documentation

We'll help you make your first PR!


πŸš€ Future Enhancements

Β· Predictive analytics Β· Auto-remediation actions Β· Custom ML models Β· Real-time anomaly detection Β· Natural language alerts Β· Voice commands Β· Slack/Discord integration


πŸ“„ License

MIT Β© CrydenSync

AI features are optional. Core auth remains free and open source forever.


Built with ❀️ in Nigeria, for developers everywhere.

Smart auth. Privacy-first. AI-powered.

🌍 WhatsApp Community | 🐦 Twitter | πŸ’¬ Discord

About

AI-powered analytics, security, and automation for CrydenSync.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors