Skip to content

Commit a704980

Browse files
committed
readme
1 parent f7ce137 commit a704980

1 file changed

Lines changed: 107 additions & 20 deletions

File tree

README.md

Lines changed: 107 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ Stop writing boilerplate. Get an instant Database, Authentication, and Storage A
1313
- **🛠️ Visual Schema Builder**: Define table columns (String, Number, Boolean, Date) through an intuitive UI.
1414
- **🔒 Security**: API Key-based access control and Row Level Security.
1515

16+
> [!IMPORTANT]
17+
> **Security Warning**: Your `x-api-key` grants **Admin Access** (Read/Write/Delete).
18+
>
19+
> -**NEVER** use this key in client-side code (frontend).
20+
> -**ONLY** use this key in secure server-side environments.
21+
1622
## 🛠️ Tech Stack
1723

1824
### Frontend
@@ -59,7 +65,7 @@ Start the server:
5965

6066
```bash
6167
npm start
62-
# Server will run on http://urbackend.bitbros.in
68+
# Server will run on https://api.urbackend.bitbros.in
6369
```
6470

6571
### 2. Frontend Setup
@@ -72,7 +78,7 @@ npm install
7278
Update `frontend/src/config.js` (if necessary):
7379

7480
```javascript
75-
export const API_URL = 'http://urbackend.bitbros.in';
81+
export const API_URL = 'https://api.urbackend.bitbros.in';
7682
```
7783

7884
Start the client:
@@ -86,52 +92,116 @@ npm run dev
8692

8793
Once your project is created in the dashboard, use your **Public API Key** to make requests.
8894

89-
### 1. Database API
95+
### Base URL
9096

91-
**Insert Data:**
97+
```
98+
https://api.urbackend.bitbros.in
99+
```
100+
101+
### 1. Authentication
102+
103+
**Sign Up User:**
92104

93105
```javascript
94-
await fetch('http://urbackend.bitbros.in/api/data/products', {
106+
await fetch('https://api.urbackend.bitbros.in/api/userAuth/signup', {
95107
method: 'POST',
96108
headers: {
97109
'Content-Type': 'application/json',
98110
'x-api-key': 'YOUR_API_KEY'
99111
},
100112
body: JSON.stringify({
101-
name: "MacBook Pro",
102-
price: 1299,
103-
inStock: true
113+
email: "user@example.com",
114+
password: "securePassword123",
115+
name: "John Doe" // Optional
104116
})
105117
});
106118
```
107119

108-
**Fetch Data:**
120+
**Login User:**
109121

110122
```javascript
111-
const res = await fetch('http://urbackend.bitbros.in/api/data/products', {
123+
const res = await fetch('https://api.urbackend.bitbros.in/api/userAuth/login', {
124+
method: 'POST',
125+
headers: {
126+
'Content-Type': 'application/json',
127+
'x-api-key': 'YOUR_API_KEY'
128+
},
129+
body: JSON.stringify({
130+
email: "user@example.com",
131+
password: "securePassword123"
132+
})
133+
});
134+
const data = await res.json(); // Returns { token: "JWT_TOKEN", user: {...} }
135+
```
136+
137+
**Get Profile (Me):**
138+
139+
```javascript
140+
await fetch('https://api.urbackend.bitbros.in/api/userAuth/me', {
141+
method: 'GET',
142+
headers: {
143+
'x-api-key': 'YOUR_API_KEY',
144+
'Authorization': 'Bearer <USER_TOKEN>' // From login response
145+
}
146+
});
147+
```
148+
149+
### 2. Database API
150+
151+
**Get All Items:**
152+
153+
```javascript
154+
// Replace :collectionName with your actual collection name (e.g., 'products')
155+
const res = await fetch('https://api.urbackend.bitbros.in/api/data/products', {
112156
headers: { 'x-api-key': 'YOUR_API_KEY' }
113157
});
114158
const data = await res.json();
115159
```
116160

117-
### 2. Authentication API
118-
119-
**Register User:**
161+
**Insert Data:**
120162

121163
```javascript
122-
await fetch('http://urbackend.bitbros.in/api/userAuth/signup', {
164+
await fetch('https://api.urbackend.bitbros.in/api/data/products', {
123165
method: 'POST',
124166
headers: {
125167
'Content-Type': 'application/json',
126168
'x-api-key': 'YOUR_API_KEY'
127169
},
128170
body: JSON.stringify({
129-
email: "user@example.com",
130-
password: "securePassword123"
171+
name: "MacBook Pro",
172+
price: 1299,
173+
inStock: true
131174
})
132175
});
133176
```
134177

178+
**Get / Update / Delete by ID:**
179+
180+
```javascript
181+
const id = "DOCUMENT_ID"; // The '_id' from the document
182+
183+
// Get One
184+
await fetch(`https://api.urbackend.bitbros.in/api/data/products/${id}`, {
185+
headers: { 'x-api-key': 'YOUR_API_KEY' }
186+
});
187+
188+
// Update
189+
await fetch(`https://api.urbackend.bitbros.in/api/data/products/${id}`, {
190+
method: 'PUT',
191+
headers: {
192+
'Content-Type': 'application/json',
193+
'x-api-key': 'YOUR_API_KEY'
194+
},
195+
body: JSON.stringify({ price: 1199 })
196+
});
197+
198+
// Delete
199+
await fetch(`https://api.urbackend.bitbros.in/api/data/products/${id}`, {
200+
method: 'DELETE',
201+
headers: { 'x-api-key': 'YOUR_API_KEY' }
202+
});
203+
```
204+
135205
### 3. Storage API
136206

137207
**Upload File:**
@@ -140,19 +210,36 @@ await fetch('http://urbackend.bitbros.in/api/userAuth/signup', {
140210
const formData = new FormData();
141211
formData.append('file', fileInput.files[0]);
142212

143-
const res = await fetch('http://urbackend.bitbros.in/api/storage/upload', {
213+
const res = await fetch('https://api.urbackend.bitbros.in/api/storage/upload', {
144214
method: 'POST',
145215
headers: { 'x-api-key': 'YOUR_API_KEY' },
146216
body: formData
147217
});
148-
// Returns { url: "..." }
218+
const data = await res.json();
219+
// Returns { url: "...", path: "project_id/filename.jpg" }
220+
```
221+
222+
**Delete File:**
223+
224+
```javascript
225+
await fetch('https://api.urbackend.bitbros.in/api/storage/file', {
226+
method: 'DELETE',
227+
headers: {
228+
'Content-Type': 'application/json',
229+
'x-api-key': 'YOUR_API_KEY'
230+
},
231+
body: JSON.stringify({
232+
path: "PROJECT_ID/filename.jpg" // The 'path' from upload response
233+
})
234+
});
149235
```
150236

151237
## ⚠️ Limits & Quotas
152238

153239
- **Rate Limit**: 100 requests / 15 mins per IP.
154-
- **Database Size**: Max 50MB per project.
155-
- **File Storage**: Max 100MB per project (5MB max per file).
240+
- **Database Size**: Max 50 MB per project.
241+
- **File Storage**: Max 100 MB per project.
242+
- **File Upload Size**: Max 5 MB per file.
156243

157244
## 🤝 Contributing
158245

0 commit comments

Comments
 (0)