Skip to content

iRuperth/Looping

Repository files navigation

Looping Marketplace

English · Español

Python Django Bootstrap Stripe Supabase PostgreSQL uv Docker Make

Looping Marketplace

Full web marketplace to buy and sell products, with secure online payments and buyer and seller accounts.

Full product CRUD | Buyer & seller roles | Stripe payments | 2 languages (EN / ES)


Table of contents


Project description

Looping Marketplace is a full web application designed for buying and selling products. It ships with a complete CRUD system and integrates Stripe as a payment gateway.

The application is fully functional for real use. Users can create an account and start browsing and purchasing products immediately. To become a seller, users pay a one-time fee that unlocks the seller role and lets them list and manage their own products.

Features

  • Full CRUD system for products
  • User authentication and role management (buyer / seller)
  • One-time upgrade to become a seller
  • Stripe payment integration (single and multi-item checkout)
  • Favorites and shopping cart
  • Product image storage on Supabase
  • PostgreSQL database (SQLite fallback for local development)
  • Responsive UI built with Bootstrap
  • Custom error pages (400 / 403 / 404 / 500) and centralized logging

Architecture

Looping Marketplace is a server-side rendered Django monolith. Django serves both the business logic and the HTML (Django templates + Bootstrap); external services handle payments, image storage and the database.

                         ┌──────────────────────────────┐
        Browser  ───────▶│   Django (MarketPlace app)   │
   (Bootstrap UI,        │  ──────────────────────────  │
    Stripe.js,           │  urls.py   → routing         │
    SweetAlert2)         │  views.py  → business logic  │
                         │  models.py → ORM             │
                         │  templates → server-side HTML│
                         └───────┬───────┬───────┬──────┘
                                 │       │       │
                  ┌──────────────┘       │       └──────────────┐
                  ▼                      ▼                      ▼
          ┌───────────────┐     ┌────────────────┐     ┌────────────────┐
          │  PostgreSQL    │     │     Stripe      │     │   Supabase      │
          │  (Supabase /   │     │  Checkout &     │     │  Storage bucket │
          │   SQLite local)│     │  payments       │     │  product images │
          └───────────────┘     └────────────────┘     └────────────────┘

Request flow

  1. A user registers / logs in → Django auth creates the account, and a post_save signal creates the matching UserProfile.
  2. A seller creates a product → the image is uploaded to the Supabase products_images bucket and its public URL is stored on the Product.
  3. A buyer purchases → a Stripe Checkout session is created → Stripe redirects back to a success URL → the order is recorded.
  4. Favorites and cart are stored as relations on UserProfile.

Tech stack

Layer Technology
Web framework Django 6.0 (Python 3.12)
Frontend Django templates + Bootstrap 5.3, Stripe.js, SweetAlert2
Database PostgreSQL (via dj-database-url) · SQLite fallback in local dev
Image storage Supabase Storage
Payments Stripe Checkout
Auth Django authentication + profile signals
Package manager uv
Containerization Docker / Docker Compose
Tooling Make

Project structure

MarketPlace/
├── Makefile                     # Dev commands (install, dev, migrate, docker-up...)
├── README.md / README.es.md     # Documentation (EN / ES)
├── backend/
│   ├── manage.py                # Django CLI entry point
│   ├── pyproject.toml           # uv project + dependencies
│   ├── requirements.txt         # pip dependencies (alternative)
│   ├── Dockerfile               # Server image
│   ├── docker-compose.yml       # Server service on port 8000
│   ├── MarketPlace/             # Django project package
│   │   ├── settings.py          # Global config (apps, DB, Stripe, logging)
│   │   ├── urls.py              # Root router (all endpoints)
│   │   ├── views.py            # All platform views
│   │   ├── models.py            # Product, UserProfile, Location, Favorite, Order, ShoppingCart
│   │   ├── forms.py             # Django forms
│   │   ├── admin.py             # Django admin registration
│   │   ├── error_views.py       # 400 / 403 / 404 / 500 handlers
│   │   └── error_handlers.py    # Error middleware
│   ├── services/                # External integrations
│   │   ├── stripe_service.py    # Stripe configuration
│   │   └── supabase.py          # Supabase client (image storage)
│   ├── config_logs/             # Centralized logging config
│   ├── templates/               # Server-side HTML (main, product_detail, login, profile...)
│   └── static/                  # Bootstrap CSS/JS and images
└── frontend/                    # Static HTML mockups (reference, not wired to the app)

Data model

Model Purpose Key relations
UserProfile Extends Django User; is_premium marks a seller 1:1 User, FK Location, M2M Product (favorites)
Location City / country of a user or product referenced by UserProfile and Product
Product Item listed for sale FK seller (UserProfile), FK Location
Order Completed purchase (buyer ≠ seller) FK buyer, FK seller, FK product
Favorite Saved product FK UserProfile, FK Product (unique together)
ShoppingCart Cart line FK UserProfile, FK Product (unique together)

