Nordika Wear E-commerce & AWS Serverless Architecture
High-performance headless platform with visual customizer and corporate backend on AWS Serverless (Lambda + LWA + CloudFront CDN + ECR + Neon PostgreSQL). Asynchronous event-driven SkydropX PRO logistics with atomic DB locking, dual payment rails, and $0.00 USD/mo operational cost.
Decoupled cloud infrastructure running Django 6 on lightweight Docker containers with AWS Lambda Web Adapter, Function URLs (TLS 1.3), Neon PostgreSQL PgBouncer pooling, and zero-downtime CI/CD.
Monolithic VPS Limits & Idle Compute Waste
Nordika Wear, an apparel brand specializing in custom products (t-shirts, caps, mugs), needed a storefront where shoppers could upload artwork, position it visually on products before checkout, and get real-time multi-carrier shipping quotes & labels in Mexico (SkydropX PRO) across dual payment rails (Stripe and Mercado Pago). Traditional architectures posed four critical bottlenecks: 1. Idle compute billing: A VPS or PaaS (Render) charges 24/7 regardless of traffic, while closed SaaS platforms like Shopify restrict custom visualizers and local carrier logic. 2. Cold Starts & CDN cookie conflicts: Moving Django to AWS Lambda introduces ~1.5s cold starts on catalog browsing, yet caching the entire API in CloudFront breaks HttpOnly JWT sessions, CSRF protection, and webhooks. 3. Lambda CPU Freeze: AWS Lambda freezes the vCPU immediately upon returning an HTTP response, killing any background threading.Thread—causing payment webhooks to time out if SkydropX label creation runs synchronously. 4. Zombie DB sockets & Read-Only filesystem: Frozen ephemeral containers exhaust PostgreSQL connection pools, the root filesystem is read-only (breaking Django Admin without build-time collectstatic), and heavy SDKs like boto3 (+95 MB) bloat the ECR image.
Function URLs (TLS 1.3) → LWA :8000
ALLOWEDDirect HTTPS endpoint bypassing API Gateway markup ($1.00 USD/million requests saved).
Lambda → Neon PostgreSQL (-pooler)
POOLEDPgBouncer pooler + conn_max_age=0 closes client sockets instantly, preventing zombie connections.
Native Async Invocation (Event) & DB Lock
ACTIVELambda auto-invokes asynchronously (Event) with atomic PostgreSQL lock, decoupling SkydropX from webhooks at $0.00.
CloudFront (2 Behaviors) + X-Origin-Secret
SHIELDEDCaches /api/products/* (<20ms) while forwarding HttpOnly cookies & webhooks on Default (*), blocking direct origin bypass.
Cold Start Benchmarks & Cost Guardrails
Rigorous verification of latency, concurrency limits, and operational cost elimination under AWS Free Tier and automated container policies.
DRF AnonRateThrottle: 10 req/min · Emergency Concurrency Kill-Switch: 3s
Decoupled Infrastructure & Container Execution
Architecture deployed on AWS us-east-1 following the Twelve-Factor App methodology and AWS Well-Architected Framework serverless lens:
AWS Lambda Web Adapter (LWA) & Gunicorn
The official open-source AWS Lambda Web Adapter binary (/opt/extensions/lambda-adapter) translates native Lambda events to standard HTTP directed to Gunicorn (1 worker / 1 thread) on 127.0.0.1:8000, eliminating vendor lock-in and allowing native Django 6 execution.
Amazon CloudFront Edge CDN & Function URLs
CloudFront CDN distribution with 2 behaviors: /api/products/* cached at the Edge (s-maxage=300) eliminating cold starts on catalog browsing, and Default (*) transparently forwarding HttpOnly cookies, CSRF tokens, and webhooks to Lambda Function URLs with TLS 1.3.
Amazon ECR Automated Lifecycle Rule
Slim Docker image without C compilers (~115 MB) paired with an automated lifecycle rule expiring older images. Stays well within the 500 MB Free Tier, enables safe rollbacks, and caps post-year cost at ~$0.02 USD/month.
Neon PostgreSQL Serverless + PgBouncer Pooler
Mitigates Lambda CPU freeze by routing queries through Neon PgBouncer pooled endpoint. Configuring conn_max_age=0 immediately recycles client sockets upon HTTP 200, preventing connection exhaustion.
Asynchronous Event-Driven SkydropX PRO Logistics
Upon payment confirmation, the webhook invokes the AWS Lambda Control Plane API (X-Amz-Invocation-Type: Event) with a stdlib SigV4-signed HTTP v2 envelope for LWA, returning in < 150 ms. In the background, the worker validates an HMAC-SHA256 signature, acquires an atomic lock in Neon PostgreSQL, and issues the label at $0.00 USD cost.
Headless Frontend on Astro v5 & React Islands
Static Catalog pages with near-instant edge loading. Dynamic React islands empower shoppers to upload designs, drag, scale, and preview artwork directly over real apparel mockups with synchronized coordinates.
2.1 — Global Cloud Infrastructure Diagram
End-to-end serverless topology on AWS us-east-1: Frontend on Vercel (Astro/React), Amazon CloudFront Edge CDN (2 behaviors + X-Origin-Secret header), Lambda Function URL (TLS 1.3), AWS Lambda Web Container (1024 MB RAM, LWA :8000, Gunicorn 1w/1t + Django 6.0), Control Plane async self-invocation to the Worker container, Neon PostgreSQL (-pooler), and external services (Stripe, Mercado Pago, SkydropX, Cloudinary, Resend).

2.4 — Internal Lambda Container & Connection Pooler
Internal anatomy of the AWS Lambda Firecracker microVM (1024 MB RAM / Linux AMD64): JSON v2 event translation via the AWS Lambda Web Adapter extension (/opt/extensions/lambda-adapter) to HTTP 127.0.0.1:8000 targeting Gunicorn (1w/1t) and Django 6.0, paired with conn_max_age=0 and Neon PgBouncer (-pooler, up to 10,000 concurrent connections) to prevent zombie sockets upon CPU freeze.

Empirical Findings & Production Readiness
Verified production metrics achieved after migrating from monolithic infrastructure to AWS Serverless:
- >AWS cloud compute cost held at $0.00 USD during Free Tier and ~$0.02 USD/month afterwards.
- >Cold starts completely eliminated on the product catalog via Amazon CloudFront Edge CDN with sub-20ms latency.
- >Asynchronous SkydropX PRO label generation protected by atomic PostgreSQL lock against duplicate purchases.
- >Atomic Zero-Downtime deployments executed in under 15 seconds via GitHub Actions and Amazon ECR.
- >Full end-to-end logistics automation: real-time multi-carrier rates (FedEx, Estafeta, Redpack) and SkydropX label creation.
- >Robust relational persistence on Neon PostgreSQL with zero zombie sockets via PgBouncer and conn_max_age=0.
- >Django Admin panel fully operational through CloudFront and Function URLs served with WhiteNoise.
- >Abuse protection via DRF rate limiting (10 req/min for auth/payments) and a 3-second AWS concurrency emergency kill-switch.
- >Top Lighthouse performance score and near-instant catalog navigation with Astro SSG Headless architecture.
Rigorous Engineering Trade-offs
Each technical decision documents conscious trade-offs, cold start mitigations, and database connection pooling guarantees.
AWS Lambda Web Adapter (LWA) vs. Invasive Serverless Frameworks
Instead of coupling code to proprietary libraries like Mangum or Zappa, the official AWS Lambda Web Adapter binary (/opt/extensions/lambda-adapter) was packaged in the Dockerfile. It intercepts Lambda JSON events and proxies them as standard HTTP to Gunicorn (1 worker / 1 thread, optimal for 1 active request per microVM) on 127.0.0.1:8000, allowing Django 6 and DRF to run unmodified with zero vendor lock-in.
Lambda Function URLs with TLS 1.3 vs. Amazon API Gateway
Bypassed Amazon API Gateway to simplify network topology and eliminate the $1.00 USD/million request surcharge. Function URLs deliver native TLS 1.3 endpoints, support up to 6 MB payloads, and are hardened with restricted dual IAM permissions (lambda:InvokeFunctionUrl and lambda:InvokeFunction conditioned with --invoked-via-function-url).
Neon PostgreSQL Serverless & Zombie Connection Elimination
Because AWS Lambda freezes container CPU after returning a response, open TCP connections to PostgreSQL would remain in a zombie state, exhausting database connection limits. This was solved by routing Django through Neon PgBouncer (-pooler) endpoint and enforcing conn_max_age=0 with sslmode=require, closing client sockets immediately.
CPU Freeze, Dual Defense (SigV4 + HMAC) & Atomic DB Lock
AWS Lambda freezes CPU instantly upon response delivery, preventing background threads (threading.Thread). To prevent Stripe/Mercado Pago webhook timeouts, the dispatcher invokes the AWS Lambda Control Plane API (X-Amz-Invocation-Type: Event) with a stdlib SigV4-signed HTTP v2 envelope for LWA, returning in < 150 ms. In the background, the worker validates an HMAC-SHA256 signature with timestamp and acquires an atomic lock in Neon PostgreSQL (shipment_id = "PROCESSING:...") prior to SkydropX label creation.
Amazon CloudFront Edge CDN with Dual Behaviors without Cookie Breakage
To suppress Cold Starts (~1.5s) on catalog browsing, an Amazon CloudFront CDN was placed in front of the Function URL with 2 behaviors: "/api/products/*" with CachingOptimized (s-maxage=300, delivering sub-20ms edge responses) and "Default (*)" with CachingDisabled and AllViewerExceptHostHeader, preserving HttpOnly cookies, CSRF tokens, and webhook HMAC signatures without altering the origin Host header.
FinOps: Amazon ECR Automated Lifecycle Rule for Zero Cost
To prevent unbounded Docker image storage fees in Amazon ECR after the 500 MB Free Tier period, the image was slimmed down without C compilers (~115 MB) and paired with an automated lifecycle policy expiring older images (imageCountMoreThan: 2 -> Expire). ECR retains the latest 2 images for safe scaling and instant rollbacks, capping post-Free Tier storage at ~$0.02 USD/month.
Zero-Downtime CI/CD Pipeline & Decoupled Migraciones
GitHub Actions workflow automates docker buildx (linux/amd64, --provenance=false), pushes to ECR, and triggers aws lambda update-function-code. Existing containers serve inflight traffic while the new container initializes, achieving atomic zero-downtime cutover in < 15 seconds. Django migrations are run decoupled prior to image update against the Neon pooler.
Django Admin Panel & WhiteNoise in a Read-Only Container
Because the root filesystem in AWS Lambda is read-only, build-time dummy environment variables were injected in the Dockerfile to run python manage.py collectstatic safely. In production, WhiteNoise compresses and serves /admin/ static files without S3 bucket dependencies.
Visual Drag & Drop Customizer in an Islands Architecture
Astro v5 frontend embeds dynamic React islands using react-draggable. Shoppers upload artwork, resize, and adjust it over the product canvas, computing normalized coordinates sent to the backend, while Nano Stores keeps the cart synchronized across fast static transitions.
AWS Lambda Web Adapter (LWA) vs. Invasive Serverless Frameworks
Instead of coupling code to proprietary libraries like Mangum or Zappa, the official AWS Lambda Web Adapter binary (/opt/extensions/lambda-adapter) was packaged in the Dockerfile. It intercepts Lambda JSON events and proxies them as standard HTTP to Gunicorn (1 worker / 1 thread, optimal for 1 active request per microVM) on 127.0.0.1:8000, allowing Django 6 and DRF to run unmodified with zero vendor lock-in.
Lambda Function URLs with TLS 1.3 vs. Amazon API Gateway
Bypassed Amazon API Gateway to simplify network topology and eliminate the $1.00 USD/million request surcharge. Function URLs deliver native TLS 1.3 endpoints, support up to 6 MB payloads, and are hardened with restricted dual IAM permissions (lambda:InvokeFunctionUrl and lambda:InvokeFunction conditioned with --invoked-via-function-url).
Catalog, Customizer & Checkout
Production interface running on Astro v5 edge network with real-time visual drag-and-drop customization.

Product catalog with category, size and price filters

Empty cart drawer

Visual customizer: design placed on a white cap

Visual customizer: base color switched to black

Home page with featured products carousel

Cart drawer after adding a custom product

Checkout: contact info and shipping address

Checkout: Stripe and Mercado Pago payment methods

My Account: order history

Order detail: shipment tracking number and payment summary

Product detail page with size selection
FinOps Economics & Strategic Roadmap
Real production cost breakdown under AWS Free Tier and automated container lifecycle guardrails:
| AWS Service | Real Bill | Cost Guardrail |
|---|---|---|
| Amazon CloudFront CDN | $0.00 USD | 1 TB OUT + 10M HTTPS reqs free |
| AWS Lambda (x86_64) | $0.00 USD | 1024 MB RAM, 29s timeout |
| Function URLs TLS 1.3 | $0.00 USD | Bypasses API Gateway ($1/M) |
| Amazon ECR Registry | $0.00 / ~$0.02 | countNumber > 2 purge (~115 MB) |
| Neon PostgreSQL | $0.00 USD | PgBouncer -pooler |
| CloudWatch Logs | $0.00 USD | 7-day retention limit |
| AWS KMS | $0.00 USD | Managed aws/lambda key |
| Data Transfer OUT | $0.00 USD | 100 GB Free Tier (Cloudinary media) |
CloudFront CDN & Edge Micro-caching
ACTIVEDual-behavior CloudFront distribution live in production: delivers sub-20ms catalog navigation with zero cold starts while preserving HttpOnly cookies and webhooks.
Hybrid Async Event Dispatcher & SQS Ready
ACTIVENative asynchronous event dispatching (Lambda Async Event) with atomic PostgreSQL lock at $0.00; pre-wired to toggle Amazon SQS via a single environment variable.