Skip to content

Commit 5651576

Browse files
committed
Initial release - Apache 2.0 - tokenbudget.com
0 parents  commit 5651576

244 files changed

Lines changed: 36644 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# ── Environment ────────────────────────────────────────────────────────────
2+
ENVIRONMENT=development
3+
# IMPORTANT: Change this to a long random string in production!
4+
SECRET_KEY=change-me-in-production
5+
6+
# ── Database ────────────────────────────────────────────────────────────────
7+
DATABASE_URL=postgresql+asyncpg://tokenbudget:localdev@localhost:5432/tokenbudget
8+
DB_POOL_SIZE=20
9+
DB_MAX_OVERFLOW=10
10+
DB_POOL_RECYCLE=3600
11+
12+
# ── Redis ───────────────────────────────────────────────────────────────────
13+
REDIS_URL=redis://localhost:6379
14+
15+
# ── Signup kill switch ──────────────────────────────────────────────────────
16+
# Set to false to disable new account/key creation (e.g., maintenance mode)
17+
SIGNUPS_ENABLED=true
18+
SIGNUPS_PAUSED_MESSAGE=New signups are temporarily paused. Check back soon.
19+
20+
# ── Free tier limits ────────────────────────────────────────────────────────
21+
FREE_EVENTS_PER_MONTH=10000
22+
FREE_KEYS_MAX=3
23+
FREE_RETENTION_DAYS=30
24+
FREE_PROJECTS_MAX=3
25+
26+
# ── Pro tier limits ─────────────────────────────────────────────────────────
27+
PRO_EVENTS_PER_MONTH=500000
28+
PRO_KEYS_MAX=20
29+
PRO_RETENTION_DAYS=365
30+
PRO_PROJECTS_MAX=50
31+
32+
# ── Team tier limits ─────────────────────────────────────────────────────────
33+
TEAM_EVENTS_PER_MONTH=5000000
34+
TEAM_KEYS_MAX=100
35+
TEAM_RETENTION_DAYS=730
36+
TEAM_PROJECTS_MAX=500
37+
38+
# ── Rate limiting ────────────────────────────────────────────────────────────
39+
RATE_LIMIT_EVENTS_PER_SECOND=100
40+
RATE_LIMIT_BURST=200
41+
42+
# ── CORS ─────────────────────────────────────────────────────────────────────
43+
# JSON array syntax required for pydantic-settings list parsing
44+
CORS_ORIGINS=["http://localhost:5173","http://localhost:3000"]
45+
46+
# ── Admin ─────────────────────────────────────────────────────────────────────
47+
# Required for /api/admin/* endpoints. Leave empty to disable.
48+
ADMIN_KEY=change-this-admin-key
49+
50+
# ── Nightly purge job ─────────────────────────────────────────────────────────
51+
PURGE_ENABLED=true
52+
PURGE_BATCH_SIZE=5000
53+
# Hour and minute (UTC) for the nightly purge cron
54+
PURGE_CRON_HOUR=3
55+
PURGE_CRON_MINUTE=0
56+
57+
# ── Clerk Auth (get keys from https://clerk.com) ──────────────────────────────
58+
# When CLERK_SECRET_KEY is set, the dashboard accepts Clerk session JWTs
59+
# in addition to the existing tb_ak_ API key flow (which always works).
60+
# Leave both empty to rely solely on API key auth (the current default).
61+
CLERK_SECRET_KEY=sk_test_REPLACE_ME
62+
VITE_CLERK_PUBLISHABLE_KEY=pk_test_REPLACE_ME
63+
64+
# ── Stripe ───────────────────────────────────────────────────────────────────
65+
STRIPE_SECRET_KEY=
66+
67+
# ── Frontend ──────────────────────────────────────────────────────────────────
68+
VITE_API_URL=http://localhost:8000
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Bug Report
3+
about: Create a report to help us improve
4+
---
5+
6+
**Describe the bug:**
7+
8+
**To Reproduce:**
9+
10+
**Expected behavior:**
11+
12+
**Environment:**
13+
- OS:
14+
- Python version:
15+
- TokenBudget version:
16+
- Provider: OpenAI / Anthropic / Other
17+
- Integration method: SDK / Proxy / Direct API
18+
19+
**Logs (if any):**
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: Feature Request
3+
about: Suggest an idea for TokenBudget
4+
---
5+
6+
**Is your feature request related to a problem?**
7+
8+
**Describe the solution you'd like:**
9+
10+
**Describe alternatives you've considered:**
11+
12+
**Which integration method does this affect?**
13+
SDK / Proxy / Direct API / Dashboard / All

.github/workflows/ci.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
branches: [main]
7+
8+
jobs:
9+
test-sdk:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
14+
with:
15+
python-version: '3.11'
16+
- run: cd sdk && pip install -e ".[dev]" && pytest tests/ -v
17+
18+
test-api:
19+
runs-on: ubuntu-latest
20+
services:
21+
postgres:
22+
image: postgres:16-alpine
23+
env:
24+
POSTGRES_PASSWORD: test
25+
POSTGRES_DB: tokenbudget_test
26+
POSTGRES_USER: tokenbudget
27+
ports:
28+
- 5432:5432
29+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
30+
redis:
31+
image: redis:7-alpine
32+
ports:
33+
- 6379:6379
34+
env:
35+
DATABASE_URL: postgresql+asyncpg://tokenbudget:test@localhost:5432/tokenbudget_test
36+
REDIS_URL: redis://localhost:6379
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: actions/setup-python@v5
40+
with:
41+
python-version: '3.11'
42+
- run: cd api && pip install -e ".[dev]" && pytest tests/ -v
43+
44+
typecheck-frontend:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: actions/setup-node@v4
49+
with:
50+
node-version: '20'
51+
- run: cd frontend && npm ci && npx tsc --noEmit

.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
__pycache__/
2+
*.pyc
3+
.venv/
4+
*.egg-info/
5+
dist/
6+
.pytest_cache/
7+
node_modules/
8+
frontend/dist/
9+
frontend/dist-node/
10+
frontend/tsconfig.tsbuildinfo
11+
.env
12+
.env.local
13+
*.env
14+
!*.env.example
15+
.vscode/
16+
.idea/
17+
*.db
18+
19+
# Private planning docs (not for open source)
20+
MASTER_PROMPT*.md
21+
TOKENBUDGET_BUSINESS_PLAN_VERIFIED*.md
22+
TOKENBUDGET_CLAUDE_CODE_PROMPT*.md
23+
MASTER_PROMPT_FOR_CLAUDE_CODE.md
24+
ADD_LICENSE.md
25+
DEVELOPMENT.md
26+
CONTRIBUTING.md
27+
DEPLOYMENT.md
28+
PENDING.md
29+
PROGRESS.md
30+
docs/BUSINESS_PLAN.md
31+
docs/superpowers/
32+
docs/PUBLIC_LAUNCH_CHECKLIST.md
33+
.playwright-mcp/

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2026 Harsha Krishne Gowda
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

NOTICE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
TokenBudget
2+
Copyright 2026 Harsha Krishne Gowda
3+
4+
Website: https://tokenbudget.com

0 commit comments

Comments
 (0)