Apéndice técnico
Stack, estructura y contratos iniciales
Referencia técnica complementaria para la implementación del backend.
Stack backend
| Capa | Elección | Licencia |
|---|---|---|
| HTTP | chi | MIT |
| DB driver | pgx | BSD |
| Queries tipadas | sqlc | MIT |
| Migraciones | golang-migrate | MIT |
| Auth | golang-jwt/jwt + bcrypt | MIT + BSD-like |
| Validación | go-playground/validator | MIT |
| Observabilidad | Prometheus + OTel | Apache-2.0 |
| Testing | testcontainers-go | Apache-2.0 |
Estructura sugerida
cmd/
api/
worker/
control-plane/
internal/
platform/
auth/
config/
db/
http/
observability/
tenant/
modules/
iam/
catalog/
pos/
orders/
payments/
inventory/
purchasing/
ap/
sync/
reporting/
hospitality/
db/
migrations/
queries/
Endpoints base
POST /auth/login
POST /auth/refresh
GET /me
POST /me/context
GET/POST /users
GET/POST /roles
POST /user-assignments
GET/POST /organizations
GET/POST /business-units
GET/POST /products
GET/POST /categories
GET/POST /modifier-groups
GET/POST /modifiers
GET/POST /price-lists
GET/POST /price-rules
GET/POST /discounts
GET/POST /payment-methods
GET/POST /warehouses
GET/POST /pos/terminals
GET/POST /production-stations
POST /pos/sessions/open
POST /pos/sessions/{id}/close
POST /pos/sessions/{id}/reconcile
POST /orders
POST /orders/{id}/items
DELETE /orders/{id}/items/{itemId}
POST /orders/{id}/discounts
POST /orders/{id}/send-to-production
POST /orders/{id}/lock
POST /orders/{id}/reopen
POST /orders/{id}/cancel
POST /orders/{id}/payments
POST /payments/{id}/refund
POST /payments/{id}/void
GET/POST /suppliers
GET/POST /purchase-orders
GET/POST /purchase-receipts
POST /purchase-receipts/{id}/post
GET/POST /ap/documents
GET/POST /ap/payments
POST /ap/payments/{id}/apply
GET /sync/catalog/snapshot
GET /sync/events
POST /sync/commands