Skip to content

Phrygia

“Phrygia where golden dreams do weave ’neath Midas’ realm, in splendor never to deceive.“

This a documentation for the Airdrop API. It consists of one application: - api that serves various namespaces, we have a Swagger documentation for it

Stack

  • python 3.12
  • FastApi - Framework to build JSON APIs with automatically generated documentation (following OpenAPI standard)
  • gunicorn - Web server that wraps a web application, processes requests, keeps individual processes running

CI

Deployment is done via Github Workflows in several steps:

  1. The whole application is built into a Docker container
  2. Docker is pushed to the AWS Docker registry
  3. Deployment differs depending on the environment:
    • On staging we launch the container on a EC2 instance
    • On production we launch API in Fargate to have an isolated infra

Project layout

mkdocs.yml           # The configuration file.
docs/     
    index.md         # The documentation homepage.
    ...              # Other markdown pages, images and other files.

app/                 # application logic is stored here
    clients/         # folder that stores clients for external services (eg. Solana RPC bindings)
    core/            # stores configuration and core variables for the application
    helpers/         # helpers that are used in the app
    middleware/      # stores middlewares - functions that do some actions in-between request-response cycle
    api.py           # API endpoints
    main.py          # main entrypoint of the API application, Gunicorn specifically launches this script
    run.py           # entrypoint to launch application locally
    schemas.py       # API Request/Response Schemas
migrations/          # database migrations, scripts that add or delete tables to the database
prisma_extensions/   # extensions for the ORM that we use to connect to the database
tests/               # unit-tests folder
Makefile             # commands to perform various actions
backend_pre_start.py # a script that checks whether db is connected, should be launched before app launch
gunicorn_conf.py     # config for Gunicorn - application web server