Small Business Inventory Management System

This is a FastAPI application for managing small business inventory, products, orders, and suppliers.

Features

  • User authentication and authorization
  • Product management
  • Inventory tracking
  • Order processing
  • Supplier management
  • Category organization

API Endpoints

  • /docs - Swagger UI documentation
  • /redoc - ReDoc documentation
  • /health - Health check endpoint
  • /api/v1/auth - Authentication endpoints
  • /api/v1/users - User management
  • /api/v1/products - Product management
  • /api/v1/inventory - Inventory management
  • /api/v1/orders - Order processing
  • /api/v1/suppliers - Supplier management
  • /api/v1/categories - Category management

Running Locally

  1. Install dependencies:

    pip install -r requirements.txt
    
  2. Start the server:

    uvicorn main:app --host 0.0.0.0 --port 8000 --reload
    

Environment Variables

The application uses the following environment variables:

  • SECRET_KEY: Secret key for JWT token generation
  • SERVER_NAME: Server name (e.g., "Inventory Management System")
  • SERVER_HOST: Server host URL (e.g., "https://inventory.example.com")
  • FIRST_SUPERUSER: Email for the first superuser
  • FIRST_SUPERUSER_PASSWORD: Password for the first superuser

Kubernetes Deployment

The application can be deployed using Kubernetes with the provided configuration files in the kubernetes/ directory:

  • deployment.yaml: Deployment configuration (using name prod-pod)
  • service.yaml: Service configuration (using name prod-pod-service)
  • pvc.yaml: Persistent Volume Claim for storage
  • secrets.yaml: Secret configuration for environment variables

Deployment Notes

  • Optimized for reliable scheduling on resource-constrained clusters:

    • Reduced replicas to 1 to ensure easier scheduling
    • Reduced resource requests and limits
    • Changed image pull policy to IfNotPresent to reduce pull issues
    • Added flexible tolerations to run on nodes with any taints
    • Configured node affinity for Linux but as a preference, not a requirement
    • Set empty storageClassName to use the cluster's default storage class
  • If you experience the "pod does not have a host assigned" error:

    • Check that your cluster has available nodes with sufficient resources
    • Verify that the default storage class exists and is working
    • Ensure the specified image exists and is accessible

To deploy:

kubectl apply -f kubernetes/secrets.yaml
kubectl apply -f kubernetes/pvc.yaml
kubectl apply -f kubernetes/deployment.yaml
kubectl apply -f kubernetes/service.yaml

To check the status:

kubectl get pods
kubectl describe pod <pod-name>
kubectl get events --sort-by='.metadata.creationTimestamp'
Description
Project: Small Business Inventory Management System
Readme 59 KiB
Languages
Python 100%