Skip to content

Commit dd0bb51

Browse files
authored
Merge branch 'main' into fix/dashboard-getData-query-engine
2 parents f7c95bb + 53c9e9a commit dd0bb51

162 files changed

Lines changed: 23659 additions & 11567 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.

.editorconfig

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# EditorConfig helps maintain consistent coding styles
2+
# across different editors and IDEs.
3+
# See https://editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
charset = utf-8
9+
end_of_line = lf
10+
indent_style = space
11+
indent_size = 2
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
15+
[*.{js,ts,jsx,tsx,mjs,cjs}]
16+
indent_size = 2
17+
18+
[*.{json,json5}]
19+
indent_size = 2
20+
21+
[*.{yml,yaml}]
22+
indent_size = 2
23+
24+
[*.css]
25+
indent_size = 2
26+
27+
[*.{md,mdx}]
28+
trim_trailing_whitespace = false
29+
30+
[Makefile]
31+
indent_style = tab

.env.example

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,70 @@
11
# ─────────────────────────────────────────────────────────────────────────────
22
# urBackend — Environment Variables
3-
# Copy this file to .env and fill in your values before running docker-compose.
43
# ─────────────────────────────────────────────────────────────────────────────
4+
# Copy this file before editing:
5+
# Linux/macOS: cp .env.example .env
6+
# PowerShell: Copy-Item .env.example .env
57

68
# ── Server Ports ────────────────────────────────────────────────────────────
79
PORT=1234 # For Admin Server (Dashboard)
810
USER_PORT=1235 # For User Server (Public API)
911
NODE_ENV=development
1012

11-
12-
# ── Database & Cache ──────────────────────────────────────────────────────────
13+
# ── Database & Cache ────────────────────────────────────────────────────────
1314
# When using docker-compose, these are automatically overridden to point to
1415
# internal service names (mongo, redis). You do NOT need to change these.
1516
MONGO_URL=mongodb://mongo:27017/urbackend
1617
REDIS_URL=redis://redis:6379
1718

18-
# ── Authentication ────────────────────────────────────────────────────────────
19+
# ── Authentication ──────────────────────────────────────────────────────────
20+
# Generate random secrets for these values.
21+
# JWT_SECRET/API_KEY_SALT examples:
22+
# openssl rand -base64 32
23+
# node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"
24+
#
25+
# ENCRYPTION_KEY must be 64 hex chars (32 bytes), examples:
26+
# openssl rand -hex 32
27+
# node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
1928
JWT_SECRET=your_super_secret_jwt_key_min_32_chars
20-
ENCRYPTION_KEY=32_character_long_string_for_byod_creds
29+
ENCRYPTION_KEY=64_hex_characters_for_aes_256_gcm_key
2130
API_KEY_SALT=your_random_api_key_salt
2231

2332
# Public API userAuth token config (optional; defaults shown)
2433
PUBLIC_AUTH_ACCESS_TOKEN_TTL=15m
2534
PUBLIC_AUTH_REFRESH_TOKEN_TTL_SECONDS=604800
2635

27-
# ── External Storage (Supabase) ───────────────────────────────────────────────
36+
# ── External Storage (Supabase) ─────────────────────────────────────────────
2837
# Required for file upload/storage features.
38+
# Get from: https://app.supabase.com → Project Settings → API
2939
SUPABASE_URL=https://your-project.supabase.co
3040
SUPABASE_KEY=your-supabase-anon-key
3141

32-
# ── Email (Resend) ────────────────────────────────────────────────────────────
42+
# ── Email (Resend) ──────────────────────────────────────────────────────────
3343
# Required for OTP / email verification flow.
44+
# Get from: https://resend.com/api-keys
3445
RESEND_API_KEY=re_your_resend_api_key
3546
EMAIL_FROM=onboarding@resend.dev
47+
48+
# Get from: https://resend.com/webhooks → Create Endpoint
3649
RESEND_WEBHOOK_SECRET=whsec_your_resend_webhook_secret
3750

38-
# ── Frontend ──────────────────────────────────────────────────────────────────
51+
# ── Frontend ────────────────────────────────────────────────────────────────
3952
FRONTEND_URL=http://localhost:5173
40-
4153
PUBLIC_API_URL=https://api.ub.bitbros.in
4254

43-
# ── Billing (Razorpay) ──────────────────────────────────────────────────────
55+
# ── Billing (Razorpay) ──────────────────────────────────────────────────────
4456
# Get from: https://dashboard.razorpay.com → Settings → API Keys
4557
RAZORPAY_KEY_ID=rzp_test_xxxxxxxxxxxx
4658
RAZORPAY_KEY_SECRET=xxxxxxxxxxxxxxxxxxxx
4759

48-
# Create from: Razorpay Dashboard → Subscriptions → Plans → Create Plan
60+
# Create from: https://dashboard.razorpay.com → Subscriptions → Plans → Create Plan
4961
RAZORPAY_PLAN_ID=plan_xxxxxxxxxxxx
5062

51-
# Set from: Razorpay Dashboard → Settings → Webhooks → Add Endpoint → copy secret
52-
RAZORPAY_KEY_ID=rzp_testx_xxxx
53-
RAZORPAY_KEY_SECRET=xxxx
54-
RAZORPAY_PLAN_ID=xxxx
55-
RAZORPAY_WEBHOOK_SECRET=xxxx
63+
# Get from: https://dashboard.razorpay.com → Settings → Webhooks → Add Endpoint
64+
RAZORPAY_WEBHOOK_SECRET=whsec_xxxxxxxxxxxx
65+
66+
# ── Internal Microservices (AI & Python) ────────────────────────────────────
67+
# Required for AI Query Builder and Python microservice communication
68+
PYTHON_SERVICE_URL=http://localhost:8000
69+
INTERNAL_SECRET=generate_a_random_32_char_secret_here
70+
GROQ_API_KEY=gsk_your_groq_api_key_here

