High-Concurrency Flash Sale Engine
Project description
FlashCore: High-Concurrency Flash Sale Engine
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.
-
Clone the repository:
git clone https://github.com/syeedalireza/FlashCore.git cd FlashCore
-
Environment Setup:
cp .env.example .env # Edit .env with your secure credentials
-
Build and Run:
docker-compose up --build -d
-
Access the API Documentation: Open
http://localhost/docsin 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.ymlto 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
LFline endings via.gitattributesfor 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3dff1b4c7231f321f5ee43a665800412bb26538fe4bb8ba3b548435c05efe6c8
|
|
| MD5 |
2c80c33b4c78a25fcfb64523b0735560
|
|
| BLAKE2b-256 |
7a085bdfc8e8c88559dec97d8fe1b6c4fb1eca709b42578633e76716ed00e4be
|
File details
Details for the file syeedalireza_flashcore-1.0.0-py3-none-any.whl.
File metadata
- Download URL: syeedalireza_flashcore-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4579a287956b3a1e866eaf3019968dd46f159c2a567532eabd5e8d4fbad10839
|
|
| MD5 |
f59c162dc1c8458b136ab61086bbb209
|
|
| BLAKE2b-256 |
dbf54c6d3bff64406929bf3f98c82df199823d934ee7a858eb0a1f4f2c050a60
|