A Flask-based e-commerce platform for Solberg Honung, featuring product management, shopping cart functionality, and admin dashboard.
- 🛍️ Product catalog with categories
- 🛒 Shopping cart functionality
- 🔐 GitHub OAuth admin authentication
- 📱 Responsive design with Bootstrap 5
- 🔒 Admin dashboard for product and category management
- 🖼️ Product image upload with local storage
- 🔍 Image zoom viewer on product pages
- 💰 Price management in SEK
- 📦 Stock tracking
- Backend: Python/Flask
- Frontend: HTML, CSS (Bootstrap 5), JavaScript
- Database: SQLite (development) with Flask-SQLAlchemy
- Migrations: Flask-Migrate (Alembic)
- Authentication: GitHub OAuth for admin access
- File Storage: Local storage for product images
- Icons: Font Awesome 6
sh_shop/
├── sh_webshop/ # Main application package
│ ├── static/
│ │ ├── css/
│ │ │ └── style.css # Custom styles
│ │ └── uploads/
│ │ └── products/ # Uploaded product images
│ ├── templates/
│ │ ├── admin/
│ │ │ ├── categories/ # Category management templates
│ │ │ └── products/ # Product management templates
│ │ ├── cart/
│ │ │ └── view.html # Shopping cart page
│ │ ├── products/
│ │ │ ├── index.html # Product listing
│ │ │ └── detail.html # Product detail with image zoom
│ │ ├── base.html # Base template
│ │ ├── home.html # Home page
│ │ ├── about.html # About page
│ │ ├── biodling.html # Beekeeping products
│ │ └── far_och_lamm.html # Sheep & lamb products
│ ├── __init__.py # Application factory
│ ├── admin.py # Admin routes and image upload
│ ├── models.py # Database models
│ ├── cart.py # Shopping cart functionality
│ ├── products.py # Product routes
│ ├── about.py # About page routes
│ ├── biodling.py # Beekeeping category routes
│ ├── far_och_lamm.py # Sheep & lamb category routes
│ ├── home.py # Home page routes
│ ├── utils.py # Utility functions
│ ├── commands.py # CLI commands
│ └── config.py # Configuration (uploads, OAuth)
├── migrations/ # Database migrations (Alembic)
├── instance/ # Instance-specific files
│ └── sh_shop.db # SQLite database
├── main.py # Application entry point
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker Compose configuration
├── requirements.txt # Python dependencies
├── env.example # Example environment variables
├── VERSION # Application version
└── README.md
-
Clone the repository:
git clone [email protected]:valyo/sh_webshop.git cd sh_webshop
-
Set up environment variables:
cp env.example .env # Edit .env with your configuration -
Build and start the containers:
docker-compose up --build
The application will be available at http://localhost:8088
To stop the application:
docker-compose downFor development:
docker-compose up --build -d # Run in detached mode
docker-compose logs -f # View logs-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
cp env.example .env # Edit .env with your configuration -
Initialize the database:
flask db upgrade
-
Run the application:
flask run
Create a new migration:
# Using Docker
docker-compose exec web flask db migrate -m "migration message"
# Local development
flask db migrate -m "migration message"Apply migrations:
# Using Docker
docker-compose exec web flask db upgrade
# Local development
flask db upgrade| Variable | Description |
|---|---|
SECRET_KEY |
Flask secret key for sessions |
DATABASE_URL |
Database connection URL |
GITHUB_CLIENT_ID |
GitHub OAuth client ID |
GITHUB_CLIENT_SECRET |
GitHub OAuth client secret |
Admin authentication uses GitHub OAuth. To grant admin access:
- Configure GitHub OAuth credentials in
.env - Add admin users to the
Admintable with their GitHub ID
- Supported formats: PNG, JPG, JPEG, GIF, WebP
- Maximum file size: 16MB
- Images are stored in
sh_webshop/static/uploads/products/ - Unique filenames are generated to prevent collisions
The application uses semantic versioning. The version is stored in the VERSION file.
Images are tagged with:
- Full version (e.g.,
v1.0.0) - Version with Git SHA (e.g.,
v1.0.0-a1b2c3d) - Latest tag (for main branch)
- Update the
VERSIONfile following semantic versioning - Commit and push the changes
- GitHub Action will automatically build and tag the new version
docker pull ghcr.io/valyo/sh_webshop:v1.0.0- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License
Copyright (c) 2025 Solberg Honung
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For any inquiries, please contact the repository owner.