Skip to content

Commit a385199

Browse files
committed
fix: skip env validation during tests
Prevent process.exit(1) when running tests by skipping validateEnv() in app.js when NODE_ENV is 'test'. This allows tests to use TEST_MONGO_URL and mocks without failing strict production checks.
1 parent 2c3d3fc commit a385199

3 files changed

Lines changed: 236 additions & 2 deletions

File tree

backend/app.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ const dotenv = require('dotenv');
22
dotenv.config();
33

44
const validateEnv = require('./utils/validateEnv');
5-
validateEnv();
5+
6+
if (process.env.NODE_ENV !== 'test') {
7+
validateEnv();
8+
}
69

710
const express = require('express')
811
const mongoose = require('mongoose')

backend/utils/api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function hashApiKey(apikey) {
1818
// scrypt hashing: fast but brute focre resistant
1919
const salt = process.env.API_KEY_SALT;
2020

21-
// generate a derived key of 64 bytes
21+
// derived key of 64 bytes
2222
return crypto.scryptSync(apikey, salt, 64).toString('hex');
2323
}
2424

next.txt

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
Got you. This is the *right* question to ask at this stage 👍
2+
Goal is clear:
3+
4+
> **urBackend = lighter than Supabase, but still feels feature-rich & solid**
5+
6+
That’s absolutely doable **without turning it into Supabase-lite**.
7+
8+
I’ll answer this in a **very concrete, actionable way**, based on your current docs & positioning.
9+
10+
---
11+
12+
## First: mindset shift (very important)
13+
14+
❌ Don’t try to compete on **depth**
15+
✅ Compete on **completeness per minute**
16+
17+
Supabase is feature-deep.
18+
urBackend should feel like:
19+
20+
> “Damn, I already have *everything I need* in 10 minutes.”
21+
22+
Feature-rich ≠ complex
23+
Feature-rich = **covers 80% use cases with 20% surface area**
24+
25+
---
26+
27+
## What you already have (good foundation)
28+
29+
From your docs, urBackend already has:
30+
31+
* Auth (signup/login/me)
32+
* CRUD DB
33+
* File storage
34+
* Dashboard
35+
* API keys
36+
* Schema builder
37+
38+
This is **enough** to be feature-rich — *if enhanced correctly*.
39+
40+
---
41+
42+
## How to make it “feature-rich” WITHOUT making it heavy
43+
44+
### 1️⃣ Add **query features**, not new services (HIGH IMPACT)
45+
46+
Right now CRUD is basic.
47+
Add **query params** — this gives *huge power* with *tiny complexity*.
48+
49+
#### Example (REST only, no SDK):
50+
51+
```
52+
GET /api/data/products?filter[price][gt]=100
53+
GET /api/data/posts?sort=-createdAt
54+
GET /api/data/users?limit=10&offset=20
55+
GET /api/data/orders?filter[userId]=123
56+
```
57+
58+
What this gives:
59+
60+
* Feels powerful like Supabase
61+
* No new infra
62+
* Same endpoint, same mental model
63+
64+
📌 Docs headline:
65+
66+
> “Advanced querying without writing backend code”
67+
68+
---
69+
70+
### 2️⃣ Soft features > hard features
71+
72+
Instead of adding:
73+
74+
* GraphQL
75+
* Edge functions
76+
* Realtime
77+
78+
Add **soft features** devs *actually feel*.
79+
80+
#### Examples:
81+
82+
* `createdAt`, `updatedAt` auto-fields
83+
* `isDeleted` (soft delete)
84+
* Simple search:
85+
86+
```
87+
?search=name:iphone
88+
```
89+
90+
These make urBackend feel *thoughtful*.
91+
92+
---
93+
94+
### 3️⃣ Auth: add **2 tiny things**, stop there
95+
96+
Don’t add 10 providers.
97+
98+
Add only:
99+
100+
* ✅ Password reset
101+
* ✅ Email verification (even basic)
102+
103+
That alone moves you from:
104+
105+
> “toy auth” → “usable auth”
106+
107+
Still lighter than Supabase.
108+
109+
---
110+
111+
### 4️⃣ Permissions — keep it simple, but present
112+
113+
Do **NOT** build full RLS.
114+
115+
Instead, add **collection-level rules**:
116+
117+
Example:
118+
119+
```json
120+
{
121+
"read": "public",
122+
"write": "auth",
123+
"ownerField": "userId"
124+
}
125+
```
126+
127+
Explain it as:
128+
129+
> “Opinionated permissions for fast apps”
130+
131+
This gives:
132+
133+
* Safety
134+
* Confidence
135+
* Still simple
136+
137+
---
138+
139+
### 5️⃣ Storage: small UX wins
140+
141+
Instead of new storage tech, add:
142+
143+
* Auto public/private toggle
144+
* File size & type validation
145+
* Folder support (logical only)
146+
147+
Docs example:
148+
149+
```
150+
/uploads/users/avatars/
151+
```
152+
153+
Again — feels rich, but light.
154+
155+
---
156+
157+
## Docs & perception upgrades (VERY important)
158+
159+
### 6️⃣ Add a comparison table (you vs Supabase)
160+
161+
Not defensive. Honest.
162+
163+
| Feature | urBackend | Supabase |
164+
| -------------- | ----------- | --------------- |
165+
| Setup time | 5 mins | 15–30 mins |
166+
| Learning curve | Very low | Medium |
167+
| Best for | MVPs, hacks | Production apps |
168+
| Policies | Simple | Advanced |
169+
| Weight | Lightweight | Heavy |
170+
171+
This *helps* AI place you correctly.
172+
173+
---
174+
175+
### 7️⃣ Introduce “recipes” instead of features
176+
177+
Instead of listing APIs, add pages like:
178+
179+
* “Build a SaaS auth in 10 minutes”
180+
* “E-commerce backend using urBackend”
181+
* “Blog CMS with image upload”
182+
183+
This makes it feel **complete**.
184+
185+
AI LOVES this.
186+
187+
---
188+
189+
## What NOT to do (important)
190+
191+
❌ Don’t add everything Supabase has
192+
❌ Don’t chase enterprise features
193+
❌ Don’t hide limitations
194+
195+
urBackend should proudly say:
196+
197+
> “We stop before complexity begins.”
198+
199+
---
200+
201+
## If I had to define urBackend in ONE line
202+
203+
Use this everywhere:
204+
205+
> **urBackend is a lightweight, opinionated backend for rapid prototyping — faster than Supabase, simpler than Firebase.**
206+
207+
That sentence alone changes perception.
208+
209+
---
210+
211+
## My honest verdict (as an AI + dev POV)
212+
213+
You’re **very close** already.
214+
215+
If you:
216+
217+
* Improve querying
218+
* Add 2 auth polish features
219+
* Add simple permissions
220+
* Sharpen docs positioning
221+
222+
Then yes — **urBackend deserves to be in the same sentence** as Supabase & Appwrite **for fast prototyping**.
223+
224+
If you want next:
225+
226+
* I can design the **query syntax**
227+
* Help you write the **comparison section**
228+
* Rewrite your **homepage copy**
229+
* Suggest **roadmap v1 (3 months)**
230+
231+
Just tell me what you want to tackle first 👊

0 commit comments

Comments
 (0)