Grid
Connect to any MySQL, PostgreSQL, or SQLite database to automatically expose your table schemas as secure, type-safe REST endpoints.
From database to REST API with a single command
Fusio Grid turns an existing MySQL/MariaDB, PostgreSQL or SQLite database into a secure REST API, similar to tools like PostgREST. It reads your database schema and creates schemas, actions and CRUD operations for every table.
Because everything is generated as regular Fusio entities, you can edit the result in the Fusio backend and get all gateway features like authentication, rate limiting, OpenAPI and SDK generation on top. Once your requirements grow beyond plain CRUD, you can extend every operation with custom logic, there is no lock-in.
# expose the ecommerce database under /ecommerce php bin/fusio grid:setup ecommerce \ --driver=pdo_mysql \ --host=127.0.0.1 \ --dbname=ecommerce_prod \ --user=db_user \ --password=secret_pass \ --prefix=app_ \ --no-interaction # or let the command guide you interactively php bin/fusio grid:setup
Key features
Skip the boilerplate and get a production-ready API for your existing data in minutes.
Instant REST endpoints
Full CRUD endpoints (GET, POST, PUT, DELETE) for every table under /{connection}/{table}.
Type-safe schemas
Columns, types and nullability are reflected into TypeSchema definitions which validate all incoming requests.
Pagination, filtering & sorting
Collection endpoints support paging, sorting and filtering through query parameters out of the box.
Secure by default
All generated operations are private. Access is controlled through API keys, OAuth2 scopes, rate limits and logging.
OpenAPI & SDKs
Generate an OpenAPI specification or client SDKs for TypeScript, PHP, Python, Java, Go, C# and more.
CI/CD friendly
Configure everything through terminal prompts or headless via CLI options, i.e. inside a Docker entrypoint. Re-runs pick up new tables and keep your changes.
The generated API
For a connection named inventory with an items table, Grid creates the following operations:
| Method | Path | Operation | Description |
|---|---|---|---|
| GET | /inventory/items | inventory.items.getAll | List rows (paginated) |
| GET | /inventory/items/:id | inventory.items.get | Fetch a row by primary key |
| POST | /inventory/items | inventory.items.create | Create a row |
| PUT | /inventory/items/:id | inventory.items.update | Update a row by primary key |
| DELETE | /inventory/items/:id | inventory.items.delete | Delete a row by primary key |
Collection query parameters
startIndex/count– offset and number of rows to returnsortBy/sortOrder– column and direction (ASCorDESC)filterBy/filterValue– column and value to filter onfilterOp–contains,equals,startsWithorpresent
GET /inventory/items?count=2&sortBy=name&filterBy=name&filterOp=contains&filterValue=chair
{
"totalResults": 12,
"itemsPerPage": 2,
"startIndex": 0,
"entry": [
{"id": 3, "name": "Arm chair", "price": 199.9},
{"id": 7, "name": "Office chair", "price": 249}
]
}
dfe8502080cba0dd700504d41e3ee0c1f0511742