Skip to main content
connic
Apps

Local Development

connic dev builds your apps on your machine, serves each build at the app's URL in the dev environment, and rebuilds when you save.

Last updated

connic dev applies apps/*.yaml and connectors/*.yaml to its dev environment the way a deploy does, and builds every app locally with its own build command. The app then runs against the agents of the dev session, with the same sign-in, connectors, and access rules as after a deploy.

Requirements

  • Node.js and the program the build command starts, such as npm, on your PATH. Without them, connic dev names what's missing and doesn't build the app.
  • The app's dependencies installed in apps/<key>/, for example with npm install. connic dev runs build.command only, not the install command.
  • A project on a plan that includes apps.

How it works

  1. connic dev uploads the project, including apps/*.yaml and connectors/*.yaml but not the app sources.

  2. connic creates, changes, and retires the connectors and apps those files declare in the dev environment, like the activation of a deploy, including sign-in, custom domains, and access rules.

  3. For each app, connic dev runs build.command in apps/<key>/, uploads the build.output folder, and prints the app's URL in the dev environment.

terminal
→ Building app portal...
    ✓ portal → https://portal-7e21c09f.connic.app

The dev environment has its own app with its own URL, which stays the same for a reusable dev environment. Dev builds aren't cached, so a reload shows the newest one. They have the same limits as deploys: an index.html in the output folder and the plan's output size per app.

Apps with environments

A file without environments reaches every dev environment. A file with environments reaches a dev environment only when the list names it or the file sets dev. dev applies to every dev environment the list doesn't name, quick tests included, with the same fields as an environment override. dev: {} uses the top of the file unchanged.

apps/portal.yaml
environments:
  Staging:
    auth:
      mode: connic
  Production: {}
dev:                              # every dev environment the list doesn't name
  auth:
    mode: connic

Dev environments have Variables of their own, and a quick test starts without any, so dev is the place for settings that read Variables elsewhere, such as OIDC sign-in. A custom domain serves one environment, so set domain: null in dev when the top of the file sets one. The connectors the app lists need dev in their files too when those files list environments.

connic dev doesn't build an app that the dev environment doesn't get, and says why:

terminal
! portal: apps/portal.yaml doesn't list test-swift-fox-ab12 in environments; add dev to serve it in connic dev

Rebuilds

connic dev watches apps/<key>/ and rebuilds the app when the content of a source file changes. It ignores node_modules, hidden files, the output folder, and dist, build, out, and coverage folders. Saving apps/<key>.yaml applies the new settings, and a new app, an app the dev environment now gets, or changed build settings start a build.

A failed build prints the command's output, and the last good build stays live:

terminal
[14:02:11] → Building app portal...
    ✗ portal: `npm run build` exited with code 1
    src/App.tsx(12,5): error TS2322: Type 'string' is not assignable to type 'number'.
    The last good build stays live at https://portal-7e21c09f.connic.app

Connectors in the dev environment

The connectors in connectors/*.yaml are applied to the dev environment when the session starts and whenever a connector file changes, exactly as a deploy applies them; see Connectors in code. When a connector or app change fails, connic dev shows the error and the dev environment keeps its previous state.