baraqex 1.0.63 → 1.0.65
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/bin/baraqex.js +1013 -1126
- package/dist/api/hello.d.ts +3 -0
- package/dist/api/hello.d.ts.map +1 -0
- package/dist/api/users/[id].d.ts +5 -0
- package/dist/api/users/[id].d.ts.map +1 -0
- package/dist/browser.d.ts +40 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +407 -1
- package/dist/browser.js.map +4 -4
- package/dist/browser.package.json +4 -0
- package/dist/forms/index.d.ts +2 -0
- package/dist/forms/index.d.ts.map +1 -0
- package/dist/forms/types.d.ts +2 -0
- package/dist/forms/types.d.ts.map +1 -0
- package/dist/frontend/components/WasmLoader.d.ts +2 -0
- package/dist/frontend/components/WasmLoader.d.ts.map +1 -0
- package/dist/frontend/hooks/useWasm.d.ts +2 -0
- package/dist/frontend/hooks/useWasm.d.ts.map +1 -0
- package/dist/frontend/index.d.ts +2 -0
- package/dist/frontend/index.d.ts.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +678 -317
- package/dist/index.js.map +4 -4
- package/dist/renderComponent.d.ts +9 -0
- package/dist/renderComponent.d.ts.map +1 -0
- package/dist/router/index.d.ts +2 -0
- package/dist/router/index.d.ts.map +1 -0
- package/dist/router/types.d.ts +2 -0
- package/dist/router/types.d.ts.map +1 -0
- package/dist/server/api-router.d.ts +16 -0
- package/dist/server/api-router.d.ts.map +1 -0
- package/dist/server/auth.d.ts +25 -0
- package/dist/server/auth.d.ts.map +1 -0
- package/dist/server/database.d.ts +22 -0
- package/dist/server/database.d.ts.map +1 -0
- package/dist/server/index.d.ts +116 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/{server.js → server/index.js} +120 -23
- package/dist/server/index.js.map +7 -0
- package/dist/server/middleware.d.ts +11 -0
- package/dist/server/middleware.d.ts.map +1 -0
- package/dist/server/package.json +4 -0
- package/dist/server/templates.d.ts +31 -0
- package/dist/server/templates.d.ts.map +1 -0
- package/dist/server/types.d.ts +69 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/utils.d.ts +70 -0
- package/dist/server/utils.d.ts.map +1 -0
- package/dist/server/wasm.d.ts +29 -0
- package/dist/server/wasm.d.ts.map +1 -0
- package/dist/server-renderer.d.ts +5 -0
- package/dist/server-renderer.d.ts.map +1 -0
- package/dist/store/index.d.ts +2 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/types.d.ts +2 -0
- package/dist/store/types.d.ts.map +1 -0
- package/dist/wasm.d.ts +51 -0
- package/dist/wasm.d.ts.map +1 -0
- package/package.json +65 -56
- package/templates/basic-app/src/main.tsx +1 -0
- package/templates/fullstack-template/.env.example +42 -0
- package/templates/fullstack-template/README.md +38 -42
- package/templates/fullstack-template/package-lock.json +7932 -0
- package/templates/fullstack-template/package.json +58 -6
- package/templates/fullstack-template/server.js +28 -9
- package/templates/fullstack-template/src/App.tsx +94 -0
- package/templates/fullstack-template/src/api/auth/login.ts +75 -0
- package/templates/fullstack-template/src/api/auth/me.ts +66 -0
- package/templates/fullstack-template/src/api/auth/register.ts +59 -0
- package/templates/fullstack-template/src/api/todos/[id].ts +108 -0
- package/templates/fullstack-template/src/api/todos/index.ts +79 -0
- package/templates/fullstack-template/src/components/Dashboard.tsx +129 -0
- package/templates/fullstack-template/src/components/Header.tsx +76 -0
- package/templates/fullstack-template/src/contexts/ApiContext.tsx +69 -0
- package/templates/fullstack-template/src/contexts/AuthContext.tsx +155 -0
- package/templates/fullstack-template/src/server.ts +167 -0
- package/templates/fullstack-template/src/styles/App.css +446 -0
- package/templates/ssr-template/package-lock.json +38 -60
- package/templates/ssr-template/package.json +1 -1
- package/templates/ssr-template/src/App.tsx +4 -3
- package/templates/ssr-template/src/client.tsx +2 -1
- package/templates/wasm/App.tsx +564 -0
- package/templates/wasm/client.tsx +220 -0
- package/templates/wasm/index.tsx +21 -0
- package/templates/wasm/package-lock.json +5347 -5307
- package/templates/wasm/package.json +43 -25
- package/templates/wasm/public/example.wasm +0 -0
- package/templates/wasm/public/wasm_exec.js +1 -12
- package/templates/wasm/server.ts +145 -0
- package/templates/wasm/vite.config.ts +42 -24
- package/README_WASM.md +0 -472
- package/dist/server.js.map +0 -7
- package/templates/basic-app/src/App.jsx +0 -0
- package/templates/basic-app/src/App.tsx +0 -0
- package/templates/fullstack-template/src/api/hello.js +0 -17
- package/templates/fullstack-template/src/pages/index.js +0 -206
- /package/templates/{basic-app/server.js → wasm/go/wasm_exec.js} +0 -0
package/package.json
CHANGED
|
@@ -1,56 +1,81 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "baraqex",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "A powerful
|
|
3
|
+
"version": "1.0.65",
|
|
4
|
+
"description": "A powerful full-stack framework for modern web development",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
5
8
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
10
|
-
"
|
|
11
|
-
"import": "./dist/index.js"
|
|
11
|
+
"browser": "./dist/browser.js",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs",
|
|
14
|
+
"types": "./dist/index.d.ts"
|
|
12
15
|
},
|
|
13
16
|
"./browser": {
|
|
14
|
-
"
|
|
15
|
-
"
|
|
17
|
+
"import": "./dist/browser.js",
|
|
18
|
+
"types": "./dist/browser.d.ts"
|
|
16
19
|
},
|
|
17
20
|
"./server": {
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
},
|
|
21
|
-
"./wasm": {
|
|
22
|
-
"types": "./dist/wasm.d.ts",
|
|
23
|
-
"import": "./dist/wasm.js"
|
|
21
|
+
"import": "./dist/server.js",
|
|
22
|
+
"types": "./dist/server.d.ts"
|
|
24
23
|
}
|
|
25
24
|
},
|
|
25
|
+
"browser": {
|
|
26
|
+
"./dist/index.js": "./dist/browser.js",
|
|
27
|
+
"crypto": false,
|
|
28
|
+
"fs": false,
|
|
29
|
+
"path": false,
|
|
30
|
+
"http": false,
|
|
31
|
+
"https": false,
|
|
32
|
+
"express": false,
|
|
33
|
+
"cors": false,
|
|
34
|
+
"mongodb": false,
|
|
35
|
+
"mysql2": false,
|
|
36
|
+
"pg": false,
|
|
37
|
+
"bcryptjs": false,
|
|
38
|
+
"jsonwebtoken": false
|
|
39
|
+
},
|
|
26
40
|
"files": [
|
|
27
41
|
"dist/",
|
|
28
42
|
"templates/",
|
|
29
43
|
"bin/",
|
|
30
|
-
"README.md"
|
|
31
|
-
"README_WASM.md"
|
|
44
|
+
"README.md"
|
|
32
45
|
],
|
|
33
46
|
"bin": {
|
|
34
47
|
"baraqex": "./bin/baraqex.js"
|
|
35
48
|
},
|
|
36
49
|
"scripts": {
|
|
37
|
-
"build": "npm run clean && npm run build:
|
|
38
|
-
"build:types": "tsc --
|
|
39
|
-
"build:
|
|
50
|
+
"build": "npm run clean && npm run build:esm",
|
|
51
|
+
"build:types": "tsc --emitDeclarationOnly",
|
|
52
|
+
"build:esm": "node build.mjs",
|
|
40
53
|
"clean": "rimraf dist",
|
|
41
|
-
"dev": "npm run build && node dev-server.js",
|
|
42
54
|
"test": "jest",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"lint:fix": "eslint src/**/*.ts --fix",
|
|
46
|
-
"prepare": "npm run build"
|
|
55
|
+
"dev": "tsc --watch",
|
|
56
|
+
"prepublishOnly": "npm run build"
|
|
47
57
|
},
|
|
58
|
+
"keywords": [
|
|
59
|
+
"framework",
|
|
60
|
+
"frontend",
|
|
61
|
+
"backend",
|
|
62
|
+
"fullstack",
|
|
63
|
+
"react",
|
|
64
|
+
"ssr",
|
|
65
|
+
"wasm",
|
|
66
|
+
"go"
|
|
67
|
+
],
|
|
68
|
+
"author": "Mohamed X",
|
|
69
|
+
"license": "MIT",
|
|
48
70
|
"dependencies": {
|
|
49
|
-
"
|
|
71
|
+
"chokidar": "^4.0.3",
|
|
72
|
+
"frontend-hamroun": "^1.2.35",
|
|
73
|
+
"open": "^10.1.2",
|
|
74
|
+
"ws": "^8.18.2"
|
|
50
75
|
},
|
|
51
76
|
"peerDependencies": {
|
|
52
|
-
"
|
|
53
|
-
"
|
|
77
|
+
"cors": "^2.8.5",
|
|
78
|
+
"express": "^4.18.0"
|
|
54
79
|
},
|
|
55
80
|
"peerDependenciesMeta": {
|
|
56
81
|
"express": {
|
|
@@ -76,39 +101,23 @@
|
|
|
76
101
|
}
|
|
77
102
|
},
|
|
78
103
|
"devDependencies": {
|
|
104
|
+
"@types/bcryptjs": "^2.4.6",
|
|
105
|
+
"@types/cors": "^2.8.18",
|
|
106
|
+
"@types/express": "^5.0.2",
|
|
79
107
|
"@types/node": "^20.0.0",
|
|
80
|
-
"@types/
|
|
81
|
-
"@types/cors": "^2.8.0",
|
|
82
|
-
"@types/bcryptjs": "^2.4.0",
|
|
83
|
-
"@types/jsonwebtoken": "^9.0.0",
|
|
84
|
-
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
85
|
-
"@typescript-eslint/parser": "^6.0.0",
|
|
108
|
+
"@types/pg": "^8.15.4",
|
|
86
109
|
"esbuild": "^0.19.0",
|
|
87
|
-
"eslint": "^8.0.0",
|
|
88
110
|
"jest": "^29.0.0",
|
|
89
111
|
"rimraf": "^5.0.0",
|
|
90
112
|
"typescript": "^5.0.0"
|
|
91
113
|
},
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
|
|
101
|
-
"database",
|
|
102
|
-
"auth"
|
|
103
|
-
],
|
|
104
|
-
"author": "Your Name",
|
|
105
|
-
"license": "MIT",
|
|
106
|
-
"repository": {
|
|
107
|
-
"type": "git",
|
|
108
|
-
"url": "https://github.com/yourusername/baraqex.git"
|
|
109
|
-
},
|
|
110
|
-
"bugs": {
|
|
111
|
-
"url": "https://github.com/yourusername/baraqex/issues"
|
|
112
|
-
},
|
|
113
|
-
"homepage": "https://github.com/yourusername/baraqex#readme"
|
|
114
|
+
"optionalDependencies": {
|
|
115
|
+
"bcryptjs": "^2.4.3",
|
|
116
|
+
"cors": "^2.8.5",
|
|
117
|
+
"express": "^4.18.0",
|
|
118
|
+
"jsonwebtoken": "^9.0.0",
|
|
119
|
+
"mongodb": "^6.0.0",
|
|
120
|
+
"mysql2": "^3.6.0",
|
|
121
|
+
"pg": "^8.11.0"
|
|
122
|
+
}
|
|
114
123
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Server Configuration
|
|
2
|
+
PORT=3000
|
|
3
|
+
NODE_ENV=development
|
|
4
|
+
|
|
5
|
+
# Authentication
|
|
6
|
+
JWT_SECRET=your-super-secret-jwt-key-change-in-production
|
|
7
|
+
JWT_EXPIRES_IN=7d
|
|
8
|
+
|
|
9
|
+
# Database Configuration (optional)
|
|
10
|
+
# DATABASE_URL=mongodb://localhost:27017/fullstack_app
|
|
11
|
+
# DATABASE_TYPE=mongodb
|
|
12
|
+
|
|
13
|
+
# For PostgreSQL:
|
|
14
|
+
# DATABASE_URL=postgresql://username:password@localhost:5432/fullstack_app
|
|
15
|
+
# DATABASE_TYPE=postgres
|
|
16
|
+
|
|
17
|
+
# For MySQL:
|
|
18
|
+
# DATABASE_URL=mysql://username:password@localhost:3306/fullstack_app
|
|
19
|
+
# DATABASE_TYPE=mysql
|
|
20
|
+
|
|
21
|
+
# Frontend URL (for CORS in production)
|
|
22
|
+
FRONTEND_URL=http://localhost:3000
|
|
23
|
+
|
|
24
|
+
# Session Configuration
|
|
25
|
+
SESSION_SECRET=your-session-secret-key
|
|
26
|
+
|
|
27
|
+
# Email Configuration (for future features)
|
|
28
|
+
# SMTP_HOST=smtp.gmail.com
|
|
29
|
+
# SMTP_PORT=587
|
|
30
|
+
# SMTP_USER=your-email@gmail.com
|
|
31
|
+
# SMTP_PASS=your-app-password
|
|
32
|
+
|
|
33
|
+
# File Upload Configuration
|
|
34
|
+
MAX_FILE_SIZE=5MB
|
|
35
|
+
UPLOAD_DIR=uploads
|
|
36
|
+
|
|
37
|
+
# Redis Configuration (for caching/sessions)
|
|
38
|
+
# REDIS_URL=redis://localhost:6379
|
|
39
|
+
|
|
40
|
+
# API Rate Limiting
|
|
41
|
+
RATE_LIMIT_WINDOW_MS=900000
|
|
42
|
+
RATE_LIMIT_MAX_REQUESTS=100
|
|
@@ -1,56 +1,52 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Fullstack Baraqex Application
|
|
2
2
|
|
|
3
|
-
A complete
|
|
3
|
+
A complete fullstack application template built with the Baraqex framework, featuring authentication, API integration, and modern development practices.
|
|
4
4
|
|
|
5
|
-
## Features
|
|
5
|
+
## 🚀 Features
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
7
|
+
- **Full-Stack Architecture**: Complete frontend and backend integration
|
|
8
|
+
- **Authentication System**: JWT-based auth with login/register
|
|
9
|
+
- **RESTful API**: Well-structured API endpoints with middleware
|
|
10
|
+
- **Database Support**: MongoDB, MySQL, and PostgreSQL options
|
|
11
|
+
- **Real-time Updates**: Modern state management
|
|
12
|
+
- **Security**: Built-in security headers, rate limiting, CORS
|
|
13
|
+
- **Developer Experience**: Hot reload, TypeScript, ESLint, Prettier
|
|
14
|
+
- **Production Ready**: Environment configuration, logging, error handling
|
|
13
15
|
|
|
14
|
-
##
|
|
16
|
+
## 📋 Prerequisites
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
npm
|
|
18
|
-
|
|
19
|
-
```
|
|
18
|
+
- Node.js 16+
|
|
19
|
+
- npm, yarn, or pnpm
|
|
20
|
+
- Database (optional - works with in-memory storage for demo)
|
|
20
21
|
|
|
21
|
-
##
|
|
22
|
+
## 🛠️ Quick Start
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
└── api/ # API routes
|
|
28
|
-
└── hello.js # Example API endpoint
|
|
29
|
-
```
|
|
24
|
+
1. **Install dependencies**
|
|
25
|
+
```bash
|
|
26
|
+
npm install
|
|
27
|
+
```
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
2. **Environment setup**
|
|
30
|
+
```bash
|
|
31
|
+
cp .env.example .env
|
|
32
|
+
# Edit .env with your configuration
|
|
33
|
+
```
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
3. **Start development server**
|
|
36
|
+
```bash
|
|
37
|
+
npm run dev
|
|
38
|
+
```
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
4. **Open your browser**
|
|
41
|
+
- Frontend: http://localhost:3000
|
|
42
|
+
- API: http://localhost:3000/api
|
|
43
|
+
- API Docs: http://localhost:3000/api-docs
|
|
37
44
|
|
|
38
|
-
|
|
39
|
-
- `src/pages/about.js` → `/about`
|
|
40
|
-
- `src/pages/contact.js` → `/contact`
|
|
41
|
-
- `src/pages/blog/index.js` → `/blog`
|
|
45
|
+
## 🎯 Default Credentials
|
|
42
46
|
|
|
43
|
-
|
|
47
|
+
For demo purposes, you can login with:
|
|
48
|
+
- **Username**: `admin` or `user`
|
|
49
|
+
- **Password**: `password`
|
|
44
50
|
|
|
45
|
-
|
|
46
|
-
- `src/api/users.js` → `/api/users`
|
|
47
|
-
- `src/api/posts/index.js` → `/api/posts`
|
|
48
|
-
- `src/api/posts/[id].js` → `/api/posts/:id`
|
|
51
|
+
## 📁 Project Structure
|
|
49
52
|
|
|
50
|
-
Each API file should export functions named after HTTP methods:
|
|
51
|
-
```javascript
|
|
52
|
-
export function get(req, res) { /* ... */ }
|
|
53
|
-
export function post(req, res) { /* ... */ }
|
|
54
|
-
export function put(req, res) { /* ... */ }
|
|
55
|
-
export function delete(req, res) { /* ... */ }
|
|
56
|
-
```
|