Skip to content

adgator101/ExpireEye-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExpireEye Backend

FastAPI Python SQLAlchemy

Project Structure

ExpireEye-backend/
├── 📁 app/
│   ├── 📁 core/               # Core settings, config, security
│   ├── 📁 db/                 # Database session & configuration
│   ├── 📁 models/             # SQLAlchemy ORM models
│   │   ├── user_model.py      # User database model
│   │   ├── product_model.py   # Product database model
│   │   └── user_product.py    # User-Product relationship model
│   ├── 📁 routers/            # FastAPI route handlers
│   │   ├── auth.py            # Authentication endpoints
│   │   ├── warehouse.py       # Product management endpoints
│   │   └── user_inventory.py  # User inventory endpoints
│   ├── 📁 schemas/            # Pydantic request/response models
│   │   └── auth_schema.py     # Authentication schemas
│   ├── 📁 utils/              # Utility functions
│   │   ├── jwt.py             # JWT token utilities
│   │   └── errors.py          # Custom error handlers
│   ├── main.py                # FastAPI application entrypoint
│   └── dependencies.py        # Dependency injection
├── 📁 alembic/                # Database migrations
├── requirements.txt           # Python dependencies
├── .env.example              # Environment variables template
├── alembic.ini               # Alembic configuration
└── README.md                 # Project documentation

Quick Start

Prerequisites

  • Python 3.8+
  • MySQL/PostgreSQL database
  • Virtual environment (recommended)

1. Clone & Setup

git clone https://github.com/adgator101/ExpireEye-backend
cd ExpireEye-backend

# Create virtual environment
python -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

2. Environment Configuration

Create a .env file from the template:

cp .env.example .env

3. Database Setup

# Run database migrations
alembic upgrade head

4. Start the Server

uvicorn app.main:app --reload

Your server is now running!


Database Management

For handling database migrations Alembic is used here. Below are the command and steps:

1. Initialize Alembic (only once)

alembic init alembic

2. Generate a New Migration

Autogenerate migration scripts based on your models:

alembic revision --autogenerate -m "Migration message"

3. Apply Migrations

Upgrade your database to the latest revision:

alembic upgrade head

4. Downgrade (if needed)

Revert the last migration:

alembic downgrade -1

5. Alembic Configuration

  • Edit alembic.ini for DB connection settings if needed.
  • Edit alembic/env.py to set up model imports and metadata.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •