Docs / HTTPS

HTTPS

hopak generate cert — local HTTPS in one command.

Two steps. Generate a dev cert once:

hopak generate cert
# writes .hopak/certs/dev.{key,crt} + a local .gitignore

Requires openssl on the machine. Then enable HTTPS in config:

// hopak.config.ts
import { defineConfig } from '@hopak/core';

export default defineConfig({
  server: {
    https: { enabled: true, port: 3443 },
  },
});
// main.ts — no changes needed
import { hopak } from '@hopak/core';
await hopak().listen();

If HTTPS is on and the cert files aren’t present, hopak dev stops with a message pointing back to hopak generate cert. The runtime doesn’t shell out to openssl on its own any more.

In production: supply your own cert and key paths:

server: {
  https: { enabled: true, cert: '/etc/ssl/cert.pem', key: '/etc/ssl/key.pem' },
}