
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
prism-py is a Python library for automatic API generation from database schemas. It creates a complete REST API that mirrors your database structure, handling tables, views, functions, and procedures with proper type safety and validation.
Built on top of FastAPI, prism-py eliminates boilerplate code and provides a comprehensive type system for API development, allowing you to focus on business logic instead of API structure.
Note: This library is part of the Prism ecosystem, which includes prism-ts, a TypeScript client library that consumes prism-py APIs with full type safety.
VARCHAR(50)
).pip install prism-py
Here's a minimal example to get you started:
from fastapi import FastAPI
from prism import ApiPrism, PrismConfig, DbClient, DbConfig, PoolConfig, ModelManager
# Initialize FastAPI app
app = FastAPI()
# Configure database connection
db_client = DbClient(
config=DbConfig(
db_type="postgresql",
driver_type="sync",
database="yourdb",
user="username",
password="password",
host="localhost",
port=5432,
pool_config=PoolConfig(
pool_size=5,
max_overflow=10,
pool_pre_ping=True
)
)
)
# Create model manager with selected schemas
model_manager = ModelManager(
db_client=db_client,
include_schemas=["public", "app"]
)
# Initialize API generator
api_prism = ApiPrism(
config=PrismConfig(
project_name="My API",
version="1.0.0",
description="Auto-generated API for my database"
),
app=app
)
# Generate all routes
api_prism.generate_all_routes(model_manager)
# Print welcome message with API documentation link
api_prism.print_welcome(db_client)
prism-py automatically creates the following types of routes:
POST /{schema}/{table}
- Create a recordGET /{schema}/{table}
- Read records with filteringPUT /{schema}/{table}
- Update recordsDELETE /{schema}/{table}
- Delete recordsGET /{schema}/{view}
- Read from view with optional filteringPOST /{schema}/fn/{function}
- Execute database functionPOST /{schema}/proc/{procedure}
- Execute stored procedureGET /dt/schemas
- List all database schemas and structureGET /dt/{schema}/tables
- List all tables in a schemaGET /dt/{schema}/views
- List all views in a schemaGET /dt/{schema}/functions
- List all functions in a schemaGET /dt/{schema}/procedures
- List all procedures in a schemaGET /health
- Get API health statusGET /health/ping
- Basic connectivity checkGET /health/cache
- Check metadata cache statusPOST /health/clear-cache
- Clear and reload metadata cacheSee the examples directory for complete sample applications:
prism-py is part of the Prism ecosystem, designed to create a seamless bridge between your database and type-safe client applications:
Together, these libraries enable end-to-end type safety and eliminate boilerplate code across your full stack.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Automatic API generator that creates a REST API mirror of a database
We found that prism-py demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.