This is my backend API project for an e-commerce system built with FastAPI and PostgreSQL.
It supports user authentication, product management, categories, and order processing, while storing information within a PostgreSQL database.
- Python
- FastAPI
- PostgreSQL
- SQLAlchemy
- OAuth2
- JWT Authentication
- Uvicorn
- Docker
- Pytest
- User registration and OAuth2 login
- JWT authentication
- Password hashing
- CRUD operations for users
- CRUD operations for products
- CRUD operations for categories
- CRUD operations for orders
- CRUD operations for order items
- Relational database design
- Input validation with Pydantic
- API testing with Pytest
- Docker containerization
- Deployment on Render
- Python 3.13+
- PostgreSQL
- Docker (optional)
ecommerce/
│
├── main.py
├── requirements.txt
├── .gitignore
├── .dockerignore
├── .env
├── Dockerfile
├── docker-compose.yml
├── README.md
│
├── tests/
│ ├── __init__.py
│ ├── test_auth.py
│ ├── test_users.py
│ ├── test_orders.py
│ ├── test_orderitems.py
│ ├── test_products.py
│ └── test_categories.py
│
└── src/
│
├── auth/
│ ├── hashing.py
│ ├── jwt_handler.py
│ └── dependencies.py
│
├── database/
│ └── database.py
│
├── models/
│ ├── base.py
│ ├── users.py
│ ├── orders.py
│ ├── orderitems.py
│ ├── products.py
│ └── categories.py
│
├── schemas/
│ ├── users.py
│ ├── orders.py
│ ├── orderitems.py
│ ├── products.py
│ └── categories.py
│
└── routers/
├── users.py
├── orders.py
├── orderitems.py
├── products.py
├── categories.py
└── auth.py
DATABASE_URL=your_database_url
SECRET_KEY=your_secret_key
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30Set the same environment variables inside the Render Dashboard under:
Dashboard → Your Service → Environment
git clone https://github.com/EmilianoPadilla/ecommerce.gitpython -m venv venvsource venv/bin/activatevenv\Scripts\activatepip install -r requirements.txtuvicorn src.main:app --reloadThis API is deployed on Render:
https://emilianopadilla-ecommerce-backend.onrender.com/
FastAPI Swagger documentation:
https://emilianopadilla-ecommerce-backend.onrender.com/docs
POST /loginGET /users
POST /users
GET /users/{user_id}
PUT /users/{user_id}
PATCH /users/{user_id}
DELETE /users/{user_id}GET /orders
POST /orders
GET /orders/{order_id}
PUT /orders/{order_id}
PATCH /orders/{order_id}
DELETE /orders/{order_id}GET /orderitems
POST /orderitems
GET /orderitems/{orderitem_id}
PUT /orderitems/{orderitem_id}
PATCH /orderitems/{orderitem_id}
DELETE /orderitems/{orderitem_id}GET /products
POST /products
GET /products/{product_id}
PUT /products/{product_id}
PATCH /products/{product_id}
DELETE /products/{product_id}GET /categories
POST /categories
GET /categories/{category_id}
PUT /categories/{category_id}
PATCH /categories/{category_id}
DELETE /categories/{category_id}POST /users{
"username": "string",
"email": "string",
"password": "string"
}This project was built as part of a backend learning roadmap focused on FastAPI, authentication, testing, Docker, and deployment.