A SEAI college project demonstrating a cloud resource management system with real AI (Claude), persistent storage, a policy engine, ML demand forecasting, and a full admin panel with role management.
| Area | Original | Upgraded |
|---|---|---|
| Storage | In-memory lists (resets on restart) | JSON file-backed (persistent) |
| Secret key | Hardcoded fallback | secrets.token_hex random fallback |
| Admin role | Self-assignable via form | Server-side only; first user auto-promoted; admins promote/demote |
| Input validation | int() with no error handling |
_safe_int() with bounds checking |
| AI Optimizer | Hardcoded lookup table | Real Claude API — free-text → structured recommendation |
| AI Assistant | None | Full multi-turn chat widget (sidebar) |
| Violation analysis | None | AI explains rejection + suggests compliant alternative |
| ML model | Linear regression | Linear regression + R² score reported |
| Cost tracking | None | Estimated monthly cost per resource |
| Resource types | 3 | 5 (+ Database, Kubernetes Cluster) |
| Role management | None | Admin promote/demote UI |
- Backend: Python Flask 3
- Frontend: HTML + Tailwind CSS + Vanilla JS
- Storage: JSON file-based (thread-safe)
- ML: scikit-learn Linear Regression
- AI: Anthropic Claude (claude-sonnet-4-20250514)
- Auth: bcrypt + Flask sessions
pip install -r requirements.txtSet your Anthropic API key (required for AI features):
export ANTHROPIC_API_KEY=sk-ant-...Optionally set a stable secret key for sessions:
export SECRET_KEY=your-random-secret-herepython app.pyApp runs at http://127.0.0.1:5000
Register an account — the first registered user automatically becomes admin. All subsequent registrations are regular users. Admins can promote/demote from the Admin Panel.
Describe your workload in plain English. Claude returns:
- Optimal resource type, CPU, RAM, storage, region
- Reasoning explanation
- Monthly cost estimate
- Policy compliance warnings
- Practical tips
Click the robot icon in the sidebar for a multi-turn chat assistant. Aware of your resources and violations. Answers questions about cloud infrastructure, costs, sizing, and policy rules.
Click "Explain" on any rejected request. Claude explains why it was rejected and suggests a fully compliant alternative configuration.
cppe/
├── app.py # Flask routes + auth + API endpoints
├── policy_engine.py # Configurable policy validation
├── data_storage.py # Thread-safe JSON file storage
├── ml_model.py # Linear regression demand forecaster
├── ai_advisor.py # Claude API integration (optimize, chat, analyze)
├── requirements.txt
├── data/ # Auto-created; holds users.json etc.
└── templates/
├── base.html # Layout + AI chat widget
├── login.html
├── register.html # No role selection (security fix)
├── dashboard.html # Stats, charts, ML forecast
├── request_resource.html
├── my_resources.html # With per-resource cost estimate
├── violations.html # With AI explanation button
├── optimizer.html # Real AI optimizer
└── admin.html # Users, resources, role management
| Rule | Limit |
|---|---|
| Max CPU | 4 cores |
| Max RAM | 8 GB |
| Max Storage | 100 GB |
| Allowed Regions | Asia, India |
| Allowed Types | Virtual Machine, Storage, Container, Database, Kubernetes Cluster |
- Register (first account = auto admin)
- Log in
- Open AI Optimizer → describe a workload → get recommendation
- Open AI Assistant (sidebar robot icon) → ask a question
- Request Resource → submit a valid config → see it provisioned
- Submit a violating config → see it rejected
- Go to Violations → click "Explain" → see AI analysis
- Visit Dashboard → click "Run Model" → see 7-day ML forecast
- Visit Admin Panel → manage users, resources, roles