Skip to content

Configuration

AccessAgent is configured via environment variables and optional adapter plugins.

Variable Description
DATABASE_URL PostgreSQL connection string. Example: postgresql://user:pass@host:5432/panelai
OPENAI_API_KEY OpenAI API key. Get one from platform.openai.com.
AUTH_SECRET Secret used to sign session tokens. Use a long random string.
Variable Default Description
PORT 3000 Port the HTTP server listens on
PROJECTS_DIR ./projects Where per-project widget files are stored
MAX_PROJECTS_PER_TEAM unlimited Limit projects per team (set a number to cap)
AGENT_MODEL gpt-4o OpenAI model to use for the agent
AGENT_MAX_TOKENS 4096 Max tokens per agent response

By default, AccessAgent uses local username/password authentication. Users register with an email and password stored (hashed) in your database.

To replace auth with a different provider, implement the AuthAdapter interface and pass it to the server config:

src/adapters/auth/my-auth.ts
import type { AuthAdapter } from '../interface';
export const myAuthAdapter: AuthAdapter = {
async createUser(email, password) { ... },
async verifyUser(email, password) { ... },
async getUserById(id) { ... },
};

By default, widget files are stored on the local filesystem at ./projects/{projectId}/. For multi-server deployments or cloud storage, implement the StorageAdapter interface:

src/adapters/storage/my-storage.ts
import type { StorageAdapter } from '../interface';
export const myStorageAdapter: StorageAdapter = {
async readFile(projectId, path) { ... },
async writeFile(projectId, path, content) { ... },
async deleteFile(projectId, path) { ... },
async listFiles(projectId) { ... },
};

The agent uses gpt-4o by default. To use a different model, set AGENT_MODEL:

AGENT_MODEL=gpt-4o-mini

Any model accessible via your OpenAI API key will work. gpt-4o produces the best results for code generation. gpt-4o-mini is faster and cheaper but less capable at complex widgets.