Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
run: pnpm install --frozen-lockfile

- name: Build — api-client
run: pnpm --filter @reliefhub/api-client build
run: pnpm --filter @responsegrid/api-client build

# warehouse-core is a workspace dependency of api: build it (dist/cjs +
# dist/esm) before nest build resolves it via the exports map.
Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Multi-emergency **material aid coordination + logistics** platform (org: **Globa
- **pnpm monorepo**, `packageManager: pnpm@10.33.4` (pinned — use corepack; do NOT let pnpm 11 regenerate the lockfile).
- **`apps/api`** — NestJS 11, **hexagonal / DDD** (ports & adapters, CQRS-light, domain events via Redis/BullMQ), Drizzle ORM, Postgres 16, Redis 7. Swagger at `/docs`.
- **`apps/web`** — Next 16 (App Router, React 19), **Atomic Design**, Tailwind 4, Leaflet + `leaflet.markercluster`. Consumes the typed client. (See `apps/web/AGENTS.md` for Next-16 specifics.)
- **`packages/api-client`** — `@reliefhub/api-client`, openapi-fetch typed client. Regenerate with `pnpm gen:api`.
- **`packages/api-client`** — `@responsegrid/api-client`, openapi-fetch typed client. Regenerate with `pnpm gen:api`.
- TDD throughout. Dev infra via docker-compose.

## Architecture
Expand Down Expand Up @@ -73,7 +73,7 @@ pnpm --filter api exec eslint "{src,apps,libs,test}/**/*.ts" --max-warnings=0
pnpm --filter api exec prettier --check "src/**/*.ts" "test/**/*.ts"
pnpm --filter api test # runInBand; global-setup spins up reliefhub_test + applies migrations
# web (build the api-client first):
pnpm --filter @reliefhub/api-client build && pnpm --filter web build
pnpm --filter @responsegrid/api-client build && pnpm --filter web build
pnpm --filter web lint
```

Expand Down
100 changes: 16 additions & 84 deletions apps/api/README.md
Original file line number Diff line number Diff line change
@@ -1,98 +1,30 @@
<p align="center">
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
</p>
# ResponseGrid · API

[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
[circleci-url]: https://circleci.com/gh/nestjs/nest
API de la **plataforma de coordinación de ayuda material y logística en emergencias** de [Global Emergency](https://globalemergency.online). Construida con **NestJS 11** siguiendo arquitectura **hexagonal / DDD** (puertos y adaptadores, bounded contexts), **Drizzle ORM** sobre **PostgreSQL 16** y **Redis 7** (BullMQ) para eventos de dominio.

<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow" alt="Follow us on Twitter"></a>
</p>
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
> Para la visión de conjunto del monorepo, la arquitectura y el roadmap, consulta el [`README.md`](../../README.md) raíz y **[`AGENTS.md`](../../AGENTS.md)** (guía canónica de convenciones).

## Description

[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.

## Project setup

```bash
$ pnpm install
```

## Compile and run the project

```bash
# development
$ pnpm run start

# watch mode
$ pnpm run start:dev

# production mode
$ pnpm run start:prod
```

## Run tests
## Puesta en marcha

```bash
# unit tests
$ pnpm run test

# e2e tests
$ pnpm run test:e2e

# test coverage
$ pnpm run test:cov
pnpm install # desde la raíz del monorepo
docker compose up -d # Postgres (5433) + Redis (6380)
cp apps/api/.env.example apps/api/.env # rellena JWT_SECRET (≥32 chars en prod)
pnpm --filter api start:dev # API en http://localhost:3000 · Swagger en /docs
```

## Deployment

When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information.

If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps:
## Calidad

```bash
$ pnpm install -g @nestjs/mau
$ mau deploy
pnpm --filter api build # nest build — gate crítico de CI (tsc estricto)
pnpm --filter api lint # ESLint (max-warnings=0)
pnpm --filter api test # unitarios + integración (jest --runInBand)
```

With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.

## Resources

Check out a few resources that may come in handy when working with NestJS:

- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).
- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).
- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).

## Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).

## Stay in touch
Desarrollo guiado por **TDD**; Clean Code, SOLID y DDD. El `domain/` y `application/` no importan `@nestjs/*`, Drizzle ni infraestructura (regla de ESLint).

- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
- Website - [https://nestjs.com](https://nestjs.com/)
- Twitter - [@nestframework](https://twitter.com/nestframework)
> **Tras tocar DTOs/endpoints:** `pnpm gen:api` regenera el cliente tipado (`packages/api-client/src/schema.ts`).

## License
## Licencia

Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).
Publicada bajo **[GNU AGPL-3.0](../../LICENSE)**. Es la licencia autoritativa de todo el código del proyecto (copyleft de red: si ofreces el servicio en red, debes publicar el código fuente correspondiente). La licencia de los **datos** que expone la API pública es distinta: **CC BY-SA 4.0** (ver el portal `/docs`).
2 changes: 1 addition & 1 deletion apps/web/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { NextConfig } from 'next';
import path from 'path';

const nextConfig: NextConfig = {
transpilePackages: ['@reliefhub/api-client'],
transpilePackages: ['@responsegrid/api-client'],
turbopack: {
root: path.resolve(__dirname, '../..'),
},
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"test": "node --test \"src/**/*.test.ts\""
},
"dependencies": {
"@reliefhub/api-client": "workspace:*",
"@responsegrid/api-client": "workspace:*",
"leaflet": "^1.9.4",
"leaflet.markercluster": "^1.5.3",
"next": "16.2.9",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/public/llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> Plataforma open source de coordinación de ayuda material y logística en emergencias, de Global Emergency. Se activa por catástrofe: conecta a ciudadanía, organizaciones y coordinación para que la ayuda llegue donde hace falta sin saturar la logística. Información oficial, verificada y en tiempo real. Los datos se aíslan por emergencia y se sirven en HTML renderizado en servidor (citable directamente).

## Qué hace la plataforma (todo gratuito y de código abierto, licencia MIT)
## Qué hace la plataforma (todo gratuito y de código abierto, licencia AGPL-3.0)

- Puntos de acopio y logísticos verificados, cada uno con su inventario de material declarado.
- Necesidades de material validadas por coordinación local, con frescura de 48 h.
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/adapters/search-supplies.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fromSupplyDto, type CatalogueSupply } from '@/domain/supplies/catalogue-supply';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';

