Skip to main content

High-Concurrency Flash Sale Engine

Project description

FlashCore: High-Concurrency Flash Sale Engine

Python FastAPI Redis License

FlashCore is an enterprise-grade, high-concurrency drop engine designed to handle massive traffic spikes during flash sales. It guarantees zero overselling using atomic Redis Lua scripts and ensures eventual consistency with a PostgreSQL database.

Developed by Alireza Aminzadeh (@syeedalireza).

🏗 Architecture & Design Patterns

  • Clean Architecture: Strict separation of Domain, Application, and Infrastructure layers.
  • Event-Driven: Uses Redis Pub/Sub (or Kafka in larger deployments) to decouple inventory reservation from order processing.
  • Atomic Operations: Utilizes Redis Lua scripting to decrement inventory atomically, preventing race conditions during high traffic.
  • Zero-Trust Security: Internal services (Redis, PostgreSQL) are strictly isolated within Docker networks and never exposed to the public internet.

🚀 Quick Start (Docker)

This project is fully containerized and optimized for both Windows (Docker Desktop) and Linux production environments.

  1. Clone the repository:

    git clone https://github.com/syeedalireza/FlashCore.git
    cd FlashCore
    
  2. Environment Setup:

    cp .env.example .env
    # Edit .env with your secure credentials
    
  3. Build and Run:

    docker-compose up --build -d
    
  4. Access the API Documentation: Open http://localhost/docs in your browser.

🛡 Security & DevOps Standards

  • Non-Root Containers: The FastAPI application runs as a restricted user (UID 1000).
  • Resource Limits: Strict CPU and Memory limits are enforced in docker-compose.yml to prevent host starvation.
  • Network Isolation: Databases are not bound to 0.0.0.0. Only the reverse proxy/API gateway is exposed.
  • Line Endings: Enforced LF line endings via .gitattributes for seamless Windows-to-Linux deployment.

🧪 Testing

Run the comprehensive test suite (Unit & Integration):

docker-compose exec api pytest -v --cov=src

📜 License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

syeedalireza_flashcore-1.0.1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

syeedalireza_flashcore-1.0.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file syeedalireza_flashcore-1.0.1.tar.gz.

File metadata

  • Download URL: syeedalireza_flashcore-1.0.1.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for syeedalireza_flashcore-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d84c458ee38cba19912117847a58123716be97704c5e926f1d6dbd911097c05b
MD5 620e5bc3ad23478dfd2b406872a701e9
BLAKE2b-256 59bde44c9ee460f7506eaf4aff5986d49086aa987c8a7cb474e14994a51c0c05

See more details on using hashes here.

File details

Details for the file syeedalireza_flashcore-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for syeedalireza_flashcore-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b5389e72080e10e2c5f93162b8f86d5eb60e8a2fec5d459c151d38c746dd435f
MD5 b10ecb3681d77d1d5826f7e21e8a092d
BLAKE2b-256 2077dcb55bb656ce6a919d577592da357fe65d17740a914323ee6b2cdc419f8c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page