Protocol Buffer definitions for the Flightpath drone control platform.
This repository contains the API contract definitions for Flightpath, a protocol-agnostic, multi-drone ground control system. The generated code is published as:
- Go module:
github.com/flightpath-dev/flightpath-proto- importable by Go projects - npm package:
@flightpath/flightpath-proto- importable by TypeScript/JavaScript projects
Manages drone connection lifecycle and health monitoring.
Flight control commands (arm, takeoff, land, navigation).
Real-time telemetry streaming (position, attitude, battery, etc.).
Autonomous mission planning and execution.
Server-side configuration and mission storage.
This repository publishes generated Go code as a Go module that can be imported by other Go projects.
Add the module to your Go project:
go get github.com/flightpath-dev/flightpath-proto@latestOr specify a specific version:
go get github.com/flightpath-dev/flightpath-proto@v1.0.0Import the generated code in your Go files:
import (
"github.com/flightpath-dev/flightpath-proto/gen/go/drone/v1"
"github.com/flightpath-dev/flightpath-proto/gen/go/drone/v1/dronev1connect"
)package main
import (
"context"
"log"
"net/http"
"github.com/flightpath-dev/flightpath-proto/gen/go/drone/v1"
"github.com/flightpath-dev/flightpath-proto/gen/go/drone/v1/dronev1connect"
"connectrpc.com/connect"
)
func main() {
// Use the generated types
position := &dronev1.Position{
Latitude: 37.7749,
Longitude: -122.4194,
AltitudeMsl: 100.0,
}
// Use the generated Connect clients
client := dronev1connect.NewConnectionServiceClient(
http.DefaultClient,
"https://api.example.com",
)
// Make RPC calls
resp, err := client.Connect(context.Background(), connect.NewRequest(&dronev1.ConnectRequest{
DroneId: "drone-001",
}))
if err != nil {
log.Fatal(err)
}
// Use resp...
_ = position
_ = resp
}This repository publishes generated TypeScript/JavaScript code as an npm package that can be imported by other TypeScript/JavaScript projects.
Install the package using npm:
npm install @flightpath/flightpath-protoOr using yarn:
yarn add @flightpath/flightpath-protoOr using pnpm:
pnpm add @flightpath/flightpath-protoImport the generated code in your TypeScript/JavaScript files:
import { ConnectionService } from '@flightpath/flightpath-proto/gen/ts/drone/v1/connection_connect.js';
import { ConnectRequest, ConnectResponse } from '@flightpath/flightpath-proto/gen/ts/drone/v1/connection_pb.js';
import { Position } from '@flightpath/flightpath-proto/gen/ts/drone/v1/types_pb.js';import { createPromiseClient } from '@connectrpc/connect';
import { createConnectTransport } from '@connectrpc/connect-web';
import { ConnectionService } from '@flightpath/flightpath-proto/gen/ts/drone/v1/connection_connect.js';
import { ConnectRequest } from '@flightpath/flightpath-proto/gen/ts/drone/v1/connection_pb.js';
import { Position } from '@flightpath/flightpath-proto/gen/ts/drone/v1/types_pb.js';
// Create a transport
const transport = createConnectTransport({
baseUrl: 'https://api.example.com',
});
// Create a client
const client = createPromiseClient(ConnectionService, transport);
// Use the generated types
const position: Position = {
latitude: 37.7749,
longitude: -122.4194,
altitudeMsl: 100.0,
};
// Make RPC calls
const response = await client.connect({
droneId: 'drone-001',
timeoutMs: 5000,
});
console.log('Connected:', response.success);Make sure to install the required peer dependencies:
npm install @bufbuild/protobuf @connectrpc/connect- Server (Go): https://github.com/flightpath-dev/flightpath-server
- Client (React/TypeScript): https://github.com/flightpath-dev/flightpath-client
- Buf CLI
- Go 1.21 or later (for Go code generation)
- Node.js 20 or later (for TypeScript code generation and npm publishing)
buf lintbuf generate --template buf.gen.go.yamlGenerates code to gen/go/ with the correct import paths for the published module.
Important: After generating code, commit the generated files to the repository.
Important: The module path in go.mod and the go_package prefix in buf.gen.go.yaml must match the repository name. The import paths in the generated code must match the actual file locations in the repository.
After first publish:
- You can run
go mod tidyto update dependencies andgo.sum - Commit the updated
go.sumfile.
buf generate --template buf.gen.ts.yamlGenerates code to gen/ts/ with the correct import paths for the published npm package.
Important: After generating code, commit the generated files to the repository.
buf breaking --against '.git#branch=main'This repository uses semantic versioning (v1.0.0, v1.1.0, etc.) and manual releases.
-
Make your changes to the proto files in the
drone/v1/directory -
Test locally:
buf lint buf breaking --against '.git#branch=main' -
Generate code:
buf generate --template buf.gen.go.yaml buf generate --template buf.gen.ts.yaml
-
Update version (if needed):
- Update
package.jsonversion for npm releases - The Go module version is determined by the git tag
- Update
-
Commit all changes:
git add drone/v1/ gen/go/ gen/ts/ package.json git commit -m "feat: add new field to ConnectionRequest" -
If this is after the first publish, update go.sum:
go mod tidy git add go.sum git commit -m "chore: update go.sum" -
Create and push the tag:
git tag -a v1.1.0 -m "Release v1.1.0" git push origin main git push origin v1.1.0 -
Publish to npm (if needed):
npm publish --access public
-
Users can then update:
Go:
go get github.com/flightpath-dev/flightpath-proto@v1.1.0
TypeScript/JavaScript:
npm install @flightpath/flightpath-proto@1.1.0
- MAJOR (v2.0.0): Breaking changes to the API
- MINOR (v1.1.0): New features, backward compatible
- PATCH (v1.0.1): Bug fixes, backward compatible
To publish the package to npm:
-
Log in to npm (if not already):
npm login
-
Publish the package:
npm publish --access public
Make sure the version in
package.jsonmatches your git tag (without thevprefix).
buf pushMIT