An open API service indexing awesome lists of open source software.

https://github.com/cnstr/api

The API for Canister (version 2)
https://github.com/cnstr/api

docker kubernetes postgres rust tide typesense

Last synced: 6 months ago
JSON representation

The API for Canister (version 2)

Awesome Lists containing this project

README

          

# Canister API

> The API for Canister (version 2)

![Build Status](https://img.shields.io/github/actions/workflow/status/cnstr/ci/api.yaml)
[![Codacy](https://img.shields.io/codacy/grade/d7ce92011567411a85f69098196e961e)](https://www.codacy.com?utm_source=github.com&utm_medium=referral&utm_content=cnstr/api&utm_campaign=Badge_Grade)
![Uptime](https://img.shields.io/website?down_message=offline&label=status&up_message=online&url=https%3A%2F%2Fapi.canister.me%2Fv2%2Fhealthz)
![Release](https://img.shields.io/github/v/tag/cnstr/api?label=release&cacheSeconds=3600)
![License](https://img.shields.io/github/license/cnstr/api?cacheSeconds=3600)

This project hosts the Canister API and accompanying services.

It is written in Rust and utilizes various crates such as:

- [`axum`](https://github.com/tokio-rs/axum) for the web server
- [`reqwest`](https://github.com/seanmonstar/reqwest) for the HTTP client
- [`prisma`](https://prisma.io) for the database client (via [`prisma-client-rs`](https://github.com/Brendonovich/prisma-client-rust))

The API is deployed on Kubernetes and is accessible [here](https://api.canister.me/v2/).

If you're interested in the API documentation, you can find it [here](https://docs.canister.me).

### Development

This project utilizes [`task`](https://taskfile.dev) and `docker compose` for a development environment.

In order to populate the databases, [`cnstr/core`](https://github.com/cnstr/core) needs to be setup and run once.

The project also requires the Rust toolchain installed and `cargo-watch` installed (`cargo install cargo-watch`).

Once you have setup everything, running `task dev` will start the API with hot-reloading and the databases.

### Deployment

*This project isn't intended to be deployed by anyone other than the maintainers.*

*When deployed, the project is relicensed under a proprietary license.*

The `task deploy` command will trigger the [CI/CD at `cnstr/ci`](https://github.com/cnstr/ci/actions/workflows/api.yaml).

The deployment will run the following steps:

- Build and publish the Docker image to Google Artifact Registry (gcr.io)
- Distribute and upload the OpenAPI reference to [bump.sh](https://bump.sh)
- Rewrite the `kubernetes/api.yaml` file with the new image tag
- Apply the new deployment to the cluster

> Copyright (c) 2023, Aarnav Tale