Skip to main content

SimpleRestAPI is the library for launch REST API based on your SQLAlchemy models

Project description


SimpleRestAPI is the library for launch REST API based on your SQLAlchemy models.



  • Minimum code. You don't need create any endpoints. All of you need is your SQLAlchemy models.
  • You can customize your endpoints. For example, you can deny some methods or customize the endpoint's path.
  • Under hood SimpleApi use Starlette.


pip install simplerestapi

Also you need install uvicorn.

pip install uvicorn


  1. Create
from sqlalchemy import Column, Integer, String, create_engine
from sqlalchemy.ext.declarative import declarative_base

from simplerestapi.endpoint import ConstructEndpoint, Endpoint

Base = declarative_base(metaclass=ConstructEndpoint)

class CustomUser(Base, Endpoint):
    id = Column(Integer, primary_key=True)
    name = Column(String)
    surname = Column(String)
    age = Column(Integer)

class Car(Base, Endpoint):
    id = Column(Integer, primary_key=True)
    name_model = Column(String)
    production = Column(String)
    year = Column(Integer)
  1. Create
import os

import uvicorn

import models
from simplerestapi.main import SimpleApi

app = SimpleApi(models, db='postgresql://db_user:db_pass@')
  1. Run application
uvicorn --reload
INFO:     Uvicorn running on (Press CTRL+C to quit)
INFO:     Started reloader process [250901] using statreload
INFO:     Started server process [250903]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
  1. Use REST API
    You can use methods GET, POST, PUT, PATCH, DELETE in endpoints:
  • - GET for retrieve list of models.Car items, support filters, example ?name=SomeName, POST for create new item in DB.
  • - GET for retrieve one item with id=1, also you can use PUT, PATCH for update item, DELETE for delete item from DB.

Similar endpoints are availible for all you models.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for simplerestapi, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size simplerestapi-1.0.1-py3-none-any.whl (7.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size simplerestapi-1.0.1.tar.gz (8.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page