Skip to content

stekolla/p2-backend

Repository files navigation

Pier 2 Imports Backend API

Overview

This is a FastAPI-based backend system for managing customer orders, billing, and shipping information for Pier 2 Imports. It includes API endpoints for retrieving order history, performing analytics, and ensuring no duplicate customer records.

Requirements

  • Docker & Docker Compose
  • Python 3.8+

Setup Instructions

1. Clone the Repository

git clone https://github.com/stekolla/p2-backend.git
cd p2-backend

2. Create a .env File

Create a .env file in the root directory of the project using .env.local as an example.

3. Build and Run with Docker Compose

docker-compose up --build

This will start the FastAPI backend and a PostgreSQL database container.

4. Access the API

Once running, the API will be available at http://localhost:8000/

For more complex examples, see the examples folder.

Other Tasks

1. Run Tests

To run unit tests inside the container:

docker-compose exec api pytest

2. Seed the Database

To seed the database with some fake data for local use:

docker-compose exec api python app/database_seed.py

3. Create a DB Migration

To create a new DB migration:

docker-compose exec api alembic revision --autogenerate -m "Your message here"

Migrations will be applied automatically when the API container starts, or you can apply them manually after creating them.

4. Apply Migrations

To apply any new database migrations:

docker-compose exec api alembic upgrade head

5. Access the Database

To access the database directly:

docker-compose exec db psql -U <user> -d <database>

My Process

See PROCESS.md for an overview of my process building this out.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published