You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MaiAn is a B2B multiplatform application that connects wholesale distributors with retailers. It combines native client apps for different user profiles with a centralized, secure, and scalable backend built to grow with new business features.
The project is developed by dsqrwym (technical identifier) / MaiAn (brand name).
Modular NestJS 11 + Fastify backend, deployable in single, cluster, or pm2 mode.
Full authentication: registration, email verification, role-based login (standard, enterprise, admin), refresh token with rotation, per-device session management, and password reset.
PostgreSQL 17 as primary persistence. Two Redis instances: one for cache / sessions / rate-limit, one for BullMQ queues.
Role-based access control with CASL.
Full category management: hierarchical, public/private, with multilingual translations.
Full product management: variants, multilingual translations, associated files.
File upload and retrieval with local storage driver and Cloudflare R2 / S3-compatible driver. Image processing with sharp; PDF generation with pdfmake.
Locations API: countries, provinces, cities, ISO numeric currencies.
Internal employee account creation for wholesalers (support, delivery, warehouse).
The backend also includes global exception filters, a unified response interceptor, structured logging with Pino, and centralized JWT configuration. Supports three process modes: single, native Node cluster, and pm2.
Features
Authentication & sessions
Retailer and wholesaler registration.
Email verification code.
Role-based login: standard, enterprise, admin.
httpOnly cookie for refresh token (web flow) with rotation and CSRF protection.
Password reset.
Session deletion and per-device session management.
Countries, provinces per country, cities per province.
Currencies by ISO numeric code.
Technology stack
Technology
Role
NestJS 11
Application framework
Fastify 5
High-performance HTTP adapter
Drizzle ORM
Primary ORM and migrations
PostgreSQL 17
Primary database
Redis 7
Cache, sessions, rate-limit, BullMQ queues
JWT / Passport
Authentication
CASL
Attribute-based access control
Swagger
API documentation
Pino
Structured logging
BullMQ
Async job queues
Nodemailer
Email delivery
nestjs-i18n
Internationalisation
typia / nestia
Type-safe validation and serialisation (fully migrated from class-validator)
sharp
Image processing
pdfmake
PDF generation
Validation and sanitisation policy
The backend distinguishes between two field types:
User input fields (name, companyName, description, etc.): require semantic sanitisation + strict validation before storage.
System fields (deviceName, langCode, timezone, etc.): must not be aggressively rewritten; validation is flexible or omitted for semantic normalisation.
A malformed value must never break business logic, persistence, or authorisation.
Database
Managed via Drizzle ORM. The full SQL schema is in Base_de_datos/schema.sql and is automatically imported by Docker Compose when the PostgreSQL container starts.
standard email: "standard@maian.com"; username: "standard"; password: "standard123";Plataforma B2B que conecta distribuidores y minoristas. App de escritorio con gestión catálogo, productos y pedidos;app móvil con catálogo, pedidos. B2B 平台,连接分销商与零售商。桌面端应用支持、商品、订单。移动端应用支持商品浏览、下单。