Skip to content

Commit

Permalink
Changed database
Browse files Browse the repository at this point in the history
  • Loading branch information
kudah99 committed Dec 28, 2023
1 parent fd37068 commit 28e3d2c
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .env_example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DB_NAME=admin
DB_USER=postgres
DB_PASSWORD=1234
DB_HOST=127.0.0.1
DB_PORT=5432
DB_ENGINE=postgresql
84 changes: 82 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,82 @@
# e-commerce-mockup-api
Ecommerce mock-ap api for Zimbabwean products brands
<h1 align="start">
<br>
Fake Ecommerce Backend API
</h1>



## :bulb: About

The [Fake Ecommerce Backend API](https://www.ecommercefakeapi.co) is a free tool designed to expedite ecommerce frontend development by providing a simulated backend experience. This API enables developers to commence work on the frontend and test functionalities that depend on backend responses. Built with Python FastAPI for exceptional performance, this API offers a range of features for managing products, store categories, carts, and user-related operations.
## Features

### Products API

- ```Get All Products:``` Retrieve a list of all available products.
- ```Get Product by ID:``` Fetch details of a specific product using its unique identifier.
- ```Get Products by Category ID:``` Obtain a list of products belonging to a particular category.

### Categories API

- ```Get All Categories:``` Retrieve a list of all store categories.
- ```Get Category by ID:``` Fetch details of a specific store category.

### Cart API

- ```Get All Carts:``` Retrieve a list of all shopping carts.
- ```Get Cart by ID:``` Fetch details of a specific shopping cart.
- ```Update Cart by ID:``` Modify the contents of a shopping cart.
- ```Delete Cart by ID:``` Remove a shopping cart.

### User API

- ```Get All Users:``` Retrieve a list of all users.
- ```Get User by ID:``` Fetch details of a specific user.
- ```Authentication (Login and Sign Up):``` Secure user authentication using email and password.

## Documentation

Explore the API documentation and access usage code snippets on our [official website](https://www.ecommercefakeapi.co/).

## Tools

1. **Python Version**: 3.9 and above
2. **Web Framework**: FastAPI 0.99.1
3. **Database Integration**:
- Postgres DB: Version 6.21 and above
- Migration handled with Alembic
4. **Dependency Injection Framework**: Utilizing dependency-injector
- Adhering to the service-repository pattern

## Getting Started

1. Clone the repository.
2. Install dependencies.

```bash
git clone https://github.com/kudah99/fake-ecommerce-backend-api
cd fake-ecommerce-backend-api
pipenv install or pip install -r requirements.txt
```
3. Database migrations
> **Note:** Use [.env_example](https://github.com/kudah99/fake-ecommerce-backend-api/edit/main/.env_example) as a sample for your .env:
1. `alembic upgrade head`: apply every migrations
2. `alembic downgrade base`: rollback every migrations
3. `alembic revision --autogenerate -m "revision_name"`: create new migration
4. `alembic history`: get alembic revision history

4. Run the API server.

```bash
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
```
5. How to run with Docker?

* Ensure you have Docker installed and running on your machine.
```
docker-compose up --build
```

## License

This project is licensed under the [MIT License](LICENSE).

0 comments on commit 28e3d2c

Please sign in to comment.