.github/release-drafter.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name-template: 'v$RESOLVED_VERSION'
2+
tag-template: 'v$RESOLVED_VERSION'
3+
4+
version-resolver:
5+
major:
6+
labels:
7+
- 'breaking'
8+
minor:
9+
labels:
10+
- 'feature'
11+
- 'enhancement'
12+
patch:
13+
labels:
14+
- 'bug'
15+
- 'chore'
16+
- 'documentation'
17+
- 'security'
18+
default: patch
19+
20+
categories:
21+
- title: 'Added'
22+
labels:
23+
- 'feature'
24+
- 'enhancement'
25+
- title: 'Fixed'
26+
labels:
27+
- 'bug'
28+
- title: 'Security'
29+
labels:
30+
- 'security'
31+
- title: 'Breaking Changes'
32+
labels:
33+
- 'breaking'
34+
- title: 'Documentation'
35+
labels:
36+
- 'documentation'
37+
- title: 'Chore'
38+
labels:
39+
- 'chore'
40+
41+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
42+
change-title-escapes: '\<*_&'
43+
44+
template: |
45+
## What's Changed
46+
47+
$CHANGES
48+
49+
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
const https = require("https");
2+
3+
// Fail fast if GROQ_API_KEY is not set
4+
if (!process.env.GROQ_API_KEY) {
5+
console.error("Error: GROQ_API_KEY environment variable is not set.");
6+
process.exit(1);
7+
}
8+
9+
const prSummary = process.argv[2] || "No PRs merged this week.";
10+
const prCount = process.argv[3] || "0";
11+
12+
const TODAY = new Date().toISOString().slice(0, 10);
13+
const WEEK_START = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000)
14+
.toISOString()
15+
.slice(0, 10);
16+
17+
const prompt = `You are a technical writer for urBackend, an open-source Backend-as-a-Service platform (auth, database, storage, mail, webhooks, RLS).
18+
19+
Based on the following merged pull requests from the last 7 days, write a Mintlify changelog <Update> entry.
20+
21+
Merged PRs (${prCount} total):
22+
${prSummary}
23+
24+
Output ONLY the raw <Update> MDX block — no explanation, no markdown fences.
25+
Use this exact format (matching the existing changelog style):
26+
27+
<Update label="${TODAY}" description="Week of ${WEEK_START}${TODAY}" tags={["Feature", "Improvement", "Fix"]}>
28+
## New features
29+
30+
**Feature name** — User-facing description.
31+
32+
## Improvements
33+
34+
**Improvement name** — Description.
35+
36+
## Bug fixes
37+
38+
- Fix description (#PR_NUMBER)
39+
</Update>
40+
41+
Rules:
42+
- Only include sections (## New features / ## Improvements / ## Bug fixes) that have actual content.
43+
- Adjust the tags array to only include applicable tags from: "Feature", "Improvement", "Fix", "Security".
44+
- Write for developers using the platform, not the internal team.
45+
- Be concise and factual. Do not invent features not evidenced by the PRs.
46+
- If no PRs were merged, output: <Update label="${TODAY}" description="Week of ${WEEK_START}${TODAY}" tags={[]}>No significant changes this week.</Update>`;
47+
48+
const payload = JSON.stringify({
49+
model: "openai/gpt-oss-120b",
50+
messages: [{ role: "user", content: prompt }],
51+
max_tokens: 1000,
52+
temperature: 0.3,
53+
});
54+
55+
const options = {
56+
hostname: "api.groq.com",
57+
path: "/openai/v1/chat/completions",
58+
method: "POST",
59+
headers: {
60+
"Content-Type": "application/json",
61+
Authorization: `Bearer ${process.env.GROQ_API_KEY}`,
62+
"Content-Length": Buffer.byteLength(payload),
63+
},
64+
};
65+
66+
const req = https.request(options, (res) => {
67+
let data = "";
68+
69+
res.on("data", (chunk) => {
70+
data += chunk;
71+
});
72+
73+
res.on("end", () => {
74+
try {
75+
const response = JSON.parse(data);
76+
77+
if (response.error) {
78+
console.error("Groq API error:", response.error.message);
79+
process.exit(1);
80+
}
81+
82+
const content = response.choices?.[0]?.message?.content;
83+
84+
if (!content) {
85+
console.error("No content in response:", JSON.stringify(response));
86+
process.exit(1);
87+
}
88+
89+
process.stdout.write(content.trim());
90+
} catch (err) {
91+
console.error("Failed to parse response:", err.message);
92+
console.error("Raw response:", data);
93+
process.exit(1);
94+
}
95+
});
96+
});
97+
98+
// Prevent workflow from hanging indefinitely
99+
req.setTimeout(30000, () => {
100+
console.error("Error: Groq API request timed out after 30 seconds.");
101+
req.destroy();
102+
process.exit(1);
103+
});
104+
105+
req.on("error", (err) => {
106+
console.error("Request failed:", err.message);
107+
process.exit(1);
108+
});
109+
110+
req.write(payload);
111+
req.end();
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
update_release_draft:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: release-drafter/release-drafter@6a93d829887aa2e0748befe2e808c66c0ec6e4c7
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)