Skip to content

5. Server Setup and Modes

piotr-iohk edited this page Dec 4, 2024 · 2 revisions

Once MinaMesh is installed, you can start the server in different modes depending on your use case. This section explains the available options, including enabling search transaction optimizations and running in playground mode.

1. Starting the Server

To start MinaMesh, use the serve command:

mina-mesh serve

By default, this command starts the server in standard mode with minimal configuration. However, you can modify its behavior using environment variables or command-line flags.

2. Enabling Search Transaction Optimizations

MinaMesh supports search transaction optimizations for faster query performance when working with large datasets in the Archive Node database. These optimizations rely on additional database features and must be explicitly enabled.

Apply Optimizations

To apply the optimizations, use the following command:

mina-mesh search-tx-optimizations apply

This command creates additional tables, indexes, and triggers in the Archive Node database, improving the performance of /search/transactions queries.

Start Server with Optimizations

After applying optimizations, start the server with the --use-search-tx-optimizations flag:

mina-mesh serve --use-search-tx-optimizations

This tells MinaMesh to utilize the optimized schema for transaction searches.

Check Optimization Status

You can verify if optimizations are applied using:

mina-mesh search-tx-optimizations check

If you need to remove the optimizations, use:

mina-mesh search-tx-optimizations drop

3. Playground Mode

MinaMesh includes a feature for serving an OpenAPI playground for exploring the API directly in your browser.

Enabling the Playground

To enable the OpenAPI playground, start MinaMesh with the --playground flag:

mina-mesh serve --playground

When this flag is present:

  • GET / responds with an OpenAPI playground interface, allowing you to interact with the MinaMesh API endpoints directly.
  • This is useful for testing and exploring the API.

🗒️ Note: The --playground flag affects only the GET / endpoint and does not change the behavior of other API endpoints.

Example Commands

Standard Mode

mina-mesh serve

With Search Transaction Optimizations

mina-mesh search-tx-optimizations apply
mina-mesh serve --use-search-tx-optimizations

Playground Mode

mina-mesh serve --playground