PolicyJar is a multi-tenant CRM, inbound call router, and browser softphone platform built with Next.js, Supabase, and Telnyx.
This repo contains:
- the web app and dashboard
- API routes for telephony, reporting, RTB, billing, and admin flows
- Supabase migrations
- automated tests and browser-based E2E labs
The code in this repository is open source under Apache-2.0.
The PolicyJar name and branding are reserved separately. If you redistribute, host, rebrand, or commercialize a fork or derivative, you must use your own product name and branding unless you have written permission to use PolicyJar.
See TRADEMARKS.md for the naming rules.
Before you start, make sure you have:
- Node.js 20+
- npm 10+
- a Supabase project
- a Telnyx account for voice features
Optional integrations:
- Stripe for billing flows
- Ringba for RTB flows
- Resend for invite emails
- Install dependencies.
npm ci- Copy the example environment file.
Copy-Item .env.example .env.local-
Open
.env.localand replace the placeholder values with your own credentials. -
Read docs/ENVIRONMENT.md for what each variable does.
-
Start the app.
npm run dev- Open
http://localhost:3000.
The canonical starter file is .env.example.
For local work:
- put real local credentials in
.env.local - use docs/ENVIRONMENT.md as the field-by-field reference
- leave optional QA and live-smoke values blank until you need them
Important files:
.env.example: starter template for new users.env.local: local developer values.env.qa-check: optional live-environment smoke-test values
Do not commit .env.local, .env.qa-check, or any other credential-bearing file.
The fastest path to a working local instance is:
- Create a Supabase project and paste its URL, anon key, service-role key, and Postgres URL into
.env.local. - Add your Telnyx API key, credential connection ID, Call Control app ID, webhook public key, and phone number.
- Run the app with
npm run dev. - If you need browser softphone behavior, also fill in the client-visible SIP fields in
.env.local.
npm test
npm run test:coverage
npm run test:e2e
npm run build
npm run test:go-live
npm run test:rtb:liveWhat they do:
npm test: full Vitest suitenpm run test:coverage: strict backend coverage gatenpm run test:e2e: Playwright browser testsnpm run build: production build verificationnpm run test:go-live: live-environment readiness smoke checksnpm run test:rtb:live: live Ringba RTB smoke check
- src/app: Next.js routes and pages
- src/components: UI and telephony components
- src/hooks: client lifecycle hooks, including Telnyx and presence
- src/lib: shared business logic
- src/tests: Vitest suites
- e2e: Playwright tests
- supabase/migrations: schema history
- This repo includes
.gitleaks.tomlfor secret scanning. - CI runs a secret scan before tests.
- Rotate real credentials immediately if they were ever committed, even if you later rewrite history.
- Treat local bundles, old clones, forks, and stale branches as potentially sensitive until they are cleaned or deleted.
A starter contributor guide lives in CONTRIBUTING.md.