This project is a backend microservice for managing risk matrices, companies, users, and related entities. It is built with FastAPI and uses PostgreSQL as the database via SQLAlchemy.
- REST API for managing:
- Companies
- Users (with authentication)
- Risk matrices
- Risks
- Impact and probability values
- Affected objectives and phases
- Mitigation actions
- Objective types
- CORS enabled for easy integration with frontends.
- Database migrations handled automatically at startup.
- Authentication endpoint for user login.
Back_matriz/
│
├── app/
│ ├── crud.py # Database operations
│ ├── database.py # Database connection and models base
│ ├── main.py # FastAPI application and endpoints
│ ├── models.py # SQLAlchemy models
│ ├── schemas.py # Pydantic schemas
│ └── __init__.py
│
├── requirements.txt # Python dependencies
├── Procfile # For deployment (e.g., Heroku)
└── README.md
- Clone the repository and navigate to the
Back_matrizdirectory. - Install dependencies:
pip install -r requirements.txt
- Set up your PostgreSQL database. The default connection string is in
app/database.py.
You can run the API locally with:
uvicorn app.main:app --reloadOr, if deploying (e.g., on Heroku), the Procfile is already configured:
web: uvicorn app.main:app --host=0.0.0.0 --port=8000
The API exposes endpoints for CRUD operations on all main entities. Example endpoints:
GET /empresas/- List companiesPOST /usuarios/- Create userPOST /login- User authenticationGET /matrices/- List matrices- ...and more for risks, impacts, probabilities, objectives, phases, mitigations, etc.
- FastAPI
- SQLAlchemy
- PostgreSQL
- Pydantic
- Uvicorn
Specify your license here.