Leonardo Mitsuo Fukuda
Work

2026 · Active

Mercado One

A system in development for small grocery stores: Angular admin and Java API on an Azure pilot, PostgreSQL on the server, and a JavaFX POS that records sales in SQLite before syncing

BackendJavaSpring BootPostgreSQLAngularJavaFXSQLiteAzureEvidence repositoryDemoDocumentation

01 / Context & problem

Mercado One is an in-progress ERP for small grocery stores: catalog, basic inventory, in-person sales, and operational reports. The POS has to record a sale even when the API does not answer. The admin and API are on a public Azure pilot; the POS is the desktop client, with its own usage guide. The repository still records the whole as a scaffold, not a finished MVP.

  • Three applications: an Angular admin, a Spring Boot API, and a JavaFX POS.
  • A POS sale starts in SQLite and only then goes to the API.
  • Central PostgreSQL starts with Docker Compose. There is no message queue and no mobile app.

02 / Role & scope

The repository presents the API, admin, POS, migrations, and usage guides as the project's work. The published status separates what already runs from what is still on the backlog.

  • Modules for access, catalog, customers, suppliers, inventory, sales, offline sync, and audit.
  • Sync conflicts are resolved in the admin, not on the POS screen.
  • The current-status document lists what is missing, including sale cancellation and discounts.

03 / System architecture

The admin and the POS talk to the same API. The POS also keeps a catalog and a sales queue in SQLite. The POS screen does not call POST /api/sales: every checkout is stored locally and synced through POST /api/offline/sales/sync.

  • The backend is split into access, catalog, customer, inventory, sales, offline, supplier, audit, and system.
  • A sale posted straight to the server uses the current price. An offline sync that diverges becomes a conflict.
  • The Azure pilot publishes the API on Linux App Service with Java 25 and PostgreSQL Flexible Server in Brazil South. The admin is on Static Web Apps in Central US. The POS stays on the register and points at that API. The repository describes the mercado-one-prod resource group as a student-subscription pilot, not as a store in production.

04 / Data model

Flyway owns the PostgreSQL schema. Hibernate validates that schema and does not create it at runtime. The POS SQLite file lives at ~/.mercado-one/pdv-offline.sqlite3 and holds the local catalog and the sales queue.

  • Local sale states: PENDING, SENT, CONFLICT, or ERROR.
  • Server conflict states: PENDING, ACCEPTED, or REJECTED. Accepting or rejecting in the admin does not rewrite the SQLite row.
  • Conflict codes include missing product, inactive product, changed price, payment total, and stock.

05 / Engineering decisions

The local sale comes before the network, so checkout does not depend on the API at the moment of payment. The server still owns stock and the current price. Divergence becomes a conflict instead of a silent overwrite.

  • POST /api/sales exists and has a test. No current UI client calls it.
  • The admin JWT travels in an HttpOnly cookie. The POS uses Bearer. The token is checked against the database again, so a deactivated user or a changed role still applies.
  • Audit writes immutable events for sales, stock, users, and conflicts. There is no query for those events yet, and product edits are not recorded.

06 / Implementation

The README describes the local path: copy .env, start PostgreSQL, run the API with Maven, the admin with npm start, and the POS with mvn javafx:run. The API requires MERCADO_ONE_JWT_SECRET and a development user set by environment variable.

  • Checks are separate: mvn test for the API and the POS, npm test for the admin.
  • The docs record 33 test methods in the API, 56 specs in the admin, and 8 test methods in the POS.
  • That count lives in the repository text. The latest update of that page says the suite was not rerun there.
  • The live pilot answers GET /api/system/info with version 0.1.0-SNAPSHOT. The POS usage guide covers search, a cart, one payment, and the text receipt.

07 / Product experience

The cashier uses one screen: product and customer search, a cart, a single payment, and a text receipt. The receipt appears before the API responds. The admin covers records, stock, sales, customers, suppliers, and the conflict queue.

  • Roles are ADMIN, GERENTE, OPERADOR_CAIXA, and ESTOQUISTA. The admin shell is not the cashier's screen.
  • The POS header stays on OFFLINE_READY. A sync-status enum exists, and the interface does not update it.
  • A conflict accepted in the admin reduces stock at the price charged on the POS. The POS is not told the outcome.

08 / Results

What can be demonstrated is the admin and API pilot, together with the desktop POS: catalog, basic inventory, a server-confirmed sale, an offline queue, and resolvable conflicts. This study publishes no in-store measurement.

  • The sales report filters by period, operator, customer, and status, and offers CSV plus top products.
  • On login, the POS resends PENDING and ERROR sales. CONFLICT is left out of that resend.
  • Post-sale cancellation, discounts, multiple payments on the POS screen, and a multi-item stock receipt in one POST are still outside this version.

09 / Retrospective

The design separates what the POS can promise from what the server confirms. The current limit is the return path: the admin resolves the conflict and the POS SQLite row stays CONFLICT.

  • Partial offline mode does not register products, cancel sales, or issue a fiscal document.
  • Modules still call each other through services and repositories. The intended boundary is documented as a target, not as the state of the code.
  • Store use would depend on the rest of the MVP. The Azure pilot publishes the admin and the API; it does not stand in for that store.