Skip to main content

FlashCore package

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-0.1.0.tar.gz (5.1 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-0.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for syeedalireza_flashcore-0.1.0.tar.gz
Algorithm Hash digest
SHA256 953036d864eadca68e4235e06e4647913104e0355329117ddff2007436617ff5
MD5 016a20d5eeb22f4654c06ac82ca737b3
BLAKE2b-256 8f8cb377c563b660dcc764589f22627e07b3fc9853c0829785873ee1fe79415c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for syeedalireza_flashcore-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0bb4589179bd81f80e8a6d950837e6d18a177b754a1d334852fbbe6c87eda26d
MD5 a6404f0a53955dd61a2c29a82f3ed790
BLAKE2b-256 037f2474def49ff5349f801d8b41df06ce8b39505f8255c9e1a979c883caabd0

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