Combining modern FastAPI backend with elegant Persian frontend design
π Quick Start β’ β¨ Features β’ π Documentation β’ π οΈ Development
|
|
π³ Option 1: Docker (Recommended)
# π₯ Clone the repository
git clone https://github.com/yourusername/Fast-api-shop-app.git
cd Fast-api-shop-app
# π Launch with one command
docker-compose up --build
# β
That's it! Your app is runningπ Access your application:
- π Persian Frontend: http://localhost
- π API Documentation: http://localhost:8000/docs
- ποΈ Database: Automatically created and ready
π» Option 2: Local Development
# π Setup Python environment
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # macOS/Linux
# π¦ Install dependencies
cd backend
pip install -r requirements.txt
# βοΈ Configure environment
copy .env.example .env # Windows
# cp .env.example .env # macOS/Linux
# π― Launch the application
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000π Open your browser to:
- π Frontend: http://localhost (serve index.html with a web server)
- π API: http://localhost:8000/docs
π‘ Pro Tip: The Docker option sets up everything automatically, including the database!
| π¨ Persian-First Design | π¦ Smart Inventory | π Secure & Simple | π Business Intelligence |
|---|---|---|---|
| RTL interface with Persian fonts | Real-time stock tracking | JWT authentication | Live dashboard analytics |
| Bootstrap 5 responsive design | Automated inventory updates | Role-based access control | Sales performance reports |
| Cultural color schemes | Low stock alerts | Password security | Inventory valuation |
| Mobile-optimized navigation | Multi-category organization | Request logging | Business insights |
graph LR
A[Persian Frontend] --> B[FastAPI Backend]
B --> C[PostgreSQL DB]
B --> D[Authentication]
B --> E[Product Management]
B --> F[Order Processing]
B --> G[Analytics Dashboard]
style A fill:#e1f5fe
style B fill:#f3e5f5
style C fill:#e8f5e8
- ποΈ Complete E-commerce Flow - From product display to order completion
- π± Responsive Design - Works perfectly on desktop, tablet, and mobile
- π Real-time Updates - Inventory changes reflect immediately
- π Growth Ready - Scalable architecture for business expansion
βββββββββββββββββββββββ ββββββββββββββββββββββββ βββββββββββββββββββββββ
β π¨ Persian Frontend βββββΊβ β‘ FastAPI Backend βββββΊβ ποΈ PostgreSQL DB β
β β β β β β
β β’ RTL Bootstrap 5 β β β’ Python 3.12+ β β β’ Direct Tables β
β β’ Persian Fonts β β β’ SQLAlchemy ORM β β β’ Auto-Creation β
β β’ Responsive Design β β β’ JWT Security β β β’ No Migrations β
β β’ Mobile Optimized β β β’ Request Logging β β β’ Simple & Clean β
βββββββββββββββββββββββ ββββββββββββββββββββββββ βββββββββββββββββββββββ
|
|
|
π― Design Philosophy: Simplicity without sacrificing functionality. Every component serves a clear purpose.
Fast-api-shop-app/
βββ assets/fonts/ # Persian fonts (Lalezar, IranianSans)
βββ index.html # Main Persian frontend
βββ style.css # Persian typography & styling
βββ pages/ # Additional pages (about, etc.)
βββ backend/app/ # FastAPI application
β βββ main.py # App entry point
β βββ models/ # Database models
β βββ routes/ # API endpoints
β βββ auth/ # Authentication
βββ docker-compose.yml # Docker configuration
βββ Makefile # Development commands
π Interactive API Documentation Available at /docs
All endpoints are automatically documented with request/response examples
POST /signup # π€ User registration with validation
POST /login # π JWT token authentication |
Security Features:
|
GET /products # π List all products with pagination & search
POST /products # β Create new product with validation
GET /products/{id} # π Get detailed product information
PUT /products/{id} # βοΈ Update product details & stock
DELETE /products/{id} # ποΈ Remove product from inventoryGET /sales-orders # π List orders with filters & status
POST /sales-orders # ποΈ Create new sales order
GET /sales-orders/{id} # π Get complete order details
PUT /sales-orders/{id} # π Update order status & trackingGET /dashboard/stats # π Real-time business metrics
GET /dashboard/low-stock # β οΈ Products needing restock
GET /reports/sales-summary # π Sales performance analysisπ‘ Try it Live: Visit
/docsto test all endpoints with the interactive Swagger UI!
π Quick Development Commands
# π§ Setup everything
make setup # Install dependencies & setup environment
# πββοΈ Run development server
make serve # Start with auto-reload
# π³ Docker development
make run-docker # Run full stack with Docker
# π§Ή Cleanup
make clean # Remove cache files & cleanupβοΈ Environment Configuration
Create a .env file based on .env.example:
# ποΈ Database Configuration
DATABASE_URL=postgresql://user:password@localhost:5432/nmarket_db
# π Security Settings
SECRET_KEY=your-super-secret-key-here-make-it-long-and-random
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
# π Development Settings
DEBUG=True
ENVIRONMENT=development
# πͺ Shop Configuration
SHOP_NAME=N-Market
SHOP_EMAIL=your-shop@example.comMIT License - Feel free to use this project for your business needs!
See the LICENSE file for full details.