Instructions for installing Archetype's Python SDK with WSGI Backends

What is Archetype

Archetype is a powerful, reliable purchase server with cross-platform support. Our open-source framework provides a backend and a wrapper around Stripe to make implementing API keys and creating quotas and subscriptions easy.


FastAPI Backend:

Step 1: Install and Import Archetype

First install the package with PIP

pip install archetypewsgi

or add below line to the end of your requirements.txt

from archetypewsgi.fastapi import authorized
import archetypewsgi as archetype
from fastapi import FastAPI, Depends

app = FastAPI()
archetype.app_id = "ARCHETYPE_APP_ID"
archetype.secret_key = "ARCHETYPE_SECRET_KEY"

async def root(is_authorized = Depends(authorized)):
    return {"message": "Hello World"}

if __name__ == "__main__":
    import uvicorn, debug=True, host="", port=3000)

Step 2: Set up Archetype

Initialize your codebase with Archetype

Once you've installed the package you can modify your or initialization of your WSGI app from this.

from flask import Flask

app  =  Flask(__name__,  static_folder="web/build",  static_url_path="/")

Now you need to import and actually integrate Archetype into your initialization step.

Archetype will be created as a Middleware service that lives asynchronously to your main function run so it's non-blocking.

from flask import Flask
from Archetype import Archetype, ArchetypeWSGI

Now that you've finished installing Archetype, head on over to the Configuring SDK pages to learn the next steps on basic usage!