{"slug": "we-built-a-full-shopify-clone-in-three-days", "title": "We Built a Full Shopify Clone in Three Days", "summary": "The Codename One team built Bazaar, an open-source MIT-0 Shopify clone, in three days from a single Java codebase and Java backend running on SQLite, PostgreSQL, MySQL or MariaDB. Bazaar spans shopper apps, a merchant back office, offline-capable point of sale, marketplace admin, a server-rendered web store, and an app platform with OAuth installs, webhooks, UI extensions and checkout functions, submitted as PR #6329. The team says every phase of its plan passed tests across SQLite, PostgreSQL and MySQL, and it published a row-by-row feature comparison against Shopify, WooCommerce, BigCommerce and Square.", "body_md": "Two weeks ago I wrote that [Shopify was wrong to dump React Native for two native codebases](https://www.codenameone.com/blog/shopify-was-wrong-and-right-to-dump-react-native/). Plenty of people told me it's easy to criticize a company that ships. Fair. So I put my money where my mouth is.\n\n**What is Codename One?** Codename One is an open-source framework for building native iOS, Android, desktop, and web apps from a single Java or Kotlin codebase. Learn more at [codenameone.com](https://www.codenameone.com/).\n\nWe built Shopify. Not the mobile app. All of it.\n\nA shopper app. A merchant back office on phone, tablet, desktop, and web. A point of sale that keeps selling when the network dies. A marketplace admin. A server-rendered web store that search engines index. A blog. An app platform with OAuth installs, webhooks, UI extensions and checkout functions. Inventory across locations, invoicing, B2B price lists, subscriptions, loyalty, marketing journeys and an AI assistant. One Java codebase and one Java backend, running on SQLite, PostgreSQL, MySQL, or MariaDB.\n\nIt took three days of work. The first commit landed on Friday, November 20, every phase of the plan passed its tests on SQLite, PostgreSQL and MySQL the next day, and the rest went into matching Shopify's feature list row by row. It's called [Bazaar](https://www.codenameone.com/bazaar/), the source is free under MIT-0, and it went in as [PR #6329](https://github.com/codenameone/CodenameOne/pull/6329) while we shipped everything else in this post.\n\n`io_uring` under virtual threads.\nBazaar is four apps and a website over one backend. Shoppers browse many independent stores and check out on a phone or in a browser. Staff run the business from a back office. A cashier sells at a register. An administrator runs the marketplace.\n\nWe keep a [feature comparison](https://www.codenameone.com/developer-guide/bazaar-feature-comparison/) in the developer guide that walks Shopify, WooCommerce, BigCommerce and Square row by row. Here is the short version.\n\n| Area | What's in Bazaar | \n|---|---|\n| Catalog | Variants, video and 3D models, bundles, digital downloads, combined listings, metafields and metaobjects, Google's product taxonomy, unit pricing, translations | \n| Inventory | Multiple locations, transfers, purchase orders, suppliers, stocktakes, committed and incoming stock, serial numbers and lots with expiry, barcode label sheets | \n| Checkout | One-page checkout, Apple Pay and Google Pay, Klarna and Afterpay, iDEAL and SEPA, saved cards, gift cards, store credit, tipping, post-purchase upsell, fraud rules | \n| Orders | Edits after placement, draft orders with pay links, authorize then capture on ship, PDF invoices, bulk actions, returns and exchanges with return labels | \n| Shipping | Zones, carrier-calculated rates, label buying, local delivery and pickup, routing rules across locations, CN 22 and CN 23 customs forms | \n| Point of sale | PIN sign-in, shifts and Z reports, split tender, card readers, ESC/POS printers and cash drawers, layaways, parked carts, offline mode with sync | \n| Marketing | Discounts of every shape, flash sales with countdowns, email and SMS campaigns, journeys drawn as flowcharts, points, VIP tiers, referrals, paid clubs | \n| B2B and markets | Company accounts, price lists, net terms, quotes, multi-currency, EU VAT with VIES checks, OSS reports, duties estimates | \n| Web | Themes, a blog with RSS and Atom, menus, redirects, JSON-LD, sitemaps, predictive search with synonyms, custom domains, a cookie banner | \n| Extensibility | OAuth apps, scoped API keys, REST and GraphQL, webhooks with retries, UI extensions, checkout functions, an app directory with billing | \n| Operations | Analytics with a report builder and cohorts, live chat and calls, TOTP, OpenID Connect sign-in, audit log, multi-store organizations | \n\nThe demo seeds three stores with 90 days of history, and a demo pipeline keeps moving orders through to delivery so every screen has something happening on it. Here's the shopper app:\n\nAnd the back office the merchant runs it from:\n\nThis is the table I'd show a merchant. Each row is a feature Shopify leaves to its app store, which usually means another monthly subscription and another vendor with access to your customers. In Bazaar they ship in the box:\n\n| Usually a paid Shopify app | In Bazaar | \n|---|---|\n| Product reviews and review requests after delivery | Built in | \n| Wishlists and back-in-stock alerts | Built in | \n| Bundles and digital downloads | Built in | \n| Subscriptions, pre-orders, try before you buy | Built in | \n| Points, VIP tiers, referrals, paid memberships | Built in | \n| Tiered and volume discounts, flash sales | Built in | \n| Browse abandonment and push to shoppers | Built in | \n| Serial and lot tracking, barcode label printing | Built in | \n| Staff commissions at the register | Built in | \n| B2B quotes | Built in | \n| Amazon, eBay and Walmart marketplace sync | Built in, behind a connector interface | \n| A Kanban fulfilment board with bins and pick lists | Built in | \n\nThe **sales pipeline** puts every open cart next to every open order on one board: browsing, at checkout, reminded, paid, fulfilling, shipped, delivered, return requested. Dragging a card does the real thing. Drag a cart to \"reminded\" and the recovery mail goes out. Drag an order to \"shipped\" and it ships. The server refuses any move that doesn't make sense. Shopify keeps abandoned checkouts and orders on separate pages.\n\nEvery cart on that board carries a **purchase intent score**, built from product views, return visits, time on product pages, cart value and past orders, with the reasons written in words on the card. A merchant knows which cart to chase before lunch.\n\nThe **assistant** answers from the store's own numbers, through a fixed set of queries the model calls as tools. The owner picks the provider (OpenAI, Anthropic, Gemini or any compatible server) and the key never leaves the server. With no provider at all, the same screens answer by rules.\n\nAnd the **whole thing is yours**. Self-hosted, with the source, under a license that lets you copy it, change it and sell it.\n\nRetail floors have dead spots, and payment terminals go offline at the worst possible time. Bazaar's register keeps every sale on the device and uploads when it reconnects. The trick that makes it safe is boring and correct: each sale carries an id the register made, and the server stores it as unique.\n\n```\nfinal String clientId = clientId(storeId, sale.clientId().trim());\nStoreOrder again = existing(clientId);\nif (again != null) {\n    // The answer was lost and the register retried: record it once.\n    return duplicate(sale, again);\n}\n```\n\nSend a batch twice and every sale lands once, and stock moves once. A sale is never refused for lack of stock, because the goods already left with the customer. It's marked oversold and audited instead.\n\nThe backend compiles ahead of time to a native server with no class loader, so a plugin can't be loaded into it. That's a feature. A plugin that shares your memory, threads and database connections is one slow plugin away from slowing every store on the platform.\n\nSo a Bazaar app is a separate web service, in any language. It installs with OAuth and PKCE, reads and writes through scoped tokens, and hears about events through signed webhooks. Its UI extensions are JSON trees over a fixed set of blocks that the merchant app draws with its own components, so there is no script in a block. Checkout logic is a tiny language that Bazaar compiles, verifies and runs with a fixed instruction budget. Here's a pair deal and a bulk discount:\n\n```\nfor line in lines {\n  if line.quantity >= 2 { emit line_discount(line.index, line.total / 4, \"Pair deal\"); }\n}\nif cart.quantity >= 3 { emit discount(100, \"Three and up\"); }\n```\n\nEvery loop walks a list, so every loop ends. Overflow stops the function. An app that doesn't answer in time is left out, not waited for. The [Extending Bazaar](https://www.codenameone.com/developer-guide/#extending-bazaar) chapter walks through a complete sample app, Restock Alerts, from install to its checkout field.\n\nWe could have shipped the storefront as the same Java app compiled to JavaScript. We do that for the back office in the browser, where it's the right call: it's an app, staff use it all day, and it's the same code as the tablet.\n\nA storefront is a different animal. It's a web page. It has to paint before a shopper loses interest, work without JavaScript, open from a link in an email, and rank on Google. For that, HTML is the best tool ever made. Better than React, better than any framework that ships a runtime to render the text that was already in the response.\n\nSo product, collection, cart, checkout and account pages are server-rendered templates with titles, canonical links, JSON-LD and a sitemap. Small interactions use [htmx](https://htmx.org/), and every one of them falls back to a plain form post. Changing the postal code at checkout refreshes the delivery rates and nothing else:\n\n```\n<input id=\"postal\" name=\"postal\" autocomplete=\"postal-code\"\n       hx-post=\"/checkout\" hx-trigger=\"change\"\n       hx-target=\"#summary\" hx-select=\"#summary\" hx-swap=\"outerHTML\">\n```\n\nEach page sends a Content Security Policy built from script hashes and a per-request nonce. Third-party widgets run in sandboxed frames, and scripts in an optional category load only after the visitor accepts that category in the cookie banner.\n\nPicking the right tool per surface is the whole point. Java on every device, HTML for web pages, and one backend enforcing every rule once, so the web checkout and the app checkout can't disagree about a discount.\n\nThat sounds like a lot until you look at what's in it.\n\n| Part | Files | Lines | \n|---|---|---|\n| Backend, 60 packages from catalog to taxes | 692 | 124,659 | \n| Shared request and response types | 431 | 19,622 | \n| The app: shopper, back office, register, admin | 231 | 50,567 | \n| Tests (781 of them) | 151 | 34,827 | \n| SQL migrations for three database dialects | 104 |  | \n| Web templates, styles and scripts | 40 |  | \n| Demo media, screenshots and walkthrough videos | 139 |  | \n| Guides for users, implementors and app developers | 4 | 3,061 | \n\nThe 431 shared files average 45 lines each: they are the request and response records the app and the server both compile. The client is 50,000 lines for four apps on six platforms. A native team would write each of those screens twice before it reached a desktop, and a third time for the web.\n\nI don't know how big Shopify's code is, but I know they have a large mobile team. I'd bet their code runs to millions of lines. To be fair, it covers more than Bazaar does, but I doubt that closes an order of magnitude.\n\nYes, I could have pointed an agent at any stack and eventually gotten something that demos well. Not in three days, though: on many stacks the compile and test cycle alone eats that. Agents generate code in every language. The question is what happens on day four. Who tests it on every device? Who keeps the iOS and Android copies of the register in sync when a tax rule changes? Who reviews 260,000 lines spread over three languages and two UI toolkits?\n\nHere, the answer is the framework. Bazaar's tests run on the JVM, its screens are captured headless in a container, and its backend tests run against SQLite, PostgreSQL and MySQL in CI. It barely moved our token or CI budget. And because the client and the server share one language and one set of request types, a change to a tax rule is one change, reviewed once, tested once.\n\nWe don't want to compete with Shopify. I hope they take this code and build their next platform on it. That's what MIT-0 is for.\n\nI'm picking on Shopify because they're telling everyone else to make the same move. Their argument is that agents make the second copy of every feature cheap, so why share code at all. That's the lazy answer. It's doing what they always did, with a lower level of abstraction, and it gives their users nothing they can measure.\n\nEvery decade of computing raised the abstraction. Machine code to assembly. Assembly to C. C to managed languages. Hand-rolled UIs to toolkits, toolkits to frameworks. Each step let the same team build something bigger. If agents make writing code cheap enough to justify climbing down a level, why stop at Swift and Kotlin? Have the agent write machine code. It doesn't get bored.\n\nNobody does that, because the cost of software was never typing it. It's testing it, understanding it, and changing it without breaking it. Lower abstractions make all three harder, and agents make them harder still, because they write faster than anyone can review.\n\nDevelopers should expand to fill what their tools make possible. If you won't, your competitor will. Agents feel like an unlimited resource, but they aren't, and a lot of that resource is going into rebuilding solved problems one platform at a time. Sometimes that's right: plenty of web apps should never have been web apps. More often it's a regression wearing a new jacket.\n\nPut agents on a high level platform and the result is jet fuel. You get three days to a commerce platform, instead of three days to a second copy of the cart screen.\n\nTen years ago an early Codename One customer argued with me about this. \"If I had unlimited resources,\" he said, \"I'd pick native, because that's the best I can offer my customers. Right?\"\n\nWrong, for two reasons. No resource is unlimited, and agents didn't change that. But more important, what's best for his customers had nothing to do with which toolchain he used. Here's what customers want, and why every one of them is easier from a high level:\n\nNo, Bazaar isn't ready to replace your production store tomorrow morning. But the ground it covers in three days is staggering, it stands up to platforms with thousands of engineers, and parts of it are ahead of them. That's what a modern framework does with an agent behind it.\n\nLast week we added [spreadsheets with live formulas](https://www.codenameone.com/blog/a-million-rows-and-live-excel-formulas/). This week the rest of the office arrived. `com.codename1.wordprocessing` reads and writes DOCX, ODT, RTF, HTML and Markdown, reads old Word files and exports PDF. `DocumentView` shows pages and edits them with undo, and `SpellChecker` and `GrammarChecker` proof them as you type.\n\n```\nDocument d = Document.read(in, Document.Format.DOCX);\nd.write(out, Document.Format.PDF);\n```\n\n`com.codename1.presentation` opens PPTX, ODP, PPT and Keynote files, edits them in `SlideView`, and plays them in `SlideShow` with builds, transitions and a presenter mode. Why put presentations in a mobile framework? Convergence. Apps can't be islands that do one small thing anymore. The field service app needs the inspection report. The sales app needs the deck. Saturday's [article](https://www.codenameone.com/blog/word-documents-and-presentations-in-your-app/) has the details.\n\n`com.codename1.art` opens PSD and PSB with layers, masks and layer styles, Sketch files, Figma files through the REST API, and SVG at runtime with filters, masks, and CSS. They all become one document tree that renders the same pixels on every platform, and `ArtEditor` is a drawing editor you can drop into your app. Rive files now play as ordinary images, translated to Java at build time.\n\n```\nArtDocument doc = ArtFormats.read(in);        // SVG, PSD, Sketch, Figma or .cn1gfx\nImage image = ArtRenderer.toImage(doc, 2.0);  // two pixels per document unit\n```\n\nSunday's [article](https://www.codenameone.com/blog/photoshop-sketch-figma-and-rive-in-your-app/) shows both.\n\nSkeleton loaders, carousels with page dots, coach marks, empty states, range sliders, chips, a color picker, circular progress, audio waveforms, expandable text, activity timelines, an emoji picker, a mention field and a masonry layout are all in core now. The new `com.codename1.ui.chart` package draws 19 series types, from bars to Sankey, treemaps and candlesticks, with animation, pan, zoom, tooltips and screen reader support. You can see it in every Bazaar dashboard. Monday's [article](https://www.codenameone.com/blog/sixteen-components-and-charts-you-can-touch/) has the gallery.\n\nBanking and payments apps live under a threat model most apps never see. `android.debugGuard=true` now refuses to run with a debugger attached, and can also refuse to run with Developer Options or USB debugging on. Root detection catches Magisk, KernelSU and APatch, and hook detection catches Frida and the Xposed family. For the keyboard, `TextArea.SENSITIVE` keeps card and account numbers out of learned words, `isThirdPartyKeyboardActive` tells you when an unknown keyboard is reading every key, and `SecureKeyboard` draws your own, scrambled if you like, on every platform including iOS.\n\n```\nTextField pin = new TextField(\"\", \"PIN\", 6, TextArea.NUMERIC | TextArea.PASSWORD);\nif (DeviceIntegrity.isThirdPartyKeyboardActive(DeviceIntegrity.wellKnownKeyboards())) {\n    SecureKeyboard.install(pin).setScrambled(true);\n}\n```\n\nTuesday's [security article](https://www.codenameone.com/blog/stop-debuggers-hooks-and-keyloggers/) covers every signal.\n\nThe backend now speaks to SQL Server 2017 and newer, Azure SQL, and Oracle 19c and newer, next to PostgreSQL, MySQL, MariaDB, and SQLite. It speaks each wire protocol directly, with no driver. And the same `Database` API now reaches all of them from the client too, so a desktop database admin tool or a reporting app is plain Codename One code:\n\n```\nDatabase db = new OracleDatabase(\"db.example.com\", 1521, \"ORCLPDB1\", \"app\", password);\nCursor c = db.executeQuery(\"SELECT id, name FROM item WHERE price < ?\", 10.0);\n```\n\nThe backend can also serve your own OpenStreetMap tiles, routes and geocoding, OSRM and Nominatim compatible, so your maps stop depending on someone else's rate limit. Under the virtual threads, blocking file and SQLite I/O moves off the host threads, through `io_uring` on Linux, so one slow query no longer stalls unrelated requests. Wednesday's [backend article](https://www.codenameone.com/blog/oracle-sql-server-and-your-own-map-server/) has the rest.\n\nAnimations are the hardest thing for an agent to check, because the screenshot it takes is always mid-flight. Now it can stop the clock. `ui_clock_freeze` holds every animation, `ui_clock_advance` steps it frame by frame, and `ui_clock_settle` runs it to the end, so the agent inspects exactly the frame it means to. `mvn cn1:verify` checks your first form in light, dark, landscape and the largest text size for unlabeled controls, truncated text and poor contrast, and fails the build on an error.\n\n`LlmClient.system()` reaches the language model the operating system already ships: Apple Foundation Models on iOS and macOS, and Gemini Nano on Android devices with AICore. No download, no API key, and the prompt never leaves the device. Thursday's [article](https://www.codenameone.com/blog/agents-that-freeze-time-and-on-device-ai/) shows both.\n\n`java.util.Currency` now exists on every platform, with the same ISO 4217 data everywhere: codes, numeric codes, fraction digits and the currency of every country. `L10NManager.formatCurrency` formats in the user's locale with the currency's own digits, two for euros, none for yen, three for Bahraini dinars.\n\n```\nCurrency yen = Currency.getInstance(\"JPY\");\nint digits = yen.getDefaultFractionDigits();              // 0: no sen in prices\nCurrency euro = Currency.getInstance(new Locale(\"de\", \"DE\"));\nNumberFormat format = NumberFormat.getCurrencyInstance();\nformat.setCurrency(euro);\nString text = format.format(19.99);\n```\n\nOne change to know about: on iOS, `getCurrencySymbol()` now returns the symbol, `$`, where it used to return the code `USD`.\n\nPapercut is a twin-stick arena shooter drawn in cut paper and ink on a notebook page. You fly a paper quill, your right thumb aims the pencil, and cranes split into cranelets when you hit them. Ink stains stay on the page, which ripples like a grid of springs. It has three modes, including a daily shared seed, leaderboards with scores the server verifies, a coin shop and achievements. Like every one of our samples, it's a template in the [Initializr](https://start.codenameone.com/) and free MIT-0 source.\n\nBuilds without a version hint now use Xcode 27 on the build cloud, and Android builds use Gradle 9.8.0 with AGP 9.4.1. We do this every year, for the same reason: Apple and Google set the floor for store submissions, and the toolchain is where the new APIs, the new privacy rules and the security fixes live. Moving early, on our schedule, means your app never gets stuck when a store deadline lands on a Friday.\n\nGradle 9 turns on only when we know your project works with it. If you add your own Gradle plugins, apply `kotlin-android`, pin google-services below 4.4 or use Huawei push, the build stays on Gradle 8 and the log says why. If something does break, two build hints put you back where you were while you sort it out:\n\n```\ncodename1.arg.ios.xcode_version=26\ncodename1.arg.android.gradleVersion=8\n```\n\nPlease tell us when you need them. A hint you rely on is a bug we want to fix.\n\nWe're entering an era of new possibilities. A complex app, a commerce platform with a register, a back office and a web store, can now be taken apart and remixed in days. The code is no longer the limit. Your vision is.\n\nGenerate Bazaar from the [Initializr](https://start.codenameone.com/), point your agent at our [llms.txt](https://www.codenameone.com/llms.txt), and make it yours. Take this and go build the next great thing. Tomorrow: [Word and PowerPoint inside your app](https://www.codenameone.com/blog/word-documents-and-presentations-in-your-app/).", "url": "https://wpnews.pro/news/we-built-a-full-shopify-clone-in-three-days", "canonical_source": "https://dev.to/codenameone/we-built-a-full-shopify-clone-in-three-days-2j48", "published_at": "2026-12-04 14:01:00+00:00", "updated_at": "2026-12-04 14:15:06.088712+00:00", "lang": "en", "topics": ["developer-tools", "ai-products"], "entities": ["Codename One", "Bazaar", "Shopify", "WooCommerce", "BigCommerce", "Square", "GitHub"], "also_reported_by": [], "takeaway": "Bazaar ships as an MIT-0 Shopify-alternative reference covering catalog, inventory, checkout, POS, B2B and extensibility, built from one Java codebase and backend that runs on SQLite, PostgreSQL, MySQL or MariaDB.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/we-built-a-full-shopify-clone-in-three-days", "markdown": "https://wpnews.pro/news/we-built-a-full-shopify-clone-in-three-days.md", "text": "https://wpnews.pro/news/we-built-a-full-shopify-clone-in-three-days.txt", "jsonld": "https://wpnews.pro/news/we-built-a-full-shopify-clone-in-three-days.jsonld"}}