# Dashboard Manajemen Layanan Server Private Berbasis Web

Minmon is a student-friendly web application for managing private servers, hosted services, attached domains, and internal server notes. The system focuses on CRUD operations plus lightweight DNS monitoring, not deployment automation.

## Final Project Scope

This app allows an admin to:

- Manage servers
- Manage services running on each server
- Manage domains attached to services
- Manage notes/documentation for each server
- Run DNS A-record checks and compare resolved IPs with the expected server IP
- View a dashboard summary

## Main Features

- Better-auth admin login
- Dashboard summary for:
  - total servers
  - total services
  - total domains
  - matched domains
  - mismatched domains
  - unresolved domains
  - inactive/down services
  - recent notes
- Server CRUD
- Service CRUD
- Domain CRUD
- DNS check action
- Server notes CRUD
- Sample seeded admin and demo dataset

## Database / Entity Overview

### Server

- id
- name
- primaryIpAddress
- secondaryIpAddress
- operatingSystem
- location
- provider
- description
- status
- createdAt
- updatedAt

### Service

- id
- serverId
- name
- type
- internalPort
- externalPort
- protocol
- status
- description
- createdAt
- updatedAt

### Domain

- id
- serviceId
- name
- expectedServerIp
- lastResolvedIp
- lastResolvedIps
- resolutionStatus
- lastCheckedAt
- remarks
- lastCheckMessage
- createdAt
- updatedAt

### Note

- id
- serverId
- title
- content
- category
- createdAt
- updatedAt

### Relationships

- One server has many services
- One server has many notes
- One service belongs to one server
- One service has many domains
- One domain belongs to one service

## Tech Stack

- React
- TanStack Router
- tRPC
- PostgreSQL
- Drizzle ORM
- better-auth
- Effect (used narrowly for DNS checking)
- Bun
- Turborepo

## Local Run Instructions

1. Install dependencies

```bash
bun install
```

2. Create `apps/server/.env`

```env
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/minmon
BETTER_AUTH_SECRET=your-32-char-or-longer-secret-value-here
BETTER_AUTH_URL=http://localhost:3000
CORS_ORIGIN=http://localhost:5173
NODE_ENV=development
```

3. Start PostgreSQL if needed

```bash
bun run db:start
```

4. Apply database schema

```bash
bun run db:push
```

5. Seed sample data

```bash
bun run --filter @minmon/db db:seed
```

Seeded admin:

- Email: `admin@minmon.local`
- Password: `admin12345`

6. Run the application

```bash
bun run dev
```

7. Open the app

- Web: `http://localhost:5173`
- API: `http://localhost:3000`

## Docker Compose Deployment

Run the full stack with PostgreSQL, database initialization, API, and web UI:

```bash
cp .env.example .env
docker compose up -d
```

Default endpoints:

- Web: `http://localhost:3001`
- API: `http://localhost:3000`

On first startup, the database initializer applies the schema and seeds the sample admin only when the users table is empty.

Docker Compose reads the root `.env` file automatically. Edit it before startup if you need different ports, public URLs, credentials, or secrets.


## Project Structure

```text
minmon/
├── apps/
│   ├── web/
│   └── server/
├── packages/
│   ├── api/
│   ├── auth/
│   ├── db/
│   ├── env/
│   └── ui/
└── docs/
```

## Extra Assignment Deliverables

See:

- `docs/run-instructions.md`
- `docs/uml-guidance.md`
- `docs/report-outline.md`

## Notes

- DNS checking is limited to A record / IPv4 as required.
- Docker Compose is available for running the app stack; the app itself does not include SSH, reverse proxy, or host orchestration automation.
- Full workspace typecheck is still blocked by a pre-existing desktop typing issue for `three`, but the web app and server app are verified.
