GraphQL API for customers, accounts and transactions data.
Built with:
- MongoDB
- Motor
- FastAPI
- Ray Serve
- Strawberry
- Navigate into the deploy folder from the project root folder (i.e. customer-data-service-api/deploy)
cd deploy
- Create a .env file with the following terminal command
touch .env
- Generate an access key with the following terminal command
openssl rand -hex 16
- Add the following key-value pairs into the .env file
NUM_REPLICAS=2
APP_PORT=8000
RAY_DASHBOARD_PORT=8265
FIXTURES_SEED=0
NUM_CUSTOMERS=100
NUM_ACCOUNTS=300
NUM_TRANSACTIONS=5000
MONGO_HOST=mongo
MONGO_INITDB_ROOT_USERNAME=<your mongodb username>
MONGO_INITDB_ROOT_PASSWORD=<your mongodb password>
CUSTOMERS_DATABASE=customers_data
CUSTOMERS_COLLECTION=customers
ACCOUNTS_COLLECTION=accounts
TRANSACTIONS_COLLECTION=transactions
ACCESS_KEY=<your generated access key>
- Build docker image and start containers
docker compose up -d --build
- Navigate to the following urls to access the respective services
URL | Service |
---|---|
http://localhost:8000/graphql | GraphiQL |
http://localhost:8000/docs | SwaggerUI |
http://localhost:8000/redoc | Redoc |
http://localhost:8265/#/overview | Ray dashboard |
-
Navigate to project root folder (i.e. customer-data-service-api)
-
Install the necessary dependencies
pip install -r requirements-dev.txt
- Execute unittests
coverage run -m pytest -v
- Check test coverage
coverage report -m --fail-under=95