The manifest for your Modus app allows you to configure the exposure and
resources for your functions at runtime. You define the manifest in the
modus.json file within the root of directory of your app.
Endpoints make your functions available outside of your Modus app. The
endpoints object in the app manifest allows you to define these endpoints for
integration into your frontend or federated API.Each endpoint requires a unique name, specified as a key containing only
alphanumeric characters and hyphens.
Only a GraphQL endpoint is available currently, but the modular design of
Modus allows for the introduction of additional endpoint types in the future.
This endpoint type supports the GraphQL protocol to communicate with external
clients. You can use a GraphQL client, such as
urql or
Apollo Client, to interact
with the endpoint.Example:
Connections establish connectivity and access to external services. Theyโre used
for HTTP and GraphQL APIs, database connections, and externally hosted AI
models. The connections object in the app manifest allows you to define these
hosts, for secure access from within a function.Each connection requires a unique name, specified as a key containing only
alphanumeric characters and hyphens.Each connection has a type property, which controls how itโs used and which
additional properties are available. The following table lists the available
connection types:
Type
Purpose
Function Classes
http
Connect to an HTTP(S) web server
http, graphql, models
dgraph
Connect to a Dgraph database
dgraph
mysql
Connect to a MySQL database
mysql
neo4j
Connect to a Neo4j database
neo4j
postgresql
Connect to a PostgreSQL database
postgresql
Donโt include secrets directly in the manifest!If your connection requires authentication, you can include placeholders in
connection properties which resolve to their respective secrets at runtime.When developing locally,
set secrets using environment variables.When deployed on Hypermode, set the actual secrets via the Hypermode Console,
where theyโre securely stored until needed.
This connection type supports the HTTP and HTTPS protocols to communicate with
external hosts. You can use the HTTP APIs in
the Modus SDK to interact with the host.This connection type is also used for
GraphQL APIs and to invoke externally
hosted AI models.Example:
If provided, requests on the connection include these headers. Each key-value pair is a header name and value.Values may include variables using the {{VARIABLE}} template syntax, which
resolve at runtime to environment variables provided for each connection, via
the Hypermode Console.
Examples
This example specifies a header named Authorization that uses the Bearer
scheme. A secret named AUTH_TOKEN provides the token:
This example specifies a header named X-API-Key provided by a secret named
API_KEY:
Copy
Ask AI
"headers": { "X-API-Key": "{{API_KEY}}"}
You can use a special syntax for connections that require
HTTP basic authentication.
In this example, secrets named USERNAME and PASSWORD combined and then are
base64-encoded to form a compliant Authorization header value:
If provided, requests on the connection include these query parameters, appended
to the URL. Each key-value pair is a parameter name and value.Values may include variables using the {{VARIABLE}} template syntax, which
resolve at runtime to secrets provided for each connection, via the Hypermode
Console.
Example
This example specifies a query parameter named key provided by a secret named
API_KEY:
This connection type supports connecting to Dgraph databases. You can use the
Dgraph APIs in the Modus SDK to interact
with the database.There are two ways to connect to Dgraph:
This is the preferred method for connecting to Dgraph. It uses a simplified URI
based connection string to specify all options, including host, port, options,
and authentication.Example:
This is the older method for connecting to Dgraph. It uses a gRPC target to
specify the host and port, and a separate key for authentication. It
automatically uses SSL mode (with full CA verification) for the connection -
except when connecting to localhost.Additional options such as username/password authentication arenโt supported. If
you need to use these options, use the connection string method instead.Example:
The connection string for the MySQL database.Values may include variables using the {{VARIABLE}} template syntax, which
resolve at runtime to secrets provided for each connection, via the Hypermode
Console.The connection string in the preceding example includes:
A username and password provided by secrets named USERNAME & PASSWORD
A host named db.example.com on port 3306
A database named dbname
Encryption enabled via tls=true - which is highly recommended for secure
connections
Set the connection string using a URI format
as described in the MySQL documentation.However, any optional parameters provided should be in the form specified by the
Go MySQL driver used by the Modus Runtime,
as described hereFor example, use tls=true to enable encryption (not sslmode=require).
This connection type supports connecting to PostgreSQL databases. You can use
the PostgreSQL APIs in the Modus SDK to
interact with the database.Example:
The connection string for the PostgreSQL database.Values may include variables using the {{VARIABLE}} template syntax, which
resolve at runtime to secrets provided for each connection, via the Hypermode
Console.The connection string in the preceding example includes:
A username and password provided by secrets named PG_USER & PG_PASSWORD
A host named db.example.com on port 5432
A database named data
SSL mode set to require - which is highly recommended for secure connections
Managed PostgreSQL providers often provide a pre-made connection string for you
to copy. Check your providerโs documentation for details.For example, if using Neon, refer to the
Neon documentation.
AI models are a core resource for inferencing. The models object in the app
manifest allows you to easily define models, whether hosted by Hypermode or
another host.Each model requires a unique name, specified as a key, containing only
alphanumeric characters and hyphens.
Specify "hypermode" for models that Hypermode hosts.
Otherwise, specify a name that matches a connection defined in the
connections section of the manifest.
When using hugging-face as the provider and hypermode as the connection,
Hypermode automatically facilitates the connection to an instance of a shared or
dedicated instance of the model. Your projectโs functions securely access the
hosted model, with no further configuration required.