Skip to main content

Architecture

Fatleon Commerce is one Next.js application. Shoppers and operators use the same deployment. The storefront is /{locale}. The admin is /{locale}/admin. Amplify Hosting runs that application. The backend is Amplify Gen 2 in the same repository.

The local sandbox uses this same shape. It is a separate stack in your AWS account, not a second design.

The storefront and the admin are routes in that Next.js app. Payment webhooks arrive on the shop domain. The app proxies them to Lambda.

Backend​

PieceRole
CognitoOne user pool. Email sign-up, the Users, Admins, and Affiliates groups, and the one-time /setup claim.
AppSync and DynamoDBCatalog, carts, orders, and content.
LambdaCheckout, payment settlement, returns, admin mutations, and outbound mail.
S3 and CloudFrontProduct and banner files under admin-pictures/. CloudFront publishes that prefix only.
Amplify HostingThe Next.js build of this repository.

Signed-In and Guest Checkout​

Guest checkout is disabled by default. Enable it under System → Currency & tax.

  • With Guest Checkout Disabled: Shoppers must sign in or create a Cognito account to complete checkout.
  • With Guest Checkout Enabled: Shoppers can place an order using only an email address without registering an account.

Regardless of the entry path, both checkout methods generate a standardized, independent order record processed through the exact same backend pipeline and managed centrally under Admin → Orders.

Limitation Note: Guest orders do not retain or apply coupon codes.

Workflow Comparison​

Operational FeatureSigned-In ShopperGuest Shopper (Guest Checkout Enabled)
Account RequirementRequires an active Cognito user account.None (requires a valid email address only).
Order Schema & PipelineStandardized order record.Standardized order record (identical backend processing).
Discounts / CouponsFully supported.Not retained on guest checkouts.
Payment OptionsStripe, PayPal, or Mock.Stripe, PayPal, or Mock.
Admin ManagementHandled via Admin → Orders.Handled via Admin → Orders (processed identically).
Post-Purchase AccessShopper reopens order history from /{locale}/orders.Guest accesses the specific order via the secure tokenized link in the confirmation email (/{locale}/orders/guest/{id}?token=...). The token is cryptographically validated on subsequent reads.

Fulfillment operations for both order types are detailed in Orders and fulfillment.

Checkout​

Mock, Stripe, and PayPal are configured under System → Payment Settings. Checkout creates an order and a payment intent on Lambda. Stripe or PayPal then calls the shop domain. Mock does not. The checkout page calls Lambda directly, and the same settlement path marks the order paid.

Stripe calls https://{shop-domain}/api/webhooks/payments/stripe. PayPal calls /api/webhooks/payments/paypal. Those routes are on the Next.js app. The app forwards the raw request, including the signature headers, to Lambda. The public URL is the shop domain, not a separate API host.

Accounts​

Cognito holds every account in one pool. After email confirmation, a new account is placed in Users and can shop. Admins can open /{locale}/admin. Admins and Affiliates can open the referral program. An admin assigns those groups from the users screen.

/setup runs only while the pool has no users. It claims the first admin. Once any user exists, /setup stays closed. If the last admin is lost, recover that user in the Cognito console.

Mail​

Sign-up codes, password resets, order mail, and mail sent from Admin do not leave from Cognito's own sender or from Amplify Hosting. Cognito invokes Lambda for its own messages. Lambda sends through the SMTP settings in Admin. Choose that provider before launch, as described in Domain and email.

Changing the storefront​

The sections above are how this deployment is connected. To change a decoration image, the wording in the navigation, or to add a marketing page, see Where to change the storefront. Which of these systems hold accounts and payments, and what a change in this repository still has to get right, is in Development Security.