Skip to content

Quick start

This guide will walk you through creating your first Hyperterse API in under 5 minutes. By the end, you’ll have a working REST endpoint that queries your database.

  1. Initialize a new configuration

    Terminal window
    hyperterse init -o config.terse
  2. Define your database adapter(s)

    config.terse
    name: my-api
    adapters:
    my_database:
    connector: postgres
    connection_string: 'postgresql://user:password@localhost:5432/mydb'
  3. Define your query

    config.terse
    name: my-api
    adapters:
    my_database:
    connector: postgres
    connection_string: 'postgresql://user:password@localhost:5432/mydb'
    queries:
    get-users:
    use: my_database
    description: 'Retrieve all users'
    statement: |
    SELECT id, name, email, created_at
    FROM users
    ORDER BY created_at DESC
    LIMIT 100
  4. Start the server

    Terminal window
    hyperterse dev -f config.terse
  5. Your query is now available as a REST endpoint. Test it with curl:

    Terminal window
    curl -X POST http://localhost:8080/query/get-users \
    -H "Content-Type: application/json"

Queries can also accept input parameters. These can be substituted in the query statement to create dynamic queries.

config.terse
name: my-api
adapters:
my_database:
connector: postgres
connection_string: 'postgresql://user:password@localhost:5432/mydb'
queries:
get-users:
use: my_database
description: 'Retrieve all users'
statement: |
SELECT id, name, email, created_at
FROM users
ORDER BY created_at DESC
LIMIT 100
get-user-by-email:
use: my_database
description: 'Find a user by their email address'
statement: |
SELECT id, name, email, created_at
FROM users
WHERE email = {{ inputs.email }}
inputs:
email:
type: string
description: 'The email address to search for'

Now call it with an input:

Terminal window
curl -X POST http://localhost:8080/query/get-user-by-email \
-H "Content-Type: application/json" \
-d '{"email": "alice@example.com"}'

Hyperterse automatically generates documentation and tooling. Try opening http://localhost:8080/docs in your browser to see the auto-generated OpenAPI specification.

EndpointDescription
POST /query/{name}Execute a query
GET /docsOpenAPI 3.0 specification
GET /llms.txtAI-friendly documentation
POST /mcpMCP JSON-RPC 2.0 endpoint