App Manifest
Define the resources for your app
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.
Structure
Endpoints
Expose your functions for integration into your frontend or federated API
Connections
Establish connectivity for external endpoints and model hosts
Models
Define inference services for use in your functions
Collections
Define sets of text data to enable natural language search
Base manifest
A simple manifest, which exposes a single GraphQL endpoint with a bearer token for authentication, looks like this:
Endpoints
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.
GraphQL endpoint
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:
Always set to "graphql"
for this endpoint type.
The path for the endpoint. Must start with a forward slash /
.
The authentication method for the endpoint. Options are "bearer-token"
or
"none"
. See Authentication for additional details.
Connections
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 | Functions Namespaces |
---|---|---|
http | Connect to an HTTP(S) web server | http , graphql , models |
postgresql | Connect to a PostgreSQL database | postgresql |
dgraph | Connect to a Dgraph database | dgraph |
neo4j | Connect to a Neo4j database | neo4j |
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.
HTTP connection
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:
Always set to "http"
for this connection type.
Base URL for connections to the host. Must end with a trailing slash and may contain path segments if necessary.
Example: "https://api.example.com/v1/"
Full URL endpoint for connections to the host.
Example: "https://models.example.com/v1/classifier"
You must include either a baseUrl
or an endpoint
, but not both.
- Use
baseUrl
for connections to a host with a common base URL. - Use
endpoint
for connections to a specific URL.
Typically, you’ll use the baseUrl
field. However, some APIs, such as
graphql.execute
, require the full URL in the endpoint
field.
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 secrets provided for each connection, via the Hypermode
Console.
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.
PostgreSQL connection
This connection type supports connecting to PostgreSQL databases. You can use the PostgreSQL APIs in the Modus SDK to interact with the database.
Example:
Always set to "postgresql"
for this connection type.
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 port5432
- A database named
data
- SSL mode set to
require
- which is highly recommended for secure connections
Refer to the PostgreSQL documentation for more details on connection strings.
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.
Dgraph connection
This connection type supports connecting to Dgraph databases. You can use the Dgraph APIs in the Modus SDK to interact with the database.
Example:
Always set to "dgraph"
for this connection type.
The gRPC target for the Dgraph database.
The API key for the Dgraph database.
Neo4j connection
This connection type supports connecting to Neo4j databases. You can use the Neo4j APIs in the Modus SDK to interact with the database.
Example:
Always set to "neo4j"
for this connection type.
The URI for the Neo4j database.
The username for the Neo4j database.
The password for the Neo4j database.
Working locally with secrets
When you run your app locally using modus dev
, the runtime replaces the
placeholders of the manifest with values from environment variables defined in
your operating system or in .env
files.
The environment variables keys must be upper case and follow the naming convention:
MODUS_<CONNECTION NAME>_<PLACEHOLDER>
For example, with the following manifest:
The Modus runtime substitutes {{API_KEY}}
with the value of the environment
variable MODUS_OPENAI_API_KEY
An easy way to define the environment variables when working locally is to use
the file .env.dev.local
located in your app folder.
For the previous manifest, we can set the key in the .env.dev.local file as follow:
You should exclude .env
files from source control. Projects created with
modus new
exclude these files automatically when creating your project.
Models
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.
Original relative path of the model within the provider’s repository.
Source provider of the model. If the connection
value is hypermode
, this
field is mandatory. hugging-face
is currently the only supported option.
Connection for the model instance.
- 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. For more details, see
hosted models.
Collections
Collections simplify the usage of vector embeddings to build natural language
search features. The collections
object allows you to define indexed data
types that are automatically embedded and searchable based on the search method
you define.
Each collection requires a unique name, specified as a key, containing only alphanumeric characters and hyphens.
For more detail on implementing Collections, see Search.
Search methods define a pair of an embedder and index to make available for searching the data in your collection.
The function name to embed text added to the collection.
If provided, describes the index mechanism used by the search method. type
:
specifies the type of the index. For example, sequential
(default).
Was this page helpful?