Every technology in this platform was selected with a 10-year maintainability horizon as the primary criterion, not short-term convenience or novelty. The Jurisdicción Sanitaria de Huejutla de Reyes requires a system that future contributors — who may not have been part of the original build — can understand, extend, and confidently deploy. That means favouring well-documented, widely-adopted tools with strong TypeScript support, active communities, and clear upgrade paths over clever or experimental alternatives. Every dependency must justify its presence; anything that adds complexity without adding long-term value is a liability.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/LMendoza70/SSA/llms.txt
Use this file to discover all available pages before exploring further.
Frontend
The frontend is a single-page application built with React and TypeScript, bundled by Vite. Each library was chosen because it solves a specific problem cleanly and integrates well with the rest of the stack.| Library | Version | Purpose |
|---|---|---|
| React | 18+ | UI component framework |
| TypeScript | 5+ | Type safety (strict mode) |
| Vite | 5+ | Build tool and dev server |
| Material UI | 5+ | Component library and design system |
| React Router | 6+ | Client-side routing |
| TanStack Query | 5+ | Server state management and caching |
| React Hook Form | 7+ | Form state management |
| Zod | 3+ | Schema validation (shared with backend) |
| Axios | 1+ | HTTP client with interceptors |
| Tiptap | 2+ | Rich text editor for CMS content |
Only functional components and hooks are used in the React layer. Class components are not permitted anywhere in the codebase.
Backend
The backend is a NestJS application structured as a modular monolith. It is designed to be extracted into microservices in the future if the operational load ever demands it, but it runs as a single deployable unit today.| Library | Version | Purpose |
|---|---|---|
| NestJS | 10+ | Modular Node.js framework |
| TypeScript | 5+ | Type safety (strict mode) |
| Prisma | 5+ | ORM and database migration |
| class-validator | — | DTO validation |
| class-transformer | — | Request/response transformation |
| Passport.js | — | Authentication strategy |
| bcrypt/Argon2 | — | Password hashing |
| Multer | — | File upload handling |
| Swagger/OpenAPI | — | Auto-generated API documentation |
Database & Infrastructure
The persistence layer is PostgreSQL, extended withpgvector to support the AI chatbot’s semantic search capability. Redis is optionally available for caching and session offloading at higher traffic volumes.
| Technology | Purpose |
|---|---|
| PostgreSQL 14+ | Primary relational database |
| pgvector | Vector embeddings for chatbot RAG |
| Redis (optional) | Caching and session storage |
id, createdAt, updatedAt, deletedAt, createdBy, and updatedBy columns. Soft delete (deletedAt) is preferred over hard deletion across all entities.
Authentication & Storage
Authentication is handled entirely on the backend using JWT access tokens paired with HttpOnly cookie-based refresh tokens. Passwords are hashed with Argon2. File storage begins on the local filesystem but the architecture abstracts all file access behind aStorageProvider interface — meaning the platform can migrate to Amazon S3, Azure Blob Storage, or Google Cloud Storage without touching any business logic.
Why These Choices?
NestJS over Express
NestJS over Express
NestJS brings built-in module boundaries, constructor-based dependency injection, decorator-driven routing, and first-class TypeScript support straight out of the box. For a long-lived application with multiple modules and multiple contributors, this structure prevents the “framework-less Express spaghetti” pattern that makes codebases hard to navigate after the first year. Its conventions align directly with the Clean Architecture and SOLID principles this project enforces.
Prisma over TypeORM
Prisma over TypeORM
Prisma provides a significantly better developer experience: its schema file is the single source of truth for the database structure, its generated client is fully type-safe at the query level, and its migration tooling is more reliable than TypeORM’s in production scenarios. Introspection, seeding, and rollback workflows are all first-class features. For a team that may not include a dedicated DBA, Prisma reduces the risk of schema drift.
Material UI
Material UI
Material UI is a complete component library with built-in accessibility support (ARIA attributes, keyboard navigation, contrast compliance), a comprehensive theming API, and a very large ecosystem of examples and community knowledge. It eliminates the need to build common UI patterns — tables, dialogs, form fields, navigation drawers — from scratch, which directly serves the goal of reducing frontend development time while keeping the result WCAG-compliant.
TanStack Query
TanStack Query
Server state — loading flags, error states, background refetching, cache invalidation — is notoriously tedious to manage with raw
useEffect and useState. TanStack Query handles all of it declaratively. Every data-fetching concern that previously required manual lifecycle management becomes a single useQuery or useMutation call. This reduces component complexity, eliminates entire categories of race-condition bugs, and makes the data layer easy to reason about at a glance.Zod for shared validation
Zod for shared validation
Related Pages
Coding Conventions
Naming rules, file structure, TypeScript standards, and Git commit format.
Testing Strategy
Unit and integration testing with Jest and Vitest.
Architecture Overview
Modular monolith structure, layers, and design principles.
API Conventions
REST endpoint patterns, versioning, and Swagger documentation.