Contributing
Repo setup, testing, code style, and how to submit changes.
Repo setup
git clone https://github.com/nitejar/nitejar.git
cd nitejar
pnpm installCopy the environment file and fill in the values you need:
cp .env.example apps/web/.envAt minimum, generate an encryption key:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"Paste the output as ENCRYPTION_KEY in apps/web/.env.
Running locally
Start the dev server:
pnpm devThis starts the Next.js app at http://localhost:3000. The dashboard is at /. The docs site runs at http://localhost:3001.
SQLite is the default database. No Docker required for basic development. The database file lives at packages/database/data/nitejar.db.
Running tests
# Run all tests
pnpm test
# Run tests with coverage
pnpm test:coverage
# Run integration tests (requires running services)
pnpm test:integrationCoverage thresholds are set per-package in each package's vitest.config.ts.
Code style
The project uses Prettier for formatting and ESLint for linting.
# Format all files
pnpm format
# Check formatting without writing
pnpm format:check
# Run linter
pnpm lintType checking
pnpm typecheckDo not run pnpm build while the dev server is running. It corrupts the .next cache. Use pnpm typecheck instead for type checking during development.
Verification checklist
Before submitting a PR, verify:
pnpm format-- Code is formatted.pnpm lint-- No lint errors.pnpm typecheck-- Zero type errors.pnpm test-- All tests pass.pnpm test:coverage-- Coverage thresholds met.- If schema changed:
pnpm --filter @nitejar/database db:migrate
Media capability verification (no Telegram required)
When changing image/STT/TTS capabilities, validate from the app first:
- Start dev server:
pnpm dev - Configure capability cards in
/settings/capabilities - Use an in-app test path (for example Generic Webhook + assigned agent) to trigger media tools
- Confirm receipts:
- Work item timeline shows tool calls/results
- Costs page shows external API costs
media_artifactscontains artifact records for the job
Telegram webhook E2E is still useful for channel transport regression, but it is not required to verify media capability wiring.
Database
SQLite is used for local development. Postgres is supported for production.
# Run migrations after schema changes
pnpm --filter @nitejar/database db:migrate
# Open database studio
pnpm db:studioSafe to destroy: Transactional data (jobs, messages, work items, inference calls, spans) can be wiped freely during development.
Do not destroy: Configuration data (agents, integrations, teams, gateway settings, model catalog).
For Postgres development:
# Start Postgres via Docker
pnpm db:up
# Initialize schema
pnpm db:init
# Stop Postgres
pnpm db:down
# Full reset (destroys all data)
pnpm db:resetProject structure
nitejar/
apps/
web/ # Next.js 15 App Router (main application)
docs/ # Fumadocs documentation site
packages/
agent/ # Agent runtime, tools, prompt builder
database/ # Kysely ORM, migrations, repositories
plugin-sdk/ # Public SDK for plugin authors
plugin-runtime/ # Host-side plugin lifecycle manager
plugin-handlers/ # Handler registry + built-in integrations
sprites/ # Sprites VM interface
core/ # Shared types and interfaces
config/ # Environment config with Zod validation
create-nitejar-plugin/ # Plugin scaffolding CLI
typescript-config/ # Shared TypeScript configs
eslint-config/ # Shared ESLint configs
plugins/
nitejar-plugin-webhook/ # Example: generic webhook plugin
docs/
specs/ # Internal design specsHow to add a plugin
- Scaffold with
npx create-nitejar-plugin my-plugin. - Implement the
PluginHandlerinterface (see the Plugin SDK guide). - Write tests using
testHandler()from@nitejar/plugin-sdk. - Create a
nitejar-plugin.jsonmanifest (see Manifest Format). - Build with esbuild:
npx esbuild src/index.ts --bundle --format=esm --outfile=dist/index.js --platform=node --external:@nitejar/plugin-sdk - Test locally: install via the app UI at Plugins > Install Custom Plugin and point to your directory.
- For inclusion in the main repo, add your plugin under
plugins/and submit a PR.
How to add a skill
- Create a directory with a
SKILL.mdfile (see the Skills guide). - Add optional supporting files (references, scripts, templates).
- Test by creating the skill in the app UI and assigning it to an agent.
- Verify the agent can discover and use the skill via
use_skill. - For sharing, export as JSON from the app UI.
Architecture guidance
- tRPC for app UI data flows. Add procedures in
apps/web/server/routers/, wire throughapps/web/server/routers/_app.ts, consume via the tRPC client in app pages. - Remove unused code when iterating. Delete obsolete routes, components, configs, and docs.
- Be proactive. Fix type errors and lint issues as you encounter them. Run migrations after schema changes. Do not stop for fixable problems.
Model configuration
The default model is arcee-ai/trinity-large-preview:free via OpenRouter. Do not change the agent model unless explicitly asked. Switching to paid models causes rate limit and cost issues in development.