2026-05-05 00:01:06 +03:30
|
|
|
# Dyolink — Frontend (Next.js)
|
2026-04-23 15:33:11 +03:30
|
|
|
|
2026-05-05 00:01:06 +03:30
|
|
|
## Prerequisites
|
2026-04-23 15:33:11 +03:30
|
|
|
|
2026-05-05 00:01:06 +03:30
|
|
|
- **Node.js 20+** and **npm**
|
|
|
|
|
|
|
|
|
|
## First-time setup
|
|
|
|
|
|
|
|
|
|
1. **Clone the monorepo** and go to the frontend app:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
git clone <repository-url> dyolink
|
|
|
|
|
cd dyolink/frontend
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
2. **Install dependencies**
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
npm install
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
3. **Environment**
|
|
|
|
|
|
|
|
|
|
Create **`.env.local`** in this folder (not committed to git) with the public URLs your browser will use:
|
|
|
|
|
|
|
|
|
|
```env
|
|
|
|
|
NEXT_PUBLIC_APP_URL=http://localhost:3001
|
|
|
|
|
NEXT_PUBLIC_API_URL=http://localhost:3000/api
|
|
|
|
|
NEXT_PUBLIC_APP_NAME=Dyolink
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- Adjust **`NEXT_PUBLIC_API_URL`** if the Nest API runs on another host/port.
|
|
|
|
|
- These values are baked in at **build time** for production images; for local dev, restart `npm run dev` after changing them.
|
|
|
|
|
|
|
|
|
|
## Run (development)
|
2026-04-23 15:33:11 +03:30
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
npm run dev
|
|
|
|
|
```
|
|
|
|
|
|
2026-05-05 00:01:06 +03:30
|
|
|
Open **`http://localhost:3001`** (dev server uses port **3001** so it does not clash with the API on 3000).
|
2026-04-23 15:33:11 +03:30
|
|
|
|
2026-05-05 00:01:06 +03:30
|
|
|
Ensure the backend is running and `NEXT_PUBLIC_API_URL` matches its base URL (including `/api` if your API is mounted there).
|
2026-04-23 15:33:11 +03:30
|
|
|
|
2026-05-05 00:01:06 +03:30
|
|
|
## After pulling latest `main`
|
2026-04-23 15:33:11 +03:30
|
|
|
|
2026-05-05 00:01:06 +03:30
|
|
|
```bash
|
|
|
|
|
git pull
|
|
|
|
|
npm install
|
|
|
|
|
```
|
2026-04-23 15:33:11 +03:30
|
|
|
|
2026-05-05 00:01:06 +03:30
|
|
|
## Useful commands
|
2026-04-23 15:33:11 +03:30
|
|
|
|
2026-05-05 00:01:06 +03:30
|
|
|
| Command | Purpose |
|
|
|
|
|
|--------|---------|
|
|
|
|
|
| `npm run dev` | Development server (port 3001) |
|
|
|
|
|
| `npm run build` | Production build |
|
|
|
|
|
| `npm run start` | Serve production build (port 3000 — used inside Docker) |
|
|
|
|
|
| `npm run lint` | ESLint |
|
2026-04-23 15:33:11 +03:30
|
|
|
|
2026-05-05 00:01:06 +03:30
|
|
|
## Docker
|
2026-04-23 15:33:11 +03:30
|
|
|
|
2026-05-05 00:01:06 +03:30
|
|
|
Image build and build-args (`NEXT_PUBLIC_*`) are documented in the **repository root `README.md`**.
|