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.0.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.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: syeedalireza_flashcore-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 3dff1b4c7231f321f5ee43a665800412bb26538fe4bb8ba3b548435c05efe6c8
MD5 2c80c33b4c78a25fcfb64523b0735560
BLAKE2b-256 7a085bdfc8e8c88559dec97d8fe1b6c4fb1eca709b42578633e76716ed00e4be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for syeedalireza_flashcore-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4579a287956b3a1e866eaf3019968dd46f159c2a567532eabd5e8d4fbad10839
MD5 f59c162dc1c8458b136ab61086bbb209
BLAKE2b-256 dbf54c6d3bff64406929bf3f98c82df199823d934ee7a858eb0a1f4f2c050a60

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