arcanajs 0.2.2

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.
Files changed (44) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +284 -0
  3. package/bin/arcana.ts +19 -0
  4. package/dist/bin/arcana.d.ts +4 -0
  5. package/dist/bin/arcana.d.ts.map +1 -0
  6. package/dist/bin/arcana.js +17 -0
  7. package/dist/bin/arcana.js.map +1 -0
  8. package/dist/config/default.d.ts +7 -0
  9. package/dist/config/default.d.ts.map +1 -0
  10. package/dist/config/default.js +8 -0
  11. package/dist/config/default.js.map +1 -0
  12. package/dist/src/controllers/HomeController.d.ts +6 -0
  13. package/dist/src/controllers/HomeController.d.ts.map +1 -0
  14. package/dist/src/controllers/HomeController.js +9 -0
  15. package/dist/src/controllers/HomeController.js.map +1 -0
  16. package/dist/src/middleware/auth.d.ts +3 -0
  17. package/dist/src/middleware/auth.d.ts.map +1 -0
  18. package/dist/src/middleware/auth.js +9 -0
  19. package/dist/src/middleware/auth.js.map +1 -0
  20. package/dist/src/models/User.d.ts +11 -0
  21. package/dist/src/models/User.d.ts.map +1 -0
  22. package/dist/src/models/User.js +45 -0
  23. package/dist/src/models/User.js.map +1 -0
  24. package/dist/src/repositories/UserRepository.d.ts +9 -0
  25. package/dist/src/repositories/UserRepository.d.ts.map +1 -0
  26. package/dist/src/repositories/UserRepository.js +19 -0
  27. package/dist/src/repositories/UserRepository.js.map +1 -0
  28. package/dist/src/routes/index.d.ts +3 -0
  29. package/dist/src/routes/index.d.ts.map +1 -0
  30. package/dist/src/routes/index.js +14 -0
  31. package/dist/src/routes/index.js.map +1 -0
  32. package/dist/src/server.d.ts +2 -0
  33. package/dist/src/server.d.ts.map +1 -0
  34. package/dist/src/server.js +34 -0
  35. package/dist/src/server.js.map +1 -0
  36. package/dist/src/services/UserService.d.ts +8 -0
  37. package/dist/src/services/UserService.d.ts.map +1 -0
  38. package/dist/src/services/UserService.js +16 -0
  39. package/dist/src/services/UserService.js.map +1 -0
  40. package/dist/src/views/pages/home.d.ts +2 -0
  41. package/dist/src/views/pages/home.d.ts.map +1 -0
  42. package/dist/src/views/pages/home.js +13 -0
  43. package/dist/src/views/pages/home.js.map +1 -0
  44. package/package.json +81 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Mohammed Ben Cheikh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,284 @@
