Skip to content

Specular

Specular is an Open-Source DLS + Toolkit + Service to define modern API endpoints with automatic and ergonomic SDKs that feel like hand-written.

  1. Write a module.specular file
  2. Specular Cloud generates and hosts all SDKs privately for you and your team
  3. Backend developer implements generated boilerplate
  4. Frontend developer uses the private NPM module
  5. Client SDKs is marked as public and you’re done

Easy & familiar syntax

Use a clean, Go-like syntax that’s easy to read and write. Define your API structure with intuitive language constructs.

Fully typed error structures

Define structured error types that are automatically handled across all generated SDKs with full type safety.

Automatic Go Server and Client

Implement your API in Go and also get an ergonomic Client SDK

Automatic JS/TS NPM package

Get a fully typed TypeScript SDK automatically published as a private NPM package for your team. Works in Web, React Native and Node apps.

Reusable types and Libraries

Reuse types such as struct and errors across multiple API services.

Free Build Service

Automated cloud service builds and hosts your SDKs without any infrastructure setup or maintenance.

Example, the following is an API that simulates a Git hosting service:

module.specular
service package
/// A Git repository
struct Repository {
/// name of the git repository
name: string!
}
/// Occurs when the repository name is invalid
problem struct InvalidRepositoryNameProblem {
message: string!
}
resource Repository {
/// Creates a new Git repository
operation Create {
input struct {
name: string!
}
output struct {
repository: Repository
}
/// Occurs when a repository with such name already exists
raises struct RepositoryAlreadyExistsProblem {
name: string!
}
raises InvalidRepositoryNameProblem;
}

To get started, install the Deployport CLI:

Terminal window
sh curl -fsSL https://get.deployport.com | sh

Then initialize a new project in the current directory:

Terminal window
deployport specular init myns/mymod

It will create a few files:

module.specular
specular-module.yaml

When you’re ready:

Terminal window
deployport specular publish