dolphin-server-modules 2.11.7 → 2.11.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DOLPHIN_MASTER_GUIDE_NEPALI.md +169 -21
- package/README.md +150 -106
- package/TUTORIAL_NEPALI.md +37 -1
- package/dist/client.test.js +11 -0
- package/dist/client.test.js.map +1 -1
- package/dist/demo-server.js +44 -0
- package/dist/demo-server.js.map +1 -1
- package/dist/gateway/gateway.d.ts +29 -0
- package/dist/gateway/gateway.js +119 -0
- package/dist/gateway/gateway.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/rpc/rpc.d.ts +38 -0
- package/dist/rpc/rpc.js +138 -0
- package/dist/rpc/rpc.js.map +1 -0
- package/dist/rpc/rpc.test.d.ts +1 -0
- package/dist/rpc/rpc.test.js +39 -0
- package/dist/rpc/rpc.test.js.map +1 -0
- package/dist/utils/adapters.d.ts +14 -0
- package/dist/utils/adapters.js +116 -0
- package/dist/utils/adapters.js.map +1 -0
- package/package.json +1 -1
- package/scripts/client.js +135 -0
|
@@ -58,6 +58,16 @@ Latest Version: v2.11.4 | Updated: 2026-05-27 | License: ISC
|
|
|
58
58
|
|
|
59
59
|
१८. API रेफरेन्स
|
|
60
60
|
|
|
61
|
+
१९. CCTV Camera & RTSP Streaming: भिडियो म्यानेजमेन्ट र P2P सिङ्क (New v2.11.7)
|
|
62
|
+
|
|
63
|
+
२०. Dolphin Microservices: API Gateway & WebRPC (New v2.11.7)
|
|
64
|
+
|
|
65
|
+
२१. Universal HTTP Adapters: Express र Fastify सँग इन्टिग्रेसन (New v2.11.7)
|
|
66
|
+
|
|
67
|
+
२२. Production Deployment (सर्भर लाइभ गर्ने)
|
|
68
|
+
|
|
69
|
+
२३. निष्कर्ष (Conclusion)
|
|
70
|
+
|
|
61
71
|
०. परिचय र दर्शन (Introduction & Philosophy)
|
|
62
72
|
Dolphin किन जन्मियो?
|
|
63
73
|
ब्याकइन्ड डेभलपमेन्टको दुनियाँमा एक्सप्रेस (Express) सबैभन्दा लोकप्रिय छ। तर एक्सप्रेस पूरानो भइसक्यो। यसमा धेरै अनावश्यक वजन (Bloat) छ र यो मोडर्न एउटा (Modern) async/await सँग सधैँ राम्रोसँग काम गर्दैन।
|
|
@@ -765,33 +775,171 @@ import { createDolphinServer } from 'dolphin-server-modules/server';
|
|
|
765
775
|
|
|
766
776
|
const app = createDolphinServer();
|
|
767
777
|
|
|
768
|
-
const UserSchema = z.
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
778
|
+
const UserSchema = z.१९. CCTV Camera & RTSP Streaming: भिडियो म्यानेजमेन्ट र P2P सिङ्क (New v2.11.7) 📹
|
|
779
|
+
Dolphin v2.11.7 मा थपिएको यो मोड्युलले औद्योगिक स्तरको भिडियो व्यवस्थापन प्रणाली (Video Management System - VMS) र टेलिकम इन्टरकम (Smart Intercom Telephony) को जग बसाल्छ।
|
|
780
|
+
|
|
781
|
+
१९.१ Camera & RTSP Streaming Architecture
|
|
782
|
+
- **CameraFrameModule**: यसले क्यामराबाट आउने बाइनरी इमेज बफर (`MJPEG`, `H264`, `H265`) हरूलाई बिना कुनै बाह्य सफ्टवेयर सिधै नोड जेएस (Node.js) बफरमै राखेर स्क्यान र पार्स गर्छ र `rt.pubPush` मार्फत लाइभ बाइनरी स्ट्रिम प्रसारण गर्छ।
|
|
783
|
+
- **RtspPullerModule**: आईपी क्यामरा वा NVR को RTSP युआरएलबाट भिडियो फिड तान्न यसमा दुईवटा ब्याकइन्ड छन्:
|
|
784
|
+
१. **Pure TCP Backend**: कुनै भारी FFmpeg बिना नै नेटिभ TCP सकेट पार्सर मार्फत भिडियो तान्छ, जसले CPU को भार ९५% सम्म घटाउँछ।
|
|
785
|
+
२. **FFmpeg Backend**: जटिल कोडेकहरू (जस्तै H.264/H.265) को MJPEG ट्रान्सकोडिङका लागि `ffmpeg` प्रोसेस चलाउँछ।
|
|
786
|
+
|
|
787
|
+
**RTSP क्यामरा जडान गर्ने उदाहरण:**
|
|
788
|
+
```typescript
|
|
789
|
+
import { createCameraModule, createRtspPuller } from 'dolphin-server-modules/realtime';
|
|
790
|
+
|
|
791
|
+
const camera = createCameraModule(rt);
|
|
792
|
+
const puller = createRtspPuller(camera);
|
|
793
|
+
|
|
794
|
+
// १. क्यामरा दर्ता गर्ने र RTSP फिड तान्न सुरु गर्ने
|
|
795
|
+
puller.addCamera({
|
|
796
|
+
cameraId: 'gate-camera-1',
|
|
797
|
+
url: 'rtsp://admin:password@192.168.1.100:554/stream1',
|
|
798
|
+
backend: 'tcp', // वा 'ffmpeg'
|
|
799
|
+
expectedWidth: 1280,
|
|
800
|
+
expectedHeight: 720
|
|
772
801
|
});
|
|
773
802
|
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
803
|
+
// २. लाइभ बफर बाइनरी स्ट्रिम सुन्ने
|
|
804
|
+
camera.subscribe('gate-camera-1', (frame) => {
|
|
805
|
+
console.log(`फ्रेम प्राप्त भयो! साइज: ${frame.sizeBytes} bytes | Codec: ${frame.codec}`);
|
|
806
|
+
});
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
१९.२ Universal WebRTC Intercom & Signaling System
|
|
810
|
+
यस मोड्युलमा अस्पतालको नर्स कलिङ र अपार्टमेन्ट डोरफोन प्रणालीका लागि उपयुक्त **SIP-style Signaling** संयन्त्र जडान गरिएको छ। यसले ब्राउजर र NVR बीच WebRTC P2P (Peer-to-Peer) अडियो/भिडियो जडान गराउँछ:
|
|
811
|
+
```typescript
|
|
812
|
+
import { createSignaling } from 'dolphin-server-modules/signaling';
|
|
813
|
+
|
|
814
|
+
const telecom = createSignaling(rt);
|
|
815
|
+
|
|
816
|
+
// १. इन्टरकम कल सुरु गर्ने (INVITE) र ACK ग्यारेन्टी गर्ने
|
|
817
|
+
const ackReceived = await telecom.invite('resident-app-101', 'guard-console', {
|
|
818
|
+
roomNo: '101',
|
|
819
|
+
enableVideo: true
|
|
820
|
+
});
|
|
821
|
+
|
|
822
|
+
if (ackReceived) {
|
|
823
|
+
console.log("गार्ड कन्सोलसँग सञ्चार सुरु भयो!");
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
// २. गार्डले कल उठाउँदा (ACCEPT) र क्यामरा फिड P2P सिङ्क गराउँदा
|
|
827
|
+
await telecom.accept('guard-console', 'resident-app-101', sdpOffer);
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
---
|
|
831
|
+
|
|
832
|
+
२०. Dolphin Microservices: API Gateway & WebRPC (New v2.11.7) 🚀
|
|
833
|
+
डल्फिनलाई एउटै सर्भरबाट बहु-सर्भर माइक्रोसर्भिस आर्किटेक्चर (Microservices Architecture) मा लान दुईवटा नवीनतम मोड्युल थपिएका छन्।
|
|
834
|
+
|
|
835
|
+
२०.१ Dolphin API Gateway (केन्द्रीय प्रोक्सी ढोका)
|
|
836
|
+
यसले बाहिरबाट आउने HTTP र WebSocket अनुरोधहरूलाई सही माइक्रोसर्भिस (Auth, Products, Stream Services) मा पाइप (Stream pipe) र टनेल प्रोक्सी गर्छ:
|
|
837
|
+
```typescript
|
|
838
|
+
import { DolphinAPIGateway } from 'dolphin-server-modules/gateway';
|
|
839
|
+
|
|
840
|
+
const gateway = new DolphinAPIGateway({
|
|
841
|
+
routes: {
|
|
842
|
+
'/api/auth/*': 'http://localhost:3001', // Auth Service
|
|
843
|
+
'/api/products/*': 'http://localhost:3002', // Product CRUD Service
|
|
844
|
+
'/realtime': 'ws://localhost:3003' // Distributed Realtime Service
|
|
845
|
+
}
|
|
784
846
|
});
|
|
785
847
|
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
return ctx.html(html);
|
|
848
|
+
gateway.listen(3000, '0.0.0.0', () => {
|
|
849
|
+
console.log("Dolphin API Gateway successfully running on port 3000! 🎛️");
|
|
789
850
|
});
|
|
851
|
+
```
|
|
852
|
+
|
|
853
|
+
२०.२ Dolphin WebRPC (द्रुत अन्तर-सेवा सञ्चार)
|
|
854
|
+
जाभास्क्रिप्ट `Proxy` मा आधारित यो मोड्युलले दुई माइक्रोसर्भिस बीच बिना कुनै झन्झट स्थानीय फङ्सन कल गरे जस्तै गरी (Remote Procedure Call) काम गर्छ:
|
|
855
|
+
|
|
856
|
+
**RPC Server (UserService - Port 4001):**
|
|
857
|
+
```typescript
|
|
858
|
+
import { DolphinRPCServer } from 'dolphin-server-modules/rpc';
|
|
859
|
+
|
|
860
|
+
class UserService {
|
|
861
|
+
async getUserInfo(id: string) {
|
|
862
|
+
return { id, name: "Dr. Ram Prasad", role: "doctor" };
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
const rpcServer = new DolphinRPCServer();
|
|
867
|
+
rpcServer.register('User', new UserService());
|
|
868
|
+
rpcServer.listen(4001);
|
|
869
|
+
```
|
|
870
|
+
|
|
871
|
+
**RPC Client (OrderService calling UserService):**
|
|
872
|
+
```typescript
|
|
873
|
+
import { DolphinRPCClient } from 'dolphin-server-modules/rpc';
|
|
874
|
+
|
|
875
|
+
const client = new DolphinRPCClient({ url: 'http://localhost:4001' });
|
|
876
|
+
const userService = client.getService<any>('User');
|
|
790
877
|
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
878
|
+
// स्थानीय फङ्सन कल गरे जस्तै गरी रिमोट सर्भरको फङ्सन ए-सिङ्क कल गर्ने!
|
|
879
|
+
const doctor = await userService.getUserInfo('doc_789');
|
|
880
|
+
console.log(doctor.name); // Output: "Dr. Ram Prasad"
|
|
881
|
+
```
|
|
882
|
+
|
|
883
|
+
---
|
|
884
|
+
|
|
885
|
+
२१. Universal HTTP Adapters: Express र Fastify सँग इन्टिग्रेसन (New v2.11.7) 🔌
|
|
886
|
+
डल्फिनका कन्ट्रोलरहरू र CRUD रुटहरूलाई तपाईँले एक्सप्रेस (Express) वा फास्टिफाइ (Fastify) सर्भरमा सिधै प्लग-इन गर्न सक्नुहुन्छ। यसका लागि डल्फिनले `toExpress` र `toFastify` एडेप्टरहरू प्रदान गर्छ जसले फ्रेमवर्कको `ctx` लाई एक्सप्रेस/फास्टिफाइको `req/res` सँग स्वतः रूपान्तरण गर्छ:
|
|
887
|
+
|
|
888
|
+
```typescript
|
|
889
|
+
import express from 'express';
|
|
890
|
+
import { createCrudController, toExpress } from 'dolphin-server-modules';
|
|
891
|
+
import { db } from './db.js';
|
|
892
|
+
|
|
893
|
+
const app = express();
|
|
894
|
+
app.use(express.json());
|
|
895
|
+
|
|
896
|
+
const ctrl = createCrudController(db, 'Products');
|
|
897
|
+
|
|
898
|
+
// एक्सप्रेस भित्र डल्फिन कन्ट्रोलर रन गर्ने!
|
|
899
|
+
app.get('/api/products', toExpress(ctrl.getAll));
|
|
900
|
+
app.post('/api/products', toExpress(ctrl.create));
|
|
901
|
+
app.put('/api/products/:id', toExpress(ctrl.update));
|
|
902
|
+
|
|
903
|
+
app.listen(3000, () => console.log("Express integrated with Dolphin Controllers! 🔌"));
|
|
904
|
+
```
|
|
905
|
+
|
|
906
|
+
---
|
|
907
|
+
|
|
908
|
+
२२. Production Deployment (सर्भर लाइभ गर्ने)
|
|
909
|
+
तपाईँको Dolphin सर्भर रकेट जस्तै तयार छ। अब यसलाई लाइभ (World Wide Web) मा राख्न PM2 प्रयोग गरिन्छ जसले क्र्यास भएको खण्डमा तुरुन्त (0.1ms) सर्भरलाई अटो-रिस्टार्ट (Auto-Restart) गर्छ।
|
|
910
|
+
|
|
911
|
+
PM2 इन्स्टल र सुरु गर्न:
|
|
912
|
+
```bash
|
|
913
|
+
# 1. PM2 लाई Global रूपमा राख्ने
|
|
914
|
+
npm install -g pm2
|
|
915
|
+
|
|
916
|
+
# 2. तपाईंको Code लाई Build गर्ने
|
|
917
|
+
npm run build
|
|
918
|
+
|
|
919
|
+
# 3. PM2 द्वारा Background मा सर्भर सुरु गर्ने
|
|
920
|
+
pm2 start dist/index.js --name "dolphin-iot-backend"
|
|
921
|
+
|
|
922
|
+
# 4. सर्भरका Logs (Error/Info) हेर्न
|
|
923
|
+
pm2 logs dolphin-iot-backend
|
|
924
|
+
```
|
|
925
|
+
|
|
926
|
+
२३. निष्कर्ष (Conclusion)
|
|
927
|
+
बधाई छ! तपाईँले Dolphin Framework को Master Guide पूरा गर्नुभयो। अब तपाईँ:
|
|
928
|
+
|
|
929
|
+
✅ हाई-पर्फर्मेन्स API सर्भर बनाउन
|
|
930
|
+
✅ अटोमेटेड CRUD र भ्यालिडेसन प्रयोग गर्न
|
|
931
|
+
✅ RealtimeCore v2.0 सँग पूर्ण रियलटाइम एप्लिकेसन बनाउन
|
|
932
|
+
✅ pubPush/subPull सँग हाई-फ्रिक्वेन्सी डेटा ह्यान्डल गर्न
|
|
933
|
+
✅ pubFile/subFile सँग ठूला फाइलहरू रिज्युम सपोर्ट सहित ट्रान्सफर गर्न
|
|
934
|
+
✅ Device Management सँग डिभाइसहरू ट्र्याक गर्न
|
|
935
|
+
✅ WebRTC Intercom, IP Camera & RTSP Parser व्यवस्थापन गर्न
|
|
936
|
+
✅ Express/Fastify एडेप्टर र API Gateway सँग माइक्रोसर्भिस सञ्चालन गर्न
|
|
937
|
+
✅ अटो-जेनेरेटेड Swagger डकुमेन्टेसन बनाउन
|
|
938
|
+
|
|
939
|
+
सक्नुहुन्छ।
|
|
940
|
+
|
|
941
|
+
Happy Coding! 🐬🇳🇵
|
|
942
|
+
नेपालबाट विश्वस्तरको सफ्टवेयर बनाऔँ!��, तर फिल्टरिङ, सर्टिङ र लोड स्टेटहरू पनि म्यानेज गर्छ।
|
|
795
943
|
|
|
796
944
|
१६.१ स्टेट ट्र्याकिङ (State Tracking)
|
|
797
945
|
प्रत्येक कलेक्सनमा अब निम्न स्टेटहरू हुन्छन्:
|
package/README.md
CHANGED
|
@@ -1,107 +1,151 @@
|
|
|
1
|
-
# 🐬 Dolphin Framework (v2.11.
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-

|
|
5
|
-

|
|
6
|
-
|
|
7
|
-
**Dolphin** is a 2026-ready, ultra-lightweight, and 100% modular backend ecosystem built on native Node.js. Now featuring **Advanced Agentic AI (Cursor-Level)**—Dolphin doesn't just run your code; it understands your entire project, tracks symbols, and performs precision edits using semantic search.
|
|
8
|
-
|
|
9
|
-
> "Native performance. Agentic AI integration. Multi-model support."
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
### 📘 Official Master Guide (Nepal)
|
|
14
|
-
Dolphin Framework को विस्तृत र आधिकारिक गाइड उपलब्ध छ। यसमा **Auth, CRUD, Models, र Controllers** को १००% ट्युटोरियल समावेश छ।
|
|
15
|
-
|
|
16
|
-
👉 **[Dolphin Master Guide (Web Version)](https://raw.githack.com/Phuyalshankar/dolphin-server-modules/main/guide.html)** *(Most Up-to-Date)*
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## 🤖 Cursor-Level AI Features (New in v2.11.4)
|
|
21
|
-
|
|
22
|
-
Dolphin v2.11.4 introduces a complete overhaul of the AI Agent, bringing it closer to professional AI editors like Cursor.
|
|
23
|
-
|
|
24
|
-
### 1. Semantic Project Search
|
|
25
|
-
The AI doesn't just look at one file; it indexes your entire project. When you ask a question, it uses semantic token overlap to find the 5 most relevant files automatically.
|
|
26
|
-
|
|
27
|
-
### 2. Symbol & Reference Tracking
|
|
28
|
-
Dolphin indexes every `function`, `class`, and `variable` across your project. The AI knows exactly where a symbol is defined and where it's used.
|
|
29
|
-
|
|
30
|
-
### 3. Precision Patching (No Full Re-writes)
|
|
31
|
-
Using the new **Patch Tool**, Dolphin performs surgical edits to your code. No more slow, risky full-file overwrites for small changes.
|
|
32
|
-
|
|
33
|
-
### 4. Multi-Model Support (Local & Cloud)
|
|
34
|
-
Use any AI provider you want. Supports **Google Gemini**, **Groq (Llama 3)**, and **Local Ollama (Gemma 3/Llama 3)**.
|
|
35
|
-
```bash
|
|
36
|
-
# To use Local Ollama, set this in .env:
|
|
37
|
-
USE_OLLAMA=true
|
|
38
|
-
OLLAMA_MODEL=gemma3:latest
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### 5. Personalized Support (Roman Nepali)
|
|
42
|
-
The agent understands and replies in **Roman Nepali** (e.g., "Sanchai hunuhunchha?"), making it more comfortable for Nepali developers.
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
## 🛠️ CLI Usage
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
# Start the Autonomous AI Agent (Cursor Mode)
|
|
50
|
-
npx dolphin chat
|
|
51
|
-
|
|
52
|
-
# Architect a full production project
|
|
53
|
-
npx dolphin generate-full "e-commerce backend"
|
|
54
|
-
|
|
55
|
-
# Scaffold standard components (No AI needed)
|
|
56
|
-
npx dolphin add auth # Add Auth System
|
|
57
|
-
npx dolphin add crud Product # Add CRUD for Product
|
|
58
|
-
npx dolphin add adapter mongoose # Setup DB
|
|
59
|
-
|
|
60
|
-
# Initialize folders
|
|
61
|
-
npx dolphin init-prod
|
|
62
|
-
|
|
63
|
-
# Start Dev Server
|
|
64
|
-
npx dolphin serve --port=3000
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
|
|
69
|
-
## 🚀
|
|
70
|
-
|
|
71
|
-
Dolphin
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
app.
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
1
|
+
# 🐬 Dolphin Framework (v2.11.7)
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
**Dolphin** is a 2026-ready, ultra-lightweight, and 100% modular backend ecosystem built on native Node.js. Now featuring **Advanced Agentic AI (Cursor-Level)**—Dolphin doesn't just run your code; it understands your entire project, tracks symbols, and performs precision edits using semantic search.
|
|
8
|
+
|
|
9
|
+
> "Native performance. Agentic AI integration. Multi-model support."
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
### 📘 Official Master Guide (Nepal)
|
|
14
|
+
Dolphin Framework को विस्तृत र आधिकारिक गाइड उपलब्ध छ। यसमा **Auth, CRUD, Models, र Controllers** को १००% ट्युटोरियल समावेश छ।
|
|
15
|
+
|
|
16
|
+
👉 **[Dolphin Master Guide (Web Version)](https://raw.githack.com/Phuyalshankar/dolphin-server-modules/main/guide.html)** *(Most Up-to-Date)*
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 🤖 Cursor-Level AI Features (New in v2.11.4)
|
|
21
|
+
|
|
22
|
+
Dolphin v2.11.4 introduces a complete overhaul of the AI Agent, bringing it closer to professional AI editors like Cursor.
|
|
23
|
+
|
|
24
|
+
### 1. Semantic Project Search
|
|
25
|
+
The AI doesn't just look at one file; it indexes your entire project. When you ask a question, it uses semantic token overlap to find the 5 most relevant files automatically.
|
|
26
|
+
|
|
27
|
+
### 2. Symbol & Reference Tracking
|
|
28
|
+
Dolphin indexes every `function`, `class`, and `variable` across your project. The AI knows exactly where a symbol is defined and where it's used.
|
|
29
|
+
|
|
30
|
+
### 3. Precision Patching (No Full Re-writes)
|
|
31
|
+
Using the new **Patch Tool**, Dolphin performs surgical edits to your code. No more slow, risky full-file overwrites for small changes.
|
|
32
|
+
|
|
33
|
+
### 4. Multi-Model Support (Local & Cloud)
|
|
34
|
+
Use any AI provider you want. Supports **Google Gemini**, **Groq (Llama 3)**, and **Local Ollama (Gemma 3/Llama 3)**.
|
|
35
|
+
```bash
|
|
36
|
+
# To use Local Ollama, set this in .env:
|
|
37
|
+
USE_OLLAMA=true
|
|
38
|
+
OLLAMA_MODEL=gemma3:latest
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 5. Personalized Support (Roman Nepali)
|
|
42
|
+
The agent understands and replies in **Roman Nepali** (e.g., "Sanchai hunuhunchha?"), making it more comfortable for Nepali developers.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 🛠️ CLI Usage
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Start the Autonomous AI Agent (Cursor Mode)
|
|
50
|
+
npx dolphin chat
|
|
51
|
+
|
|
52
|
+
# Architect a full production project
|
|
53
|
+
npx dolphin generate-full "e-commerce backend"
|
|
54
|
+
|
|
55
|
+
# Scaffold standard components (No AI needed)
|
|
56
|
+
npx dolphin add auth # Add Auth System
|
|
57
|
+
npx dolphin add crud Product # Add CRUD for Product
|
|
58
|
+
npx dolphin add adapter mongoose # Setup DB
|
|
59
|
+
|
|
60
|
+
# Initialize folders
|
|
61
|
+
npx dolphin init-prod
|
|
62
|
+
|
|
63
|
+
# Start Dev Server
|
|
64
|
+
npx dolphin serve --port=3000
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 🚀 Microservices & Smart Intercom Ecosystem (New in v2.11.7)
|
|
70
|
+
|
|
71
|
+
Dolphin v2.11.7 introduces a complete suite of enterprise-grade microservice modules and smart building signaling/streaming pipelines:
|
|
72
|
+
|
|
73
|
+
### 1. Universal HTTP Framework Adapters
|
|
74
|
+
Run Dolphin's Mongoose-synced CRUD controllers and Auth middleware directly inside **Express** or **Fastify**!
|
|
75
|
+
```javascript
|
|
76
|
+
import express from 'express';
|
|
77
|
+
import { createCrudController, toExpress } from 'dolphin-server-modules';
|
|
78
|
+
|
|
79
|
+
const app = express();
|
|
80
|
+
const ctrl = createCrudController(db, 'Products');
|
|
81
|
+
|
|
82
|
+
app.get('/api/products', toExpress(ctrl.getAll));
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 2. High-Performance WebRPC
|
|
86
|
+
Decouple service interactions with a type-safe, Proxy-based, sub-millisecond remote procedure call (RPC) client/server engine:
|
|
87
|
+
```javascript
|
|
88
|
+
import { DolphinRPCClient } from 'dolphin-server-modules/rpc';
|
|
89
|
+
|
|
90
|
+
const client = new DolphinRPCClient({ url: 'http://localhost:4001' });
|
|
91
|
+
const userService = client.getService('User');
|
|
92
|
+
|
|
93
|
+
// Call remote methods asynchronously as if they were local!
|
|
94
|
+
const user = await userService.getUserInfo('user_123');
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 3. API Gateway Router
|
|
98
|
+
A zero-dependency reverse proxy server that redirects HTTP and WebSocket upgrade streams dynamically:
|
|
99
|
+
```javascript
|
|
100
|
+
import { DolphinAPIGateway } from 'dolphin-server-modules/gateway';
|
|
101
|
+
|
|
102
|
+
const gateway = new DolphinAPIGateway({
|
|
103
|
+
routes: {
|
|
104
|
+
'/api/auth/*': 'http://localhost:3001',
|
|
105
|
+
'/api/products/*': 'http://localhost:3002',
|
|
106
|
+
'/realtime': 'ws://localhost:3003'
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
gateway.listen(3000);
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 4. CCTV Camera, RTSP Puller & WebRTC Intercom
|
|
113
|
+
- **RtspPullerModule**: Feeds streams from IP cameras/NVRs. Features a **Pure TCP RTP buffer parser** (zero external binaries/FFmpeg!) for low-resource environments, and FFmpeg Fallbacks.
|
|
114
|
+
- **UniversalSignaling**: A telecom-ready WebRTC signaling server with native invite-accept-reject-end handshakes and bidirectional ACK confirmations—perfect for smart doorphones and nurse calling systems!
|
|
115
|
+
|
|
116
|
+
### 5. 100% Hookless Realtime Architecture (New)
|
|
117
|
+
Dolphin introduces `autoBroadcast` and `DolphinStore` allowing you to manage full CRUD data flows in React without writing a single `useState`, `useEffect`, or `onSubmit` handler.
|
|
118
|
+
```javascript
|
|
119
|
+
// 1. Initialize with autoBroadcast
|
|
120
|
+
const dolphin = new DolphinClient('http://localhost:3000', 'dev', { autoBroadcast: true });
|
|
121
|
+
|
|
122
|
+
// 2. Hookless Form (Automatically syncs to Database and publishes via WebSocket)
|
|
123
|
+
<form data-api-submit="POST /api/products">
|
|
124
|
+
<input name="productName" />
|
|
125
|
+
<button type="submit">Save</button>
|
|
126
|
+
</form>
|
|
127
|
+
|
|
128
|
+
// 3. Auto-updating UI
|
|
129
|
+
const store = useSyncExternalStore(
|
|
130
|
+
(listener) => dolphin.store.subscribe(listener),
|
|
131
|
+
() => dolphin.store.getSnapshot('products')
|
|
132
|
+
);
|
|
133
|
+
// 'store.items' updates in realtime automatically when ANY user submits!
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## 🗺️ Roadmap
|
|
139
|
+
- [x] **Agentic AI Scaffolding**: Full project generation via Gemini/Groq
|
|
140
|
+
- [x] **Semantic Search & Symbol Indexing**: Precision context building
|
|
141
|
+
- [x] **Precision Patching**: AST-style surgical code edits
|
|
142
|
+
- [x] **Express/Fastify Adapters**: Pluggable Dolphin Context middleware
|
|
143
|
+
- [x] **Independent WebRPC & API Gateway**: High-speed microservices orchestration
|
|
144
|
+
- [x] **IP Camera RTSP & WebRTC Intercom**: Pure TCP stream parsing and VoIP SIP signaling
|
|
145
|
+
- [ ] **One-Click Deployment**: Deploy to Vercel/Cloudflare from CLI
|
|
146
|
+
- [ ] **Visual Debugger**: Built-in web dashboard for monitoring
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 📄 License
|
|
107
151
|
ISC © 2026 Shankar Phuyal & Dolphin Team.
|
package/TUTORIAL_NEPALI.md
CHANGED
|
@@ -98,7 +98,43 @@ OLLAMA_MODEL=gemma3:latest
|
|
|
98
98
|
|
|
99
99
|
---
|
|
100
100
|
|
|
101
|
-
## ७.
|
|
101
|
+
## ७. Hookless Data Management (autoBroadcast) [NEW]
|
|
102
|
+
|
|
103
|
+
Dolphin मा अब `autoBroadcast` सुविधा थपिएको छ। यसको मद्दतले तपाईँले React मा `useState`, `useEffect`, वा `onSubmit` लेख्नै पर्दैन।
|
|
104
|
+
|
|
105
|
+
```jsx
|
|
106
|
+
import { useSyncExternalStore } from 'react';
|
|
107
|
+
import { DolphinClient } from 'dolphin-server-modules/client';
|
|
108
|
+
|
|
109
|
+
// १. autoBroadcast अन गर्नुहोस्
|
|
110
|
+
const dolphin = new DolphinClient('http://localhost:3000', 'dev', { autoBroadcast: true });
|
|
111
|
+
|
|
112
|
+
function ProductApp() {
|
|
113
|
+
// २. डेटा आफैँ सिंक (Sync) हुन्छ
|
|
114
|
+
const products = useSyncExternalStore(
|
|
115
|
+
(listener) => dolphin.store.subscribe(listener),
|
|
116
|
+
() => dolphin.store.getSnapshot('products')
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<div>
|
|
121
|
+
{/* ३. Hookless फर्म: यसले आफैँ API कल गर्छ र सबै प्रयोगकर्तालाई Realtime मा अपडेट पठाउँछ */}
|
|
122
|
+
<form data-api-submit="POST /api/products">
|
|
123
|
+
<input name="name" placeholder="प्रोडक्टको नाम" required />
|
|
124
|
+
<button type="submit">थप्नुहोस्</button>
|
|
125
|
+
</form>
|
|
126
|
+
|
|
127
|
+
<ul>
|
|
128
|
+
{products.items.map(p => <li key={p.id}>{p.name}</li>)}
|
|
129
|
+
</ul>
|
|
130
|
+
</div>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## ८. अन्तिममा (Conclusion)
|
|
102
138
|
|
|
103
139
|
Dolphin Framework अब एउटा सामान्य फ्रेमवर्क मात्र होइन, यो तपाईँको एउटा "एआई साथी" पनि हो। यसले तपाईँको कोडिङ स्पिड १० गुणा बढाउन मद्दत गर्छ।
|
|
104
140
|
|
package/dist/client.test.js
CHANGED
|
@@ -167,6 +167,17 @@ describe('APIHandler — proxy paths', () => {
|
|
|
167
167
|
const [, opts] = global.fetch.mock.calls[0];
|
|
168
168
|
expect(opts.headers['Authorization']).toBe('Bearer tok99');
|
|
169
169
|
});
|
|
170
|
+
test('autoBroadcast — POST request पछि realtime publish गर्छ', async () => {
|
|
171
|
+
const cAuto = new DolphinClient('http://localhost:3000', 'dev', { autoBroadcast: true });
|
|
172
|
+
cAuto.publish = jest.fn();
|
|
173
|
+
global.fetch = makeFetch(200, { data: 'success' });
|
|
174
|
+
await cAuto.api.request('POST', '/api/users', { name: 'Ram' });
|
|
175
|
+
expect(cAuto.publish).toHaveBeenCalledWith('api/users', {
|
|
176
|
+
method: 'POST',
|
|
177
|
+
payload: { name: 'Ram' },
|
|
178
|
+
result: { data: 'success' }
|
|
179
|
+
});
|
|
180
|
+
});
|
|
170
181
|
});
|
|
171
182
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
172
183
|
// 4. APIHandler — request timeout
|