1
+ # Arcana.js
2
+
3
+ <p align="center">
4
+ <img src="https://digiclips.ma/ArcanaJS.png" alt="Arcana.js Logo" width="200" height="200">
5
+ </p>
6
+
7
+ <p align="center">
8
+ A powerful full-stack framework combining Express, React, and MongoDB with server-side rendering
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="#features">Features</a> •
13
+ <a href="#installation">Installation</a> •
14
+ <a href="#quick-start">Quick Start</a> •
15
+ <a href="#architecture">Architecture</a> •
16
+ <a href="#routing">Routing</a> •
17
+ <a href="#documentation">Documentation</a> •
18
+ <a href="#examples">Examples</a> •
19
+ <a href="#contributing">Contributing</a> •
20
+ <a href="#license">License</a>
21
+ </p>
22
+
23
+ ## Overview
24
+
25
+ Arcana.js is a comprehensive full-stack JavaScript framework built on top of Express.js and React, designed to create scalable, maintainable web applications with server-side rendering capabilities. By leveraging MongoDB and Mongoose, it provides a complete solution for modern web development following best practices in software architecture.
26
+
27
+ ## Features
28
+
29
+ - **Express.js Backend**: Fast, unopinionated, minimalist web framework as the foundation
30
+ - **React Frontend**: Component-based UI with server-side rendering out of the box
31
+ - **MongoDB & Mongoose**: Powerful data modeling and integration with MongoDB
32
+ - **MVC Architecture**: Clean separation of concerns with Model-View-Controller pattern
33
+ - **OOP Principles**: Object-oriented design throughout the codebase
34
+ - **Repository Pattern**: Abstraction layer between data access and business logic
35
+ - **Server-Side Rendering**: Improved performance and SEO capabilities
36
+ - **Scalable Architecture**: Designed to grow with your application needs
37
+ - **TypeScript Support**: Optional static typing for better developer experience
38
+ - **Built-in Middleware**: Common functionality pre-configured
39
+ - **Elegant Routing System**: Declarative and flexible route definition
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ # Install Arcana.js CLI globally
45
+ npm install -g arcana-cli
46
+
47
+ # Create a new Arcana.js project
48
+ arcana create my-awesome-app
49
+
50
+ # Navigate to project directory
51
+ cd my-awesome-app
52
+
53
+ # Install dependencies
54
+ npm install
55
+
56
+ # Start development server
57
+ npm run dev
58
+ ```
59
+
60
+ ## Quick Start
61
+
62
+ After installation, your application will be running at `http://localhost:3000`.
63
+
64
+ ```javascript
65
+ // Example controller: src/controllers/UserController.js
66
+ import { Controller } from 'arcana/core';
67
+ import { UserRepository } from '../repositories/UserRepository';
68
+
69
+ export class UserController extends Controller {
70
+ constructor() {
71
+ super();
72
+ this.userRepository = new UserRepository();
73
+ }
74
+
75
+ async index(req, res) {
76
+ const users = await this.userRepository.findAll();
77
+ return this.render('users/index', { users });
78
+ }
79
+
80
+ async show(req, res) {
81
+ const user = await this.userRepository.findById(req.params.id);
82
+ return this.render('users/show', { user });
83
+ }
84
+ }
85
+ ```
86
+
87
+ ## Architecture
88
+
89
+ Arcana.js follows the MVC (Model-View-Controller) architecture with a strong emphasis on the repository pattern:
90
+
91
+ ```
92
+ my-awesome-app/
93
+ ├── config/ # Application configuration
94
+ ├── public/ # Static assets
95
+ ├── src/
96
+ │ ├── controllers/ # Route controllers
97
+ │ ├── models/ # Mongoose models
98
+ │ ├── repositories/ # Data access layer
99
+ │ ├── services/ # Business logic
100
+ │ ├── views/ # React components for SSR
101
+ │ │ ├── layouts/ # Layout components
102
+ │ │ └── pages/ # Page components
103
+ │ └── routes/ # Route definitions
104
+ ├── tests/ # Test files
105
+ ├── .env # Environment variables
106
+ ├── .gitignore
107
+ ├── package.json
108
+ └── arcana.config.js # Arcana.js configuration
109
+ ```
110
+
111
+ ## Routing
112
+
113
+ Arcana.js provides a powerful and flexible routing system that integrates seamlessly with controllers. Routes are defined in dedicated router files and automatically linked to controller methods.
114
+
115
+ ### Basic Router Configuration
116
+
117
+ ```javascript
118
+ // src/routes/userRoutes.js
119
+ import { Router } from 'arcana/core';
120
+ import { UserController } from '../controllers/UserController';
121
+
122
+ const userController = new UserController();
123
+ const router = new Router();
124
+
125
+ // Define routes and link to controller methods
126
+ router.get('/users', userController.index);
127
+ router.get('/users/:id', userController.show);
128
+ router.post('/users', userController.create);
129
+ router.put('/users/:id', userController.update);
130
+ router.delete('/users/:id', userController.delete);
131
+
132
+ export default router;
133
+ ```
134
+
135
+ ### Route Groups and Middleware
136
+
137
+ ```javascript
138
+ // src/routes/apiRoutes.js
139
+ import { Router } from 'arcana/core';
140
+ import { authMiddleware } from '../middleware/auth';
141
+
142
+ const router = new Router();
143
+
144
+ // Apply middleware to a group of routes
145
+ router.group('/api', [authMiddleware], (r) => {
146
+ // These routes will all be prefixed with '/api' and use authMiddleware
147
+ r.use('/users', require('./userRoutes'));
148
+ r.use('/posts', require('./postRoutes'));
149
+ });
150
+
151
+ export default router;
152
+ ```
153
+
154
+ ### Registering Routes
155
+
156
+ ```javascript
157
+ // src/app.js
158
+ import { Application } from 'arcana/core';
159
+ import userRoutes from './routes/userRoutes';
160
+ import apiRoutes from './routes/apiRoutes';
161
+
162
+ const app = new Application();
163
+
164
+ // Register routes
165
+ app.useRoutes([
166
+ userRoutes,
167
+ apiRoutes
168
+ ]);
169
+
170
+ app.listen(3000);
171
+ ```
172
+
173
+ ### Route Parameters and Validation
174
+
175
+ ```javascript
176
+ // Advanced routing with parameter validation
177
+ router.get('/products/:category/:id', productController.show)
178
+ .where('category', /^[a-z-]+$/)
179
+ .where('id', /^\d+$/);
180
+ ```
181
+
182
+ ### Named Routes
183
+
184
+ ```javascript
185
+ // Define a named route for easy URL generation
186
+ router.get('/dashboard', dashboardController.index, 'dashboard.index');
187
+
188
+ // Generate URL in your code or templates
189
+ const dashboardUrl = router.namedRoute('dashboard.index');
190
+ ```
191
+
192
+ ## Documentation
193
+
194
+ For detailed documentation, visit [docs.arcanajs.com](https://docs.arcanajs.com)
195
+
196
+ ### Core Concepts
197
+
198
+ - **Models**: Define your data structure using Mongoose schemas
199
+ - **Views**: Create React components for rendering
200
+ - **Controllers**: Handle HTTP requests and control flow
201
+ - **Repositories**: Abstract data access operations
202
+ - **Services**: Implement business logic
203
+ - **Middlewares**: Process requests before they reach controllers
204
+ - **Routers**: Define application routes and connect them to controllers
205
+
206
+ ## Examples
207
+
208
+ ### Creating a Model
209
+
210
+ ```javascript
211
+ // src/models/User.js
212
+ import { Model, Schema } from 'arcana/db';
213
+
214
+ const userSchema = new Schema({
215
+ username: { type: String, required: true, unique: true },
216
+ email: { type: String, required: true, unique: true },
217
+ password: { type: String, required: true },
218
+ createdAt: { type: Date, default: Date.now },
219
+ updatedAt: { type: Date, default: Date.now }
220
+ });
221
+
222
+ export const User = Model('User', userSchema);
223
+ ```
224
+
225
+ ### Creating a Repository
226
+
227
+ ```javascript
228
+ // src/repositories/UserRepository.js
229
+ import { Repository } from 'arcana/core';
230
+ import { User } from '../models/User';
231
+
232
+ export class UserRepository extends Repository {
233
+ constructor() {
234
+ super(User);
235
+ }
236
+
237
+ async findByUsername(username) {
238
+ return this.model.findOne({ username });
239
+ }
240
+ }
241
+ ```
242
+
243
+ ### Creating a View Component
244
+
245
+ ```jsx
246
+ // src/views/pages/users/Index.jsx
247
+ import React from 'react';
248
+ import { Page } from 'arcana/view';
249
+
250
+ export default function UsersIndex({ users }) {
251
+ return (
252
+ <Page title="All Users">
253
+ <h1>Users</h1>
254
+ <ul>
255
+ {users.map(user => (
256
+ <li key={user._id}>
257
+ <a href={`/users/${user._id}`}>{user.username}</a>
258
+ </li>
259
+ ))}
260
+ </ul>
261
+ </Page>
262
+ );
263
+ }
264
+ ```
265
+
266
+ ## Contributing
267
+
268
+ Contributions are welcome! Please feel free to submit a Pull Request.
269
+
270
+ 1. Fork the repository
271
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
272
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
273
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
274
+ 5. Open a Pull Request
275
+
276
+ ## License
277
+
278
+ This project is licensed under the MIT License - see the LICENSE file for details.
279
+
280
+ ---
281
+
282
+ <p align="center">
283
+ Made with ❤️ by the Arcana.js Team
284
+ </p>
package/bin/arcana.ts ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Minimal CLI stub for arcana
4
+ const [, , ...args] = process.argv;
5
+
6
+ if (!args.length || args.includes("--help") || args.includes("-h")) {
7
+ console.log(
8
+ "Arcana CLI\n\nUsage: arcana <command> [options]\n\nCommands:\n create <app-name> Create a new Arcana app (stub)\n help Show help"
9
+ );
10
+ process.exit(0);
11
+ }
12
+
13
+ const [cmd, name] = args;
14
+ if (cmd === "create") {
15
+ console.log(`Creating new Arcana app: ${name} (stub).`);
16
+ console.log("This is a starter CLI. Implement scaffolding logic here.");
17
+ } else {
18
+ console.log("Unknown command. Use --help for usage.");
19
+ }
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ declare const args: string[];
3
+ declare const cmd: string, name: string;
4
+ //# sourceMappingURL=arcana.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arcana.d.ts","sourceRoot":"","sources":["../../bin/arcana.ts"],"names":[],"mappings":";AAGA,QAAA,MAAc,IAAI,UAAgB,CAAC;AASnC,QAAA,MAAO,GAAG,UAAE,IAAI,QAAQ,CAAC"}
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ // Minimal CLI stub for arcana
4
+ const [, , ...args] = process.argv;
5
+ if (!args.length || args.includes("--help") || args.includes("-h")) {
6
+ console.log("Arcana CLI\n\nUsage: arcana <command> [options]\n\nCommands:\n create <app-name> Create a new Arcana app (stub)\n help Show help");
7
+ process.exit(0);
8
+ }
9
+ const [cmd, name] = args;
10
+ if (cmd === "create") {
11
+ console.log(`Creating new Arcana app: ${name} (stub).`);
12
+ console.log("This is a starter CLI. Implement scaffolding logic here.");
13
+ }
14
+ else {
15
+ console.log("Unknown command. Use --help for usage.");
16
+ }
17
+ //# sourceMappingURL=arcana.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arcana.js","sourceRoot":"","sources":["../../bin/arcana.ts"],"names":[],"mappings":";;AAEA,8BAA8B;AAC9B,MAAM,CAAC,EAAE,AAAD,EAAG,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;AAEnC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;IACnE,OAAO,CAAC,GAAG,CACT,qJAAqJ,CACtJ,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC;AACzB,IAAI,GAAG,KAAK,QAAQ,EAAE,CAAC;IACrB,OAAO,CAAC,GAAG,CAAC,4BAA4B,IAAI,UAAU,CAAC,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;AAC1E,CAAC;KAAM,CAAC;IACN,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;AACxD,CAAC"}
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ app: {
3
+ name: string;
4
+ };
5
+ };
6
+ export default _default;
7
+ //# sourceMappingURL=default.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../config/default.ts"],"names":[],"mappings":";;;;;AAAA,wBAIE"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ app: {
5
+ name: "Arcana App",
6
+ },
7
+ };
8
+ //# sourceMappingURL=default.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default.js","sourceRoot":"","sources":["../../config/default.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,GAAG,EAAE;QACH,IAAI,EAAE,YAAY;KACnB;CACF,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Request, Response } from "express";
2
+ declare class HomeController {
3
+ index(req: Request, res: Response): Promise<Response>;
4
+ }
5
+ export default HomeController;
6
+ //# sourceMappingURL=HomeController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HomeController.d.ts","sourceRoot":"","sources":["../../../src/controllers/HomeController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE5C,cAAM,cAAc;IACZ,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;CAG5D;AAED,eAAe,cAAc,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class HomeController {
4
+ async index(req, res) {
5
+ return res.send("<h1>Arcana.js</h1><p>Welcome — HomeController#index</p>");
6
+ }
7
+ }
8
+ exports.default = HomeController;
9
+ //# sourceMappingURL=HomeController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HomeController.js","sourceRoot":"","sources":["../../../src/controllers/HomeController.ts"],"names":[],"mappings":";;AAGA,MAAM,cAAc;IAClB,KAAK,CAAC,KAAK,CAAC,GAAY,EAAE,GAAa;QACrC,OAAO,GAAG,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;CACF;AAED,kBAAe,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { NextFunction, Request, Response } from "express";
2
+ export default function authMiddleware(req: Request, res: Response, next: NextFunction): void;
3
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/middleware/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE1D,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,YAAY,GACjB,IAAI,CAIN"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = authMiddleware;
4
+ function authMiddleware(req, res, next) {
5
+ // Implement real auth logic here
6
+ // For now allow all
7
+ next();
8
+ }
9
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/middleware/auth.ts"],"names":[],"mappings":";;AAGA,iCAQC;AARD,SAAwB,cAAc,CACpC,GAAY,EACZ,GAAa,EACb,IAAkB;IAElB,iCAAiC;IACjC,oBAAoB;IACpB,IAAI,EAAE,CAAC;AACT,CAAC"}
@@ -0,0 +1,11 @@
1
+ import mongoose, { Document } from "mongoose";
2
+ export interface IUser extends Document {
3
+ username: string;
4
+ email: string;
5
+ password: string;
6
+ createdAt?: Date;
7
+ updatedAt?: Date;
8
+ }
9
+ declare const _default: mongoose.Model<any, {}, {}, {}, any, any>;
10
+ export default _default;
11
+ //# sourceMappingURL=User.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../../../src/models/User.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,EAAE,EAAE,QAAQ,EAAU,MAAM,UAAU,CAAC;AAEtD,MAAM,WAAW,KAAM,SAAQ,QAAQ;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB;;AAWD,wBAC4C"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ // Example Mongoose model (requires mongoose installed)
37
+ const mongoose_1 = __importStar(require("mongoose"));
38
+ const userSchema = new mongoose_1.Schema({
39
+ username: { type: String, required: true, unique: true },
40
+ email: { type: String, required: true, unique: true },
41
+ password: { type: String, required: true },
42
+ }, { timestamps: true });
43
+ exports.default = mongoose_1.default.models.User ||
44
+ mongoose_1.default.model("User", userSchema);
45
+ //# sourceMappingURL=User.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"User.js","sourceRoot":"","sources":["../../../src/models/User.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAuD;AACvD,qDAAsD;AAUtD,MAAM,UAAU,GAAG,IAAI,iBAAM,CAC3B;IACE,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;IACxD,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;IACrD,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;CAC3C,EACD,EAAE,UAAU,EAAE,IAAI,EAAE,CACrB,CAAC;AAEF,kBAAe,kBAAQ,CAAC,MAAM,CAAC,IAAI;IACjC,kBAAQ,CAAC,KAAK,CAAQ,MAAM,EAAE,UAAU,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { IUser } from "../models/User";
2
+ declare class UserRepository {
3
+ private model;
4
+ constructor();
5
+ findAll(): Promise<IUser[]>;
6
+ findById(id: string): Promise<IUser | null>;
7
+ }
8
+ export default UserRepository;
9
+ //# sourceMappingURL=UserRepository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/UserRepository.ts"],"names":[],"mappings":"AAEA,OAAa,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE7C,cAAM,cAAc;IAClB,OAAO,CAAC,KAAK,CAAe;;IAM5B,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;IAI3B,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;CAG5C;AAED,eAAe,cAAc,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const User_1 = __importDefault(require("../models/User"));
7
+ class UserRepository {
8
+ constructor() {
9
+ this.model = User_1.default;
10
+ }
11
+ findAll() {
12
+ return this.model.find().lean();
13
+ }
14
+ findById(id) {
15
+ return this.model.findById(id).lean();
16
+ }
17
+ }
18
+ exports.default = UserRepository;
19
+ //# sourceMappingURL=UserRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserRepository.js","sourceRoot":"","sources":["../../../src/repositories/UserRepository.ts"],"names":[],"mappings":";;;;;AAEA,0DAA6C;AAE7C,MAAM,cAAc;IAGlB;QACE,IAAI,CAAC,KAAK,GAAG,cAAI,CAAC;IACpB,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,EAAsB,CAAC;IACtD,CAAC;IAED,QAAQ,CAAC,EAAU;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,EAA2B,CAAC;IACjE,CAAC;CACF;AAED,kBAAe,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Application } from "express";
2
+ export default function registerRoutes(app: Application): void;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAO7D"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = registerRoutes;
7
+ const HomeController_1 = __importDefault(require("../controllers/HomeController"));
8
+ function registerRoutes(app) {
9
+ // Example route wiring
10
+ const home = new HomeController_1.default();
11
+ app.get("/", home.index.bind(home));
12
+ // In future, require and register other routers here
13
+ }
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/routes/index.ts"],"names":[],"mappings":";;;;;AAIA,iCAOC;AATD,mFAA2D;AAE3D,SAAwB,cAAc,CAAC,GAAgB;IACrD,uBAAuB;IACvB,MAAM,IAAI,GAAG,IAAI,wBAAc,EAAE,CAAC;IAElC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAEpC,qDAAqD;AACvD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":""}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ // Minimal Express server starter for Arcana.js
7
+ const dotenv_1 = __importDefault(require("dotenv"));
8
+ const express_1 = __importDefault(require("express"));
9
+ const path_1 = __importDefault(require("path"));
10
+ dotenv_1.default.config();
11
+ const app = (0, express_1.default)();
12
+ const port = parseInt(process.env.PORT || "3000", 10);
13
+ // Serve static files
14
+ app.use("/public", express_1.default.static(path_1.default.join(__dirname, "../public")));
15
+ // Basic JSON middleware
16
+ app.use(express_1.default.json());
17
+ app.use(express_1.default.urlencoded({ extended: true }));
18
+ // Register routes
19
+ try {
20
+ const routes = require("./routes");
21
+ if (typeof routes === "function") {
22
+ routes(app);
23
+ }
24
+ }
25
+ catch (err) {
26
+ console.warn("No routes registered yet.");
27
+ }
28
+ app.get("/", (req, res) => {
29
+ res.send("Welcome to Arcana.js — scaffold running.");
30
+ });
31
+ app.listen(port, () => {
32
+ console.log(`Arcana.js server listening on http://localhost:${port}`);
33
+ });
34
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";;;;;AAAA,+CAA+C;AAC/C,oDAA4B;AAC5B,sDAA+C;AAC/C,gDAAwB;AAExB,gBAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,GAAG,GAAgB,IAAA,iBAAO,GAAE,CAAC;AACnC,MAAM,IAAI,GAAW,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,MAAM,EAAE,EAAE,CAAC,CAAC;AAE9D,qBAAqB;AACrB,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,iBAAO,CAAC,MAAM,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;AAEtE,wBAAwB;AACxB,GAAG,CAAC,GAAG,CAAC,iBAAO,CAAC,IAAI,EAAE,CAAC,CAAC;AACxB,GAAG,CAAC,GAAG,CAAC,iBAAO,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAEhD,kBAAkB;AAClB,IAAI,CAAC;IACH,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACnC,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;QACjC,MAAM,CAAC,GAAG,CAAC,CAAC;IACd,CAAC;AACH,CAAC;AAAC,OAAO,GAAG,EAAE,CAAC;IACb,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;AAC5C,CAAC;AAED,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACxB,GAAG,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC;AAEH,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;IACpB,OAAO,CAAC,GAAG,CAAC,kDAAkD,IAAI,EAAE,CAAC,CAAC;AACxE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { IUser } from "../models/User";
2
+ declare class UserService {
3
+ private repo;
4
+ constructor();
5
+ listUsers(): Promise<IUser[]>;
6
+ }
7
+ export default UserService;
8
+ //# sourceMappingURL=UserService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserService.d.ts","sourceRoot":"","sources":["../../../src/services/UserService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,cAAM,WAAW;IACf,OAAO,CAAC,IAAI,CAAiB;;IAMvB,SAAS,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;CAGpC;AAED,eAAe,WAAW,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const UserRepository_1 = __importDefault(require("../repositories/UserRepository"));
7
+ class UserService {
8
+ constructor() {
9
+ this.repo = new UserRepository_1.default();
10
+ }
11
+ async listUsers() {
12
+ return this.repo.findAll();
13
+ }
14
+ }
15
+ exports.default = UserService;
16
+ //# sourceMappingURL=UserService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserService.js","sourceRoot":"","sources":["../../../src/services/UserService.ts"],"names":[],"mappings":";;;;;AAEA,oFAA4D;AAE5D,MAAM,WAAW;IAGf;QACE,IAAI,CAAC,IAAI,GAAG,IAAI,wBAAc,EAAE,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,SAAS;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;CACF;AAED,kBAAe,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export default function HomePage(): JSX.Element;
2
+ //# sourceMappingURL=home.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../../../src/views/pages/home.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,QAAQ,IAAI,GAAG,CAAC,OAAO,CAO9C"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = HomePage;
7
+ const react_1 = __importDefault(require("react"));
8
+ function HomePage() {
9
+ return (react_1.default.createElement("div", null,
10
+ react_1.default.createElement("h1", null, "Arcana.js \u2014 Home"),
11
+ react_1.default.createElement("p", null, "This is a starter React page for server-side rendering.")));
12
+ }
13
+ //# sourceMappingURL=home.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"home.js","sourceRoot":"","sources":["../../../../src/views/pages/home.tsx"],"names":[],"mappings":";;;;;AAEA,2BAOC;AATD,kDAA0B;AAE1B,SAAwB,QAAQ;IAC9B,OAAO,CACL;QACE,kEAAyB;QACzB,mGAA8D,CAC1D,CACP,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "arcanajs",
3
+ "author": {
4
+ "name": "Mohammed Ben Cheikh",
5
+ "email": "mohammed.bencheikh.dev@gmail.com",
6
+ "url": "https://mohammedbencheikh.com/"
7
+ },
8
+ "version": "0.2.2",
9
+ "description": "A powerful full-stack framework combining Express, React and MongoDB with server-side rendering",
10
+ "main": "dist/server.js",
11
+ "types": "dist/server.d.ts",
12
+ "files": [
13
+ "dist",
14
+ "bin"
15
+ ],
16
+ "scripts": {
17
+ "clean": "rm -rf dist",
18
+ "build": "tsc -p tsconfig.json",
19
+ "build:watch": "tsc -p tsconfig.json --watch",
20
+ "prepare": "npm run build",
21
+ "typecheck": "tsc -p tsconfig.json --noEmit",
22
+ "pack:verify": "npm pack --dry-run",
23
+ "dev": "nodemon --watch src --exec ts-node src/server.ts",
24
+ "start": "node dist/server.js",
25
+ "lint": "eslint . || true",
26
+ "test": "jest --runInBand"
27
+ },
28
+ "peerDependencies": {
29
+ "react": ">=16 <20",
30
+ "react-dom": ">=16 <20"
31
+ },
32
+ "dependencies": {
33
+ "dotenv": "^16.0.0",
34
+ "express": "^4.18.2",
35
+ "mongoose": "^7.0.0",
36
+ "react": "^18.2.0",
37
+ "react-dom": "^18.2.0",
38
+ "url-join": "^5.0.0"
39
+ },
40
+ "devDependencies": {
41
+ "@types/dotenv": "^6.1.1",
42
+ "@types/express": "^5.0.5",
43
+ "@types/mongoose": "^5.11.96",
44
+ "@types/node": "^20.0.0",
45
+ "@types/react": "^18.2.0",
46
+ "@types/react-dom": "^18.2.0",
47
+ "@types/url-join": "^4.0.3",
48
+ "eslint": "^8.0.0",
49
+ "jest": "^29.0.0",
50
+ "nodemon": "^3.0.1",
51
+ "ts-node": "^10.9.2",
52
+ "typescript": "^5.2.0"
53
+ },
54
+ "keywords": [
55
+ "framework",
56
+ "full-stack",
57
+ "express",
58
+ "react",
59
+ "mongodb",
60
+ "ssr",
61
+ "mvc",
62
+ "arcana",
63
+ "routing",
64
+ "server-side-rendering"
65
+ ],
66
+ "repository": {
67
+ "type": "git",
68
+ "url": "https://github.com/Mohammed-Ben-Cheikh/arcanajs.git"
69
+ },
70
+ "bugs": {
71
+ "url": "https://github.com/Mohammed-Ben-Cheikh/arcanajs/issues"
72
+ },
73
+ "homepage": "https://github.com/Mohammed-Ben-Cheikh/arcanajs#readme",
74
+ "bin": {
75
+ "arcana": "dist/bin/arcana.js"
76
+ },
77
+ "engines": {
78
+ "node": ">=16"
79
+ },
80
+ "license": "MIT"
81
+ }