Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scylladb/shopping-cart
Sample ecommerce shopping cart app with ScyllaDB and Python
https://github.com/scylladb/shopping-cart
api cassandra ecommerce fastapi nosql python scylladb
Last synced: about 1 month ago
JSON representation
Sample ecommerce shopping cart app with ScyllaDB and Python
- Host: GitHub
- URL: https://github.com/scylladb/shopping-cart
- Owner: scylladb
- License: apache-2.0
- Created: 2024-02-07T12:22:06.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-07-18T18:34:44.000Z (4 months ago)
- Last Synced: 2024-09-30T04:02:58.945Z (about 2 months ago)
- Topics: api, cassandra, ecommerce, fastapi, nosql, python, scylladb
- Language: Python
- Homepage: https://shopping-cart.scylladb.com/
- Size: 350 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Ecommerce API - ScyllaDB & FastAPI sample application
This is a sample ecommerce application built with [ScyllaDB](https://www.scylladb.com/) and [FastAPI](https://fastapi.tiangolo.com/).## Prerequisites
* [CQLSH](https://cassandra.apache.org/doc/stable/cassandra/tools/cqlsh.html)
* Python 3
* [ScyllaDB Cloud account](https://cloud.scylladb.com)## Get started
Clone the repository:
```
git clone https://github.com/zseta/shopping-cart
cd shopping-cart
```## Create database schema
Connect to your ScyllaDB Cloud cluster using CQLSH and create the schema:
```
cqlsh -u scylla -p -f schema.cql xxxx.xxxx.xxxx.clusters.scylla.cloud
```## Set up API server
Create a new virtual environment:
```
virtualenv env
source env/bin/activate
```Install Python requirements (FastAPI with Uvicorn server and ScyllaDB driver):
```
pip install fastapi "uvicorn[standard]" scylla-driver
```Modify `config.py` to match your database credentials:
```python
HOST="node-0.aws-us-east-1.xxxx.clusters.scylla.cloud"
USER="scylla"
PASSWORD="xxxxxx"
DATACENTER="AWS_US_EAST_1"
KEYSPACE="ecommerce"
```Run the server:
```
uvicorn main:app --reload
```Visit API docs: http://127.0.0.1:8000/docs
![fast api docs](images/apidocs.png)