Skip to content

Commit 32583e7

Browse files
committed
doc: update documentation and styles
1 parent 89a54b1 commit 32583e7

2 files changed

Lines changed: 94 additions & 20 deletions

File tree

docs/get-started/installation.md

Lines changed: 86 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,41 @@
11
---
22
title: "Install Mokapi: Quick & Easy Setup Guide"
3-
description: Learn how to install Mokapi effortlessly across Windows, macOS, and Linux. Follow the step-by-step guide for a smooth setup experience.
3+
description: Install Mokapi on Windows, macOS, Linux, Docker, or Node.js. Follow a simple step-by-step guide to get started quickly.
4+
subtitle: Get Mokapi running in seconds on Windows, macOS, Linux, Docker, or Node.js.
5+
cards:
6+
items:
7+
- title: Run Your First Mock
8+
href: /docs/get-started/running
9+
description: Learn how to start Mokapi and mock your first API
10+
- title: Explore Tutorials
11+
href: /resources
12+
description: Follow step-by-step guides for REST, Kafka, LDAP, and SMTP
13+
- title: Write Scripts
14+
href: /docs/javascript-api/overview
15+
description: Add dynamic behavior to your mocks with JavaScript
16+
- title: Configure Mokapi
17+
href: /docs/configuration/overview
18+
description: Customize ports, providers, and other settings
419
---
520
# Install Mokapi
621

7-
Mokapi is an open-source tool designed to simplify API mocking and schema validation.
8-
It enables developers to prototype, test, and demonstrate APIs with realistic data and
9-
scenarios. This guide provides straightforward instructions to install Mokapi on various
10-
platforms.
22+
## Overview
23+
24+
Mokapi is an open-source API mocking tool that helps you develop and test faster by simulating REST APIs, Kafka topics,
25+
LDAP directories, and SMTP servers. This guide shows you how to install Mokapi on your platform.
26+
27+
Choose your preferred installation method based on your platform and workflow.
28+
29+
```` box=benefits title="Try Without Installing"
30+
Test Mokapi instantly with npx (requires Node.js):
31+
32+
```bash style=simple
33+
npx go-mokapi serve https://petstore3.swagger.io/api/v3/openapi.json
34+
```
35+
36+
37+
This starts a mock server immediately without permanent installation. Perfect for quick tests and demos.
38+
````
1139

1240
## Installation Options
1341

@@ -16,23 +44,39 @@ Choose your preferred method below:
1644

1745
::: tabs
1846

47+
@tab "NPM"
48+
49+
If you prefer to install Mokapi globally as a Node.js package, install [go-mokapi](https://www.npmjs.com/package/go-mokapi)
50+
using:
51+
52+
```bash
53+
npm install -g go-mokapi
54+
```
55+
56+
After installation, the mokapi command is available globally.
57+
1958
@tab "macOS"
2059

2160
### Homebrew
2261

62+
Install via Homebrew for easy updates and management:
63+
2364
```bash
2465
brew tap marle3003/tap
2566
brew install mokapi
2667
```
2768

2869
### Direct Download
2970

30-
Download the latest macOS version from [GitHub](https://github.com/marle3003/mokapi/releases)
71+
Download the latest macOS binary from [GitHub](https://github.com/marle3003/mokapi/releases). Extract
72+
archive and move the binary to your PATH.
3173

3274
@tab "Windows"
3375

3476
### Chocolatey
3577

78+
Install via Chocolatey for easy updates:
79+
3680
```Powershell
3781
choco install mokapi
3882
```
@@ -43,6 +87,8 @@ Download the latest Windows version from [GitHub](https://github.com/marle3003/m
4387

4488
@tab "Linux"
4589

90+
Download the .deb package from the releases page and install:
91+
4692
### Direct Download
4793

4894
Download file appropriate for your Linux distribution and ARCH from the [release page](https://github.com/marle3003/mokapi/releases), then install with
@@ -57,34 +103,54 @@ rpm -i mokapi_{version}_linux_{arch}.rpm
57103

58104
@tab "Docker"
59105

60-
To get started with Mokapi using Docker, visit [DockerHub](https://hub.docker.com/r/mokapi/mokapi/tags) for a list of available images.
61-
You can also use a custom base Docker image as demonstrated in [these examples](/resources/examples/mokapi-with-custom-base-image.md).
106+
Mokapi provides official Docker images on [Docker Hub](https://hub.docker.com/r/mokapi/mokapi):
62107

63108
```
64109
docker pull mokapi/mokapi
65110
```
66111

67-
@tab "NPM"
112+
:::
68113

69-
If you prefer to install Mokapi as a Node.js package, install [go-mokapi](https://www.npmjs.com/package/go-mokapi)
70-
using:
114+
```` box=info title="Verify Installation"
115+
After installation, verify Mokapi is working:
71116
72-
```bash
73-
npm install -g go-mokapi
117+
```bash style=simple
118+
mokapi --version
74119
```
75120
76-
:::
121+
````
77122

78-
### Mokapi Scripts Type Definitions
123+
## TypeScript Support
79124

80-
Mokapi allows you to write **custom scripts** to handle API events or modify responses.
81-
For full type safety and autocompletion in TypeScript, you can install the [`@types/mokapi`](https://www.npmjs.com/package/@types/mokapi`) package:
125+
For full type safety and autocompletion when writing Mokapi scripts in TypeScript, install the type definitions:
82126

83127
```bash
84128
npm install --save-dev @types/mokapi
85129
```
86130

87-
## Next steps
131+
This enables IntelliSense and type checking in your IDE when writing custom event handlers and scripts.
132+
133+
### Example TypeScript Script
134+
135+
```typescript title=petstore.ts
136+
import { on } from 'mokapi'
137+
138+
export default function() {
139+
on('http', (request, response) => {
140+
// TypeScript provides full autocompletion here
141+
if (request.path.petId === '999') {
142+
response.statusCode = 404
143+
response.data = { message: 'Pet not found' }
144+
}
145+
})
146+
}
147+
```
148+
``` box=tip title="IDE Integration"
149+
With @types/mokapi installed, editors like VS Code will provide autocompletion for Mokapi's API, making script development faster and less error-prone.
150+
```
151+
152+
## What's Next?
153+
154+
Now that Mokapi is installed, here's what you can do:
88155

89-
- [Create your first Mock](/docs/get-started/running.md)
90-
- [Install @types/mokapi](https://www.npmjs.com/package/@types/mokapi)
156+
{{ card-grid key="cards" }}

webui/src/views/DocsView.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,11 @@ a[name] {
599599
background-color: var(--card-background);
600600
}
601601
602+
.box.benefits .box-heading {
603+
color: var(--color-green);
604+
font-size: 1.1rem;
605+
}
606+
602607
.box.feature {
603608
margin-top: 1rem;
604609
margin-bottom: 2rem;
@@ -683,6 +688,9 @@ pre.simple {
683688
pre.simple code {
684689
padding: 0;
685690
}
691+
pre.simple:has(+ p) {
692+
margin-bottom: 12px;
693+
}
686694
pre::before {
687695
content: attr(data-label);
688696
position: absolute;

0 commit comments

Comments
 (0)