type SupplyDto = components['schemas']['SupplyDto'];

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/admin/audit/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { getToken, authHeaders } from '@/lib/auth';
import { api } from '@/lib/api';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';

export type AuditEntryDto = components['schemas']['AuditEntryDto'];
export type AuditListResponseDto = components['schemas']['AuditListResponseDto'];
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/admin/points/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { requireSession, authHeaders, redirectToLogin } from '@/lib/auth';
import { revalidatePath } from 'next/cache';
import { api } from '@/lib/api';
import { getT } from '@/i18n/server';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';

export type ResourceAdminListItem =
components['schemas']['ResourceAdminViewDto'];
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/admin/templates/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { revalidatePath } from 'next/cache';
import { requireSession, getToken, authHeaders, redirectToLogin } from '@/lib/auth';
import { api } from '@/lib/api';
import { getT } from '@/i18n/server';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';

export type TemplateActionResult =
| { status: 'idle' }
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/docs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ for (const p of items) {
<div className="rounded-card border border-line bg-surface-alt p-5">
<h3 className="font-display text-base font-bold text-navy">{d.links_client_t}</h3>
<p className="mt-1.5 text-[14px] leading-[1.55] text-ink-soft">{d.links_client_b}</p>
<code className="mt-2 inline-block font-mono text-[12.5px] text-ink">@reliefhub/api-client</code>
<code className="mt-2 inline-block font-mono text-[12.5px] text-ink">@responsegrid/api-client</code>
</div>
</div>
</Section>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/e/[slug]/donar/ofrecer/actions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use server';

import { api } from '@/lib/api';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';
import { requireSession, authHeaders, redirectToLogin } from '@/lib/auth';
import { localizeBackendError } from '@/lib/backend-error-messages';
import { getT } from '@/i18n/server';
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/e/[slug]/mi-voluntariado/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { revalidatePath } from 'next/cache';
import { requireSession, authHeaders, redirectToLogin } from '@/lib/auth';
import { api } from '@/lib/api';
import { getT } from '@/i18n/server';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';

export type VolunteerProfile = components['schemas']['VolunteerViewDto'];
export type MyTask = components['schemas']['MyTaskViewDto'];
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/e/[slug]/mi-voluntariado/task-card.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import { useActionState } from 'react';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';
import { checkInTask, checkOutTask } from './actions';
import type { CheckActionResult } from './actions';
import { Button } from '@/components/atoms/button';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { revalidatePath } from 'next/cache';
import { redirect } from 'next/navigation';
import { api } from '@/lib/api';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';
import { requireSession, authHeaders, redirectToLogin } from '@/lib/auth';
import { parseSupplyLines } from '@/lib/supply-lines';
import { getT } from '@/i18n/server';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import { useActionState } from 'react';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';
import type { InventoryState } from './actions';
import { InventoryField } from '../../../registrar/inventory-field';
import { Button } from '@/components/atoms/button';
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/e/[slug]/mis-puntos/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { revalidatePath } from 'next/cache';
import { requireSession, authHeaders, redirectToLogin } from '@/lib/auth';
import { api } from '@/lib/api';
import { getT } from '@/i18n/server';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';

export type PublicStatus = components['schemas']['ResourceViewDto']['publicStatus'];

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/e/[slug]/ofrecer-transporte/actions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use server';

import { api } from '@/lib/api';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';
import { requireSession, authHeaders, redirectToLogin } from '@/lib/auth';
import { localizeBackendError } from '@/lib/backend-error-messages';
import { getT } from '@/i18n/server';
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/e/[slug]/peticion/actions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use server';

import { api } from '@/lib/api';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';
import { requireSession, authHeaders, redirectToLogin } from '@/lib/auth';
import { parseSupplyLines } from '@/lib/supply-lines';
import { localizeBackendError } from '@/lib/backend-error-messages';
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/e/[slug]/recepcion/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { redirect } from 'next/navigation';
import { api } from '@/lib/api';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';
import { requireSession, authHeaders, redirectToLogin } from '@/lib/auth';
import { getT } from '@/i18n/server';
import { parseSupplyLines } from '@/lib/supply-lines';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { revalidatePath } from 'next/cache';
import { requireSession, redirectToLogin, authHeaders } from '@/lib/auth';
import { api } from '@/lib/api';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';
import { getT } from '@/i18n/server';

export type ValidityReason = 'closed' | 'nonexistent' | 'moved' | 'outdated';
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/e/[slug]/registrar/actions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use server';

import { api } from '@/lib/api';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';
import { requireSession, authHeaders, redirectToLogin } from '@/lib/auth';
import { parseSupplyLines } from '@/lib/supply-lines';
import { localizeBackendError } from '@/lib/backend-error-messages';
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/e/[slug]/reportar/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { requireSession, authHeaders, redirectToLogin } from '@/lib/auth';
import { api } from '@/lib/api';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';
import { getT } from '@/i18n/server';

export type ReportType = 'incident' | 'stock' | 'status' | 'other';
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/e/[slug]/voluntario/actions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use server';

import { api } from '@/lib/api';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';
import { requireSession, authHeaders, redirectToLogin } from '@/lib/auth';
import { localizeBackendError } from '@/lib/backend-error-messages';
import { getT } from '@/i18n/server';
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/e/[slug]/voluntario/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { notFound } from 'next/navigation';
import { getEmergencyBySlug } from '@/lib/emergencies';
import { requireSession, authHeaders } from '@/lib/auth';
import { api } from '@/lib/api';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';
import { registerVolunteer } from './actions';
import { VoluntarioForm } from './voluntario-form';
import { AppBar } from '@/components/organisms/app-bar';
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/e/[slug]/voluntario/voluntario-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useActionState, useState, useEffect } from 'react';
import { LinkButton } from '@/components/atoms/link-button';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';
import type { VolunteerActionState } from './actions';
import { Button } from '@/components/atoms/button';
import { Input } from '@/components/atoms/input';
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/emergencies/[slug]/manage/actions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use server';

import { revalidatePath } from 'next/cache';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';
import { api } from '@/lib/api';
import { requireSession, authHeaders, redirectToLogin } from '@/lib/auth';
import { getT } from '@/i18n/server';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { revalidatePath } from 'next/cache';
import { api } from '@/lib/api';
import { requireSession, authHeaders, redirectToLogin } from '@/lib/auth';
import { getT } from '@/i18n/server';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';

export type ActionResult =
| { status: 'idle' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { redirectToLogin } from '@/lib/auth';
import { api } from '@/lib/api';
import { getEmergencyBySlug } from '@/lib/emergencies';
import { resolveManageAccess } from '@/lib/manage-access';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';
import { WorkQueue } from '@/components/organisms/work-queue';
import { QueueToolbar } from '@/components/molecules/queue-toolbar';
import { ShipmentsList } from '@/components/organisms/shipments-list';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { SearchBox } from '@/components/molecules/search-box';
import { EmptyState } from '@/components/molecules/empty-state';
import { getT } from '@/i18n/server';
import { getCategoriesCached } from '@/adapters/get-categories';
import type { paths } from '@reliefhub/api-client';
import type { paths } from '@responsegrid/api-client';

export const dynamic = 'force-dynamic';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { redirectToLogin } from '@/lib/auth';
import { api } from '@/lib/api';
import { getEmergencyBySlug } from '@/lib/emergencies';
import { resolveManageAccess } from '@/lib/manage-access';
import type { components } from '@reliefhub/api-client';
import type { components } from '@responsegrid/api-client';
import { WorkQueue } from '@/components/organisms/work-queue';
import { QueueToolbar } from '@/components/molecules/queue-toolbar';
import { OffersQueue } from '@/components/organisms/coordination-queues';
Expand Down
Loading
Loading