A high-performance Delivery API built with FastAPI. This project provides authentication, product management, and order processing features using JWT-based security.
- 🔐 JWT Authentication (Access & Refresh tokens)
- 👤 User registration & login
- 📦 Product management (Admin only)
- 🛒 Order creation and management
- 🔄 Order status updates
- 🧾 Role-based access control (Admin / User)
- ⚡ FastAPI automatic documentation
- FastAPI
- PostgreSQL
- SQLAlchemy
- Pydantic
- fastapi-jwt-auth
- Werkzeug (password hashing)
project/
├── demo_images/
│ ├── swagger1.png
│ ├── swagger2.png
├── main.py
├── auth_routes.py
├── order_routes.py
├── product_routes.py
├── models.py
├── schemas.py
├── database.py
├── init_db.py
├── config.py
├── requirements.txt
├── .env
├── .env.example
├── .gitignore
└── README.md
Create a .env file in the root directory:
# Database Configuration
DB_USER=postgres_user
DB_PASSWORD=your_password
DB_HOST=localhost
DB_PORT=5432
DB_NAME=delivery_db
# Application Configuration
SECRET_KEY=your_secret_key_here_min_32_characters
SQL_ECHO=False
git clone https://github.com/ulugbekbackend/Delivery-project-API.git
cd Delivery-project-APIpython -m venv venv
source venv/bin/activate # Linux / Mac
venv\Scripts\activate # Windowspip install -r requirements.txtCREATE DATABASE delivery_db;uvicorn main:app --reloadAfter running the server:
- Swagger UI: 👉 http://127.0.0.1:8000/docs
POST /auth/signup
POST /auth/login
Response:
{
"access": "token",
"refresh": "token"
}GET /auth/login/refresh
POST /product/createGET /product/listGET /product/{id}PUT /product/{id}/updatePATCH /product/{id}/updateDELETE /product/{id}/delete
POST /order/makeGET /order/list(Admin only)GET /order/{id}(Admin only)GET /order/user/ordersGET /order/user/order/{id}PUT /order/{id}/updatePATCH /order/{id}/update-statusDELETE /order/{id}/delete
| Role | Permissions |
|---|---|
| User | Create & manage own orders |
| Admin | Manage products & view all orders |
PENDINGIN_TRANSITDELIVERED
.env faylida:
SQL_ECHO=True- Passwords are hashed using Werkzeug
- JWT authentication for all protected routes
- Role-based authorization
- Only admin users (
is_staff=True) can manage products - Users can only modify their own orders
- Orders can only be deleted if status is
PENDING
Ulugbek Yuldoshev - Python Backend Engineer | Full Stack Developer
- GitHub: @ulugbekbackend
- WebSite: Ulugbekdev.uz
- Linkedin: @ulugbekdev
- Email: yuldoshevulugbek2004@gmail.com
Pull requests are welcome. For major changes, please open an issue first.
This project is open-source and available under the MIT License.

