A simple full-stack web application for creating, editing, listing, and deleting virtual machines — complete with user and package management. This is a mock system using in-memory and file-based storage, designed to demonstrate RESTful API design, React integration, and practical UI design with Material UI (MUI).
- Create, edit, and delete VMs
- Assign users (normal or sudoers) from a mock Active Directory
- Select installed RPM packages from a predefined list
- View all VMs in a structured, interactive table
- Responsive, modern UI using Material UI (MUI v6+)
- Fully mocked backend — no real VMs are provisioned
- Data persisted to a local
vm_data.jsonfile
- Python 3.8+
- Node.js 18+
- npm 9+
vm-provisioning/
├── backend/
│ ├── main.py # FastAPI app
│ ├── models.py # Pydantic data models
│ ├── storage.py # File-based storage and mock data
│ └── vm_data.json # JSON file where VM data is saved
│
├── frontend/
│ ├── src/
│ │ ├── App.js
│ │ ├── VMFormModal.js
│ │ └── VMList.js
│ └── package.json
│
├── requirements.txt
└── README.md
- React
- Axios (HTTP requests)
- Material UI (UI components)
cd vm-provisioning # Project root
python -m venv env
source env/bin/activate # On Windows: env\Scripts\activate
pip install -r requirements.txt
<<<<<<< HEAD
uvicorn backend.main:app --reload
=======
uvicorn main:app --reload
>>>>>>> c4968dab3140eda188a07e881b21922a193eb793
⚠️ Important: Do not runuvicornfrom inside thebackend/folder, or you'll get a relative import error. Always run from the project root and usebackend.main:app.
The API will be available at: http://localhost:8000
cd frontend
npm install
npm startFrontend will open at: http://localhost:3000
| Method | Endpoint | Description |
|---|---|---|
| GET | /vms |
List all VMs |
| GET | /vms/{id} |
Get a VM by ID |
| POST | /vms |
Create a new VM |
| PUT | /vms/{id} |
Update a VM by ID |
| DELETE | /vms/{id} |
Delete a VM by ID |
| GET | /mock/ad-users |
Mock AD user list |
| GET | /mock/packages |
Mock list of RPM packages |
-
The backend simulates a virtualization and user management environment.
-
No external services are used. Data is loaded from and saved to
vm_data.json. -
The UI includes a modal form for both create and edit, with:
- dropdowns for CPU, RAM, Disk
- multi-select checklists for users and packages
-
User entries include
is_sudoersupport, toggleable from the UI -
Form field layouts follow MUI v6+ grid specifications (
size={{ xs: 12, sm: 6 }})
- Users are mocked as normal or sudoers from a simulated "Active Directory"
- Packages come from a simulated repository
- VM provisioning is stubbed — no actual VM is created
All interfaces are fake but follow realistic structures for integration with real services.