- FastApi is built on a Python framework called Starlette which is a lightweight ASGI framework/toolkit, which is itself built on Uvicorn.
- Ideal for building high performance asyncio services with seriously impressive performance.
- That why DogeAPI is here, an API with high performance built with FastAPI & SQLAlchemy, help to improve connection with your Backend Side and stay relate using
SQLite3
& a secure Schema Based on Python-Jose a JavaScript Object Signing and Encryption implementation in Python.
- fastapi : FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.
- uvicorn : Uvicorn is a lightning-fast ASGI server implementation, using uvloop and httptools.
- sqlalchemy : SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL.
- passlib : Passlib is a password hashing library for Python 2 & 3, which provides cross-platform implementations of over 30 password hashing algorithms, as well as a framework for managing existing password hashes.
- bcrypt : Good password hashing for your software and your servers.
- python-jose : The JavaScript Object Signing and Encryption (JOSE) technologies - JSON Web Signature (JWS), JSON Web Encryption (JWE), JSON Web Key (JWK), and JSON Web Algorithms (JWA) - collectively can be used to encrypt and/or sign content using a variety of algorithms.
- python-multipart : streaming multipart parser for Python.
- With a simple steps you can install DogeAPI.
- clone the repository:
git clone https://github.com/yezz123/DogeAPI.git
- Create & activate a python3 virtual environment (optional, but very recommended).
- Install requirements:
pip install -r requirements.txt
uvicorn main:app --reload
- Port already in use? Close the other app, or use a difference port:
uvicorn main:app --port 8001 --reload
- If you want to Set environment variables you need to check token.py and use :
- To get a string like this.
SECRET_KEY = "a4ee1c733a80a5ac8824ac21b90ee6ae0158aee6642880fb2675929f99b1a677"
ALGORITHM = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES = 30
- I Use a simple Model to implement with Database & the default configuration.
- This for the Blog Table
class Blog(Base):
__tablename__ = "blogs"
id = Column(Integer, primary_key=True,index=True)
title = Column(String)
body = Column(String)
user_id = Column(Integer, ForeignKey("users.id"))
creator = relationship("User", back_populates="blogs")
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True,index=True)
name = Column(String)
email = Column(String)
password = Column(String)
blogs = relationship("Blog", back_populates="creator")
- For database i use
SQLAlchemy.ORM
to create a sessions.
SessionLocal = sessionmaker(bind=engine, autocommit=False, autoflush=False)
Base = declarative_base()
- Read CONTRIBUTING.md
- Contributions are welcome!
- Please share any features, and add unit tests! Use the pull request and issue systems to contribute.