1
0
mirror of https://github.com/go-micro/go-micro.git synced 2026-06-09 19:16:58 +02:00
Files

76 lines
3.0 KiB
Markdown
Raw Permalink Normal View History

2025-11-13 18:12:15 +00:00
---
layout: default
---
# Micro Server (Optional)
2026-02-12 09:55:18 +00:00
The Micro server is an optional web dashboard and authenticated API gateway for production environments. It provides a secure entrypoint for discovering and interacting with services that are already running (e.g., managed by systemd via `micro deploy`).
**`micro server` does not build, run, or watch services.** It only discovers services via the registry and provides a UI/API to interact with them.
## micro server vs micro run
| | `micro run` | `micro server` |
|---|---|---|
| **Purpose** | Local development | Production dashboard |
| **Builds services** | Yes | No |
| **Runs services** | Yes (as child processes) | No (discovers already-running services) |
| **Hot reload** | Yes | No |
2026-02-12 10:55:13 +00:00
| **Authentication** | Yes (default `admin`/`micro`) | Yes (default `admin`/`micro`) |
| **Scopes** | Yes (`/auth/scopes`) | Yes (`/auth/scopes`) |
| **Dashboard** | Full gateway UI with auth, scopes, agent | Full dashboard with API explorer, logs, user/token management |
2026-02-12 09:55:18 +00:00
| **When to use** | Day-to-day development | Deployed environments, shared servers |
For local development, use [`micro run`](guides/micro-run.md) instead.
2025-11-13 18:12:15 +00:00
## Install
Install the CLI which includes the server command:
2025-11-13 18:17:45 +00:00
```bash
2026-02-12 09:56:19 +00:00
go install go-micro.dev/v5/cmd/micro@v5.16.0
2025-11-13 18:12:15 +00:00
```
> **Note:** Use a specific version instead of `@latest` to avoid module path conflicts. See [releases](https://github.com/micro/go-micro/releases) for the latest version.
2025-11-13 18:12:15 +00:00
## Run
Start the server:
2025-11-13 18:17:45 +00:00
```bash
2025-11-13 18:12:15 +00:00
micro server
```
2026-02-12 09:55:18 +00:00
Then open http://localhost:8080 and log in with the default admin account (`admin`/`micro`).
## Features
- **Web Dashboard** — Browse registered services, view endpoints, request/response schemas
- **API Gateway** — Authenticated HTTP-to-RPC proxy at `/api/{service}/{method}`
- **JWT Authentication** — All API endpoints require a Bearer token or session cookie
- **Token Management** — Generate, view, copy, and revoke JWT tokens
- **User Management** — Create, list, and delete users with bcrypt-hashed passwords
2026-02-12 10:55:13 +00:00
- **Endpoint Scopes** — Restrict which tokens can call which endpoints via `/auth/scopes`
- **MCP Integration** — AI agent playground and MCP tools, with scope enforcement
2026-02-12 09:55:18 +00:00
- **Logs & Status** — View service logs and status (PID, uptime) from the dashboard
## Typical Production Setup
After deploying services with [`micro deploy`](deployment.md):
```bash
# On your server, start the dashboard
micro server
```
Services managed by systemd are discovered via the registry and appear in the dashboard automatically. The server provides the authenticated API and web UI for interacting with them.
2025-11-13 18:12:15 +00:00
## When to use it
2026-02-12 09:55:18 +00:00
- You have services running in production (via systemd or otherwise) and want a web UI
- You need authenticated API access with JWT tokens
- You want user management and token revocation
- You're running a shared environment where multiple people interact with services
2026-02-12 09:56:19 +00:00
For CLI usage details, see the [CLI documentation on GitHub](https://github.com/micro/go-micro/blob/master/cmd/micro/README.md).