A UserProfile is created automatically for every new User via a post_save signal. A user becomes a seller when is_premium = True (set after the upgrade payment).

API endpoints

Route Name Purpose
/ main_page Product catalog
/product/<id>/ product_detail Product detail page
/product/new/ create_product Create a listing
/product/buy/<id>/ acquire_product Complete a purchase
/product/delete/<id>/ delete_product Remove a listing
/register/ · /login/ · /logout/ auth Account access
/profile/ user_profile Purchases, sales and favorites
/profile/upgrade/ upgrade_to_seller Become a seller
/favorites/ · /toggle-favorites/<id>/ favorites Manage favorites
/shopping-cart/ · /toggle-shopping-cart/<id>/ cart Manage cart
/create-checkout-session/<id>/ create_checkout_session Single-item Stripe checkout
/create-multi-checkout/ create_multi_checkout Multi-item Stripe checkout
/create-upgrade-session/ create_upgrade_session Seller upgrade checkout
/about/ · /contact/ · /info/ static pages Informational pages
/admin/ Django admin

Getting started

Requirements

  • Python 3.12+
  • uv (recommended) — or pip
  • Make (preinstalled on macOS/Linux; on Windows use WSL or run the raw commands)
  • Docker Desktop (optional)
  • Git

Clone the repository first:

git clone https://github.com/Bootcamp-IA-P6/MarketPlace.git
cd MarketPlace

Run with Make (recommended)

From the project root:

make dev

This installs dependencies with uv, applies migrations and starts the server at http://localhost:8000.

Run on macOS / Linux

cd backend
uv sync                              # create .venv and install dependencies
uv run python manage.py migrate      # set up the database
uv run python manage.py runserver    # start at http://localhost:8000
Without uv (plain venv + pip)
cd backend
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python manage.py migrate
python manage.py runserver

Run on Windows

PowerShell with uv (recommended):

cd backend
uv sync
uv run python manage.py migrate
uv run python manage.py runserver
Without uv (plain venv + pip)
cd backend
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
python manage.py migrate
python manage.py runserver

make is not available on Windows by default. Use the commands above, or run the project inside WSL to use make dev.

Run with Docker

Pull and run the published image (no clone needed):

docker pull iruperth/looping:latest
docker run -d -p 8000:8000 iruperth/looping:latest

Or build from source with Docker Compose:

cd backend
docker compose up --build      # add -d to run in the background
docker compose down            # stop

Environment variables

Create a backend/.env file. For local development everything has a safe default, so an empty/minimal file already works (SQLite is used and payments/storage are disabled).

# Django
DJANGO_SECRET_KEY=change-me-in-production
DJANGO_DEBUG=True

# Database — omit to use the local SQLite fallback
DATABASE_URL=postgresql://user:password@host:5432/marketplace

# Stripe — leave empty to disable real payments
STRIPE_PUBLIC_KEY=pk_test_xxx
STRIPE_SECRET_KEY=sk_test_xxx
STRIPE_WEBHOOK_SECRET=whsec_xxx

# Supabase — leave empty to disable image uploads
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
Variable Required Default / effect
DJANGO_SECRET_KEY Production Insecure dev key if unset
DJANGO_DEBUG No True in local dev
DATABASE_URL Production SQLite (db.sqlite3) if unset
STRIPE_PUBLIC_KEY For payments Test placeholder if unset
STRIPE_SECRET_KEY For payments Empty → checkout disabled
STRIPE_WEBHOOK_SECRET For webhooks Empty
SUPABASE_URL For image upload Empty → storage disabled
SUPABASE_SERVICE_ROLE_KEY For image upload Empty → storage disabled

Make commands

make help            # list all available targets
make install         # create the virtual environment and install dependencies (uv sync)
make dev             # install + migrate + run the development server
make run             # start the server (no sync / migrate)
make migrate         # apply database migrations
make makemigrations  # generate new migrations
make superuser       # create a Django admin user
make shell           # open the Django shell
make collectstatic   # collect static files
make test            # run the test suite
make clean           # remove Python cache files
make docker-up       # docker compose up --build
make docker-down     # docker compose down

Roadmap

  • Real-time chat between buyers and sellers
  • Optional paid promotion to highlight products at the top of the marketplace
  • Discount coupons for frequent buyers
  • Automated notifications for order updates, chat messages and low-stock alerts
  • Long-term goal: native mobile application

Contributing

We welcome contributions to improve Looping Marketplace. If you would like to collaborate, please open a pull request and our team will review it.


Looping Marketplace

About

Full-stack marketplace web app to buy and sell products, with secure online payments and buyer and seller accounts.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors