DRTC Fluvial Admin is a pure frontend application — it has no database of its own. All data, authentication, and business logic lives in a separate NestJS backend. The admin panel communicates with that backend through a combination of a Next.js proxy rewrite and a shared Axios instance. Understanding how these two layers work together is essential before you can run or extend the panel.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Bran258/drtc-fluvial-admin/llms.txt
Use this file to discover all available pages before exploring further.
API proxy setup
Thenext.config.ts rewrite maps every request from /api/* in the browser to /api/v1/* on the NestJS backend:
next.config.ts
/api/auth/login or /api/propietario, and Next.js handles the translation. The backend URL is never exposed to the browser.
Axios instance
All API calls go through a shared Axios instance defined inlib/axios.ts:
lib/axios.ts
baseURL: "/api"— every call is automatically prefixed with/api, which then gets rewritten by Next.js to the backend.withCredentials: true— cookies (including theaccessTokenhttpOnly cookie) are sent with every cross-origin request.
Authentication and session management
The panel uses two parallel mechanisms to track the authenticated user’s session:accessToken httpOnly cookie (set by NestJS)
After a successful POST /api/auth/login, the NestJS backend sets an accessToken httpOnly cookie. The browser stores and sends this cookie automatically on every request. The middleware in proxy.ts reads this cookie to protect routes server-side:
proxy.ts
access_token in localStorage (client-side)
The Axios request interceptor also reads a JWT from localStorage and attaches it as a Bearer token on every outgoing request:
lib/axios.ts
Automatic token refresh
When the backend returns a401 Unauthorized response, the Axios response interceptor transparently refreshes the session before retrying:
lib/axios.ts
localStorage and redirects the user to /auth.
Setting up the connection
Start the NestJS backend
The backend must be running and accessible before you start the admin panel. Confirm it responds at the URL you plan to use for
NEXT_PUBLIC_API_URL.Set the environment variable
Create
.env.local at the project root and point it to the backend:.env.local
API endpoints
The table below lists every backend endpoint the admin panel calls, grouped by domain.| Endpoint | Method | Purpose |
|---|---|---|
/auth/login | POST | Authenticate with email and password |
/auth/refresh | POST | Refresh the session using the httpOnly cookie |
/dashboard | GET | Fetch main dashboard summary data |
/dashboard/stats | GET | Fetch vessel registration statistics |
/propietario | GET | List all vessel owners (paginated) |
/propietario/:id | GET | Fetch a single owner by ID |
/propietario/search | GET | Search owners by DNI or RUC |
/propietario | POST | Create a new vessel owner |
/propietario/:id | PATCH | Update an existing vessel owner |
/propietario/importar | POST | Bulk import vessel owners |
/personas/lookup | GET | Look up a person by document number |
/catalogos/ubicaciones | GET | Fetch location catalog (department/province/district) |
/catalogos/tipos-nave | GET | Fetch vessel type catalog |
/catalogos/materiales | GET | Fetch vessel hull material catalog |
/catalogos/servicios-nave | GET | Fetch vessel service type catalog |
/catalogos/modalidades | GET | Fetch vessel operation modality catalog |
All paths above are relative to the proxy base (
/api). For example, /auth/login is called as /api/auth/login by the Axios instance, which Next.js rewrites to NEXT_PUBLIC_API_URL/api/v1/auth/login on the backend.