SIXN is a premium, feature-rich, and highly secure e-commerce storefront built with Flask and MongoDB. Designed for maximum visual impact, it integrates Twilio OTP authentication, Razorpay payment gateway, a custom Wallet system for store credit, and Shiprocket automated shipping logistics.
- Key Features
- System Architecture
- Tech Stack
- Environment Configuration
- Installation & Local Setup
- Project Directory Structure
- Security & PII Data Protection
- License
- Dynamic Product Showcase: Responsive sliding hero catalog with custom keyboard/mouse transition controls.
- Integrated Cart Drawer: Accessible side panel cart with real-time subtotal and discount logic.
- Clean Design Language: Curated typography (Syne & Space Grotesk), dark mode aesthetics, and micro-interactions.
- Twilio OTP Integration: Seamless phone-number sign-up and login utilizing SMS verification.
- Robust Session Management: Secure user sessions powered by Flask-Login and bcrypt password-hashing.
- Razorpay Gateway Integration: Direct prepaid checkout flow with signature verification to prevent order tampering.
- Custom Store Wallet: Users can earn store credit, check transaction logs, and perform full or split payments (Wallet + Razorpay).
- Automated Cancellations & Refunds: Cancelling a prepaid order automatically triggers an instant refund request back to the customer's payment source.
- Serviceability Checks: Real-time pin code verification before checkout to check courier availability.
- Smart Courier Selection: Selects the best courier partner based on shipping rates, pickup speeds, and delivery estimates.
- Automated Consignment Creation: Automates order creation, schedules courier pick-up, and generates shipping labels from the admin panel.
- Live Tracking: Customers can check live tracking logs and shipment updates directly from their user dashboard.
- Sales & Product Analytics: High-level charts tracking total users, orders, revenue, and product stock counts.
- Catalog & Inventory Editor: Add, edit, or remove products, manage variant sizes, upload images, and control stock status.
- Custom Coupon Generator: Create percentage or fixed-discount coupon codes with min-spend rules.
- Order Orchestration: Dispatch orders, download shipping invoices, create pickups, or cancel shipments.
- Review & Flag Moderation: Inspect reviews, filter flagged items, and manage customer ratings.
The following diagram illustrates how the core application server interfaces with MongoDB and third-party APIs:
graph TD
Client[Client Web Browser] <-->|HTTPS / HTML, CSS & JS| Server[Flask Application Server]
Server <-->|Secure Query| Mongo[(MongoDB Database)]
Server <-->|PII Encrypt / Decrypt| Crypto[Fernet Symmetric Cryptography]
Server <-->|Send OTP / SMS| Twilio[Twilio SMS API]
Server <-->|Checkout / Auto-Refund| Razorpay[Razorpay API]
Server <-->|Courier Serviceability & Tracking| Shiprocket[Shiprocket API]
- Backend Framework: Python (Flask)
- Authentication & Security: Flask-Login, Flask-Bcrypt, Flask-Limiter, Cryptography (Fernet)
- Database: MongoDB (via PyMongo)
- Payment Processing: Razorpay SDK
- SMS Gateway: Twilio SDK
- Logistics Engine: Shiprocket REST API
- Frontend Technologies: HTML5, Vanilla CSS, JS (ES6), TailwindCSS
Configure the project by creating a .env file in the root directory (use .env.example as a template):
| Key | Description | Example / Value |
|---|---|---|
SECRET_KEY |
Flask session cookie encryption key | a_highly_secure_random_string |
MONGO_URI |
Connection URI for the MongoDB database | mongodb://localhost:27017/sixn |
RAZORPAY_KEY |
Razorpay Merchant Key ID | rzp_test_xxxxxxxxxxxxxx |
RAZORPAY_SECRET |
Razorpay Merchant Key Secret | xxxxxxxxxxxxxxxxxxxxxxxx |
TWILIO_PHONE |
Twilio purchased virtual phone number | +1xxxxxxxxxx |
TWILIO_SID |
Twilio Account SID | ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
TWILIO_TOKEN |
Twilio Auth Token | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
ADMIN_USER_ID |
MongoDB UUID of the system administrator account | user-uuid-xxxx-xxxx |
SHIPROCKET_EMAIL |
Shiprocket merchant email | admin@sixn.com |
SHIPROCKET_PASSWORD |
Shiprocket merchant password | password123 |
SHIPROCKET_PICKUP_LOCATION |
Pickup warehouse name configured in Shiprocket | Primary |
SHIPROCKET_PICKUP_PINCODE |
Pincode of the pickup warehouse | 110046 |
ENCRYPTION_KEY |
Symmetric Fernet key for general database encryption | Base64 URL-safe key |
PHONE_ENCRYPTION_KEY |
Symmetric Fernet key for encrypting user phone numbers | Base64 URL-safe key |
ADDRESS_ENCRYPTION_KEY |
Symmetric Fernet key for encrypting user addresses | Base64 URL-safe key |
Tip
You can generate secure Fernet encryption keys by running the following command in your terminal:
python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"Ensure you have the following installed on your system:
- Python 3.8+
- MongoDB Community Server (running locally on port
27017)
git clone https://github.com/madebyparth/sixn
cd sixn# Windows
python -m venv venv
venv\Scripts\activate
# macOS / Linux
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtCopy .env.example to .env and fill in your actual credentials:
cp .env.example .envSince you are setting up the project with a fresh local MongoDB database, your database will initially be completely empty. If you start the app at this stage, the storefront will have no products, no collections, and no layout banners, resulting in a blank or malfunctioning UI.
To bootstrap your database with default demo data, run the migration seeding script:
python migrate_to_mongo.pyWhat this script does:
- Populates Showcase Catalog: It reads default catalog products from
assets/products.jsonand writes them into your local MongoDBproductscollection, seeding your store with items out-of-the-box. - Configures Homepage Layout: It imports homepage layout configs (slider details, meta banners) from
assets/content.jsonto establish default themes and styling. - Initializes Collection Schemas: It boots empty structures for operational databases (users, orders, ratings, OTP keys, coupons, notifications) so your backend can query and record transactions immediately.
Start the Flask development server:
python app.pyOpen your browser and navigate to http://127.0.0.1:5000.
βββ assets/ # Static design and database seed resources
β βββ user-media/ # User default profile placeholders
β βββ web-media/ # Store theme assets and visual logos
β βββ content.json # Seeding layout data for MongoDB
β βββ products.json # Seeding product catalog data for MongoDB
β βββ website.png # Main repository banner / screenshot
βββ services/ # Integration microservices
β βββ data/ # Temporary service cache files (git-ignored)
β βββ shiprocket_service.py # Shiprocket API courier service handler
βββ static/ # Client-side static assets
β βββ uploads/ # User and product media uploads (git-ignored)
βββ templates/ # Jinja2 HTML templates
β βββ base.html # Main wrapper, navigation, drawer components
β βββ index.html # Brand landing page & sliding showcase
β βββ product.html # Detailed variant view, inventory checks & reviews
β βββ checkout.html # Coupons, wallet splits, Razorpay gateway triggers
β βββ admin.html # Full storefront catalog and sales dashboard
βββ utils/ # Shared utility modules
β βββ db.py # PyMongo engine and JSON migration drivers
β βββ security.py # PII Field encryption and data anonymization
βββ .env.example # Configuration settings template
βββ .gitignore # Excludes secrets, uploads, and caches
βββ LICENSE # MIT open-source license
βββ app.py # Central Flask controller, middleware and route handlers
βββ migrate_to_mongo.py # Database bootstrap initialization script
βββ requirements.txt # Project package dependencies
To comply with modern user privacy standards, SIXN incorporates Fernet symmetric data encryption via the Python cryptography library.
- All user phone numbers, shipping addresses, and billing addresses are automatically encrypted before being written to MongoDB.
- Data is decrypted transparently on reading, ensuring that even in the event of a database dump or leakage, user PII remains entirely secure and unreadable.
- Make sure to keep your
ENCRYPTION_KEY,PHONE_ENCRYPTION_KEY, andADDRESS_ENCRYPTION_KEYbacked up securely. If these keys are lost, existing encrypted user profiles cannot be decrypted.
This project is licensed under the MIT License - see the LICENSE file for details.
