Skip to Content
Getting StartedProject Configuration

Project configuration

Use project configuration when a repository needs its own CA or settings. apxy init creates a .apxy/ folder for them. The rules of the repository live next to it in .apxy/rules.json, like the rules of any git worktree. Traffic always goes to the shared database, ~/.apxy/data/apxy.db, so it is not kept per project.

Create a project folder

Run apxy init from the repository root:

cd my-app apxy init

The command creates this layout and never overwrites files that already exist:

.apxy/ settings.json # commit: project marker and config .gitignore # commit: keeps private keys, lock files, and rules.json out of git certs/ ca.crt # commit: the project CA certificate ca.key # ignored: the project CA private key custom/ # ignored: private keys of custom CAs data/ # ignored

Commit .apxy/settings.json, .apxy/.gitignore, and .apxy/certs/ca.crt.

Start the proxy in project mode

Run apxy start from the repository root or from any subdirectory:

apxy start

APXY walks up from the current directory and uses the first .apxy/ that holds a settings.json. The first line of output shows the mode:

Project mode: /path/to/my-app/.apxy

In project mode, the CA comes from .apxy/certs/ and the settings come from .apxy/settings.json. Traffic and marks go to ~/.apxy/data/apxy.db, which every project and workspace shares.

To see the active mode later, run apxy status. The output includes a Config mode: line.

Add rules

Add rules the usual way, with the CLI or MCP tools. In a git worktree, APXY writes each change to <worktree>/.apxy/rules.json, and the rules apply to the traffic of that worktree. See Workspaces.

apxy mock add --name "Stub users" --url "https://api.example.com/users" --status 200 --body '[]' apxy rules list

apxy init adds rules.json to .apxy/.gitignore, because mock bodies can hold tokens. To share the rules through git, run apxy init --commit-rules in a project that has no .apxy/ yet, or delete the rules.json line from .apxy/.gitignore. Then commit .apxy/rules.json. Keep tokens out of mock bodies that you commit.

You can edit rules.json by hand. While apxy run or apxy mcp runs, it pushes the changed file to the proxy within a second. Otherwise run apxy rules apply. APXY never pushes an invalid file. The error names the line and column or the rule to fix, and the proxy keeps the last valid rules.

Move rules out of an older settings.json

Older versions of APXY kept project rules in .apxy/settings.json. The first command that runs in the project moves them into .apxy/rules.json, when rules.json does not exist yet. After that, APXY does not read settings.json for rules, and the proxy no longer writes it. Custom CAs do not move. Add them again with apxy certs custom add.

Use the global configuration

To ignore the project and use ~/.apxy for one command, add --no-project:

apxy start --no-project

To ignore projects for a whole shell session, set the environment variable:

export APXY_NO_PROJECT=1

To use a project in another directory, pass --project-dir:

apxy start --project-dir ../other-app

Fix a settings.json that fails to load

If settings.json is not valid JSON or has no version field, apxy start stops with an error that names the file. APXY does not fall back to ~/.apxy. Fix the file, or restore it from git, then start again:

git checkout -- .apxy/settings.json apxy start

Upgrade from an older .apxy/config.yaml

If .apxy/ has a config.yaml and no settings.json, the next apxy start creates settings.json from it. Only ssl_domains carries over. Pass other settings as apxy start flags. APXY keeps the old file, and you can delete it after you check the new one.

Last updated on