Skip to main content

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.

Environment variables in DRTC Fluvial Admin control one critical thing: where the application finds the NestJS backend. The panel uses a single variable, NEXT_PUBLIC_API_URL, to construct the proxy destination in next.config.ts. Without this variable set correctly, every API call in the panel — from authentication to vessel registration — will fail.

Required variable

VariableTypeRequiredDescription
NEXT_PUBLIC_API_URLstringYesBase URL of the NestJS backend, including scheme and port (no trailing slash). Used in next.config.ts to proxy all /api/* requests to /api/v1/* on the backend. Example: http://localhost:3001
The NEXT_PUBLIC_ prefix makes this variable available in both server-side code (like next.config.ts) and in client-side React components. Without this prefix, the variable would only be accessible in server-side contexts.

Setting up your .env.local file

Next.js automatically loads variables from .env.local during development. Create this file at the project root:
.env.local
NEXT_PUBLIC_API_URL=http://localhost:3001
The .gitignore already excludes all .env* files, so this file will never be committed to version control.

How the proxy rewrite works

The next.config.ts file uses Next.js rewrites to transparently forward API calls from the frontend to the NestJS backend:
next.config.ts
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  async rewrites() {
    return [
      {
        source: "/api/:path*",
        destination: `${process.env.NEXT_PUBLIC_API_URL}/api/v1/:path*`,
      },
    ];
  },
};

export default nextConfig;
When the admin panel makes a request to /api/auth/login, Next.js rewrites it internally to http://localhost:3001/api/v1/auth/login. The browser never sees the backend URL directly — it only talks to the Next.js server.

Development vs. production configuration

Point the variable to your locally running NestJS instance:
.env.local
NEXT_PUBLIC_API_URL=http://localhost:3001
Then start the development server:
pnpm dev
If you see ECONNREFUSED errors or blank data in the dashboard, confirm that NEXT_PUBLIC_API_URL points to a running backend and that the URL does not include a trailing slash.

Build docs developers (and LLMs) love