Costa Rica furniture e-commerce with admin panel
A domain-driven e-commerce platform built with Next.js App Router. It includes authentication, cart, checkout, orders, payments, and inventory control, plus dedicated rules for made-to-order products.
Challenge
Build a reliable online store with safe transactional business flows, inventory logic by product type, and an admin experience that can operate orders/payments without state conflicts.
Solution
Implemented a modular architecture with domain use-cases, stable server action contracts, and transactional rules for checkout, cancellation, and payment confirmation. Added auth guards, rate limiting, and environment validation to harden operations.
Results
- - Complete purchase flow from catalog to confirmed order
- - Operational admin panel for day-to-day order/payment workflows
- - Correct made-to-order behavior without hard stock blocking
- - Monetary consistency by storing integer CRC values
- - Scalable base for future catalog/shipping/promotion features
Technical system profile
Overview
Costa Rica furniture e-commerce platform with public shopping experience and private admin panel to operate catalog, inventory, orders, and payments with safe business rules.
Problem solved
- - Centralizes online selling and internal operations in one platform
- - Handles inventory differently for standard and made-to-order items
- - Prevents inconsistent order/payment transitions through status rules
- - Avoids money rounding issues by storing integer CRC amounts
Stack and technologies
- - Next.js 16 + React 19 + TypeScript
- - PostgreSQL + Prisma
- - better-auth (email/password plus optional Google)
- - Zustand for client state (cart, address, UI)
- - Zod validation
- - Tailwind + custom components + Radix
How it is organized
- - src/app: shop/auth/admin routes and layouts
- - src/features: domains (products, orders, payments, checkout, inventory, account)
- - src/shared: reusable UI and pure domain logic
- - src/lib: infrastructure (prisma, auth, env, email, rate limit)
- - Layering rules documented in ARCHITECTURE.md
Main workflow
- - Customer browses catalog, adds items, and runs checkout
- - Server recomputes totals and validates availability
- - If item is not made-to-order, stock is decremented in transaction
- - Admin confirms/rejects payments based on status rules
- - Admin cancellation restores inventory and synchronizes pending payments
Key modules
- - Orders: transactional place-order and cancel-order
- - Payments: confirmation/rejection with strict status guards
- - Inventory: product-level stock and made-to-order rules
- - Auth: requireAdmin/requireAdminAction guards
- - Checkout: address and verification step flow
Strengths
- - Strong domain separation and maintainability
- - Critical flows protected with transactions
- - Operational security with rate limiting and env validation
- - Clear quality and deployment workflow
Risks / technical debt
- - Status business rules may grow in complexity
- - External Redis dependency for auth rate limiting
- - Inventory concurrency needs continuous monitoring
- - Email/notification costs can scale with traffic
Do you need to build or improve a software system?
I can help you translate business needs into a robust, maintainable technical solution.