This is the API used by NOM.
Check what's the tech stack being used for the API and how to start it locally.
Major tech being used:
- Python
- MongoDB
- Docker
- FastAPI
We're using Python 3.9+. Make sure you're using the same version, or use Docker to run this.
If you prefer using Docker for development, clone the repo and simply run:
docker compose up --build
Otherwise, you can follow these steps:
- Clone the repo
git clone [email protected]:NewShadesDAO/api.git
- Install
poetry
– dependency management tooling for Python (see full installation documentation for additional options)curl -sSL https://install.python-poetry.org | python3 - # Note: add `export PATH="~/Library/Python/3.9/bin:$PATH"` to your shell configuration file.
- Install packages
poetry install
- Setup local .env file
cp .env.template .env
- Run the server
poetry run uvicorn app.main:app --host 0.0.0.0 --port 5001 --reload
You can run all tests by running poetry run pytest
on the shell or via docker:
docker exec -it <container_id> pytest
Make sure you replace <container_id>
with the container running the API.
Go to /docs
to find the API documentation. Locally: http://localhost:5001/docs
- Add Insomnia shared workspace
Pull requests are welcome. For major changes, please open an issue first or ping a core member in discord (#development) to discuss what you would like to change.
Please make sure to update tests as appropriate.
To run both linters and tests locally you can do:
docker compose exec web mypy . && flake8 && black . && isort .
docker compose exec web pytest -rf
If you're not using docker, remove the docker compose exec web
part.