create-yiougo 1.0.0

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 (46) hide show
  1. package/README.md +120 -0
  2. package/index.js +76 -0
  3. package/package.json +45 -0
  4. package/template/.env.example +7 -0
  5. package/template/README.md +122 -0
  6. package/template/index.html +13 -0
  7. package/template/package-lock.json +3543 -0
  8. package/template/package.json +38 -0
  9. package/template/public/vite.svg +1 -0
  10. package/template/server/config/database.ts +31 -0
  11. package/template/server/config/redis.ts +23 -0
  12. package/template/server/index.ts +28 -0
  13. package/template/server/models/user.model.ts +10 -0
  14. package/template/server/routes/user.routes.ts +45 -0
  15. package/template/server/services/user.service.ts +100 -0
  16. package/template/shared/types/index.ts +14 -0
  17. package/template/src/App.vue +16 -0
  18. package/template/src/api/user.api.ts +53 -0
  19. package/template/src/components/BaseButton.vue +49 -0
  20. package/template/src/components/BaseCard.vue +41 -0
  21. package/template/src/components/index.ts +3 -0
  22. package/template/src/composables/index.ts +3 -0
  23. package/template/src/composables/useLoading.ts +36 -0
  24. package/template/src/composables/useNotification.ts +52 -0
  25. package/template/src/env.d.ts +13 -0
  26. package/template/src/hooks/index.ts +2 -0
  27. package/template/src/hooks/useApi.ts +60 -0
  28. package/template/src/layouts/default.vue +29 -0
  29. package/template/src/main.ts +20 -0
  30. package/template/src/pages/about.vue +111 -0
  31. package/template/src/pages/index.vue +38 -0
  32. package/template/src/pages/users.vue +126 -0
  33. package/template/src/router/index.ts +12 -0
  34. package/template/src/stores/user.store.ts +64 -0
  35. package/template/src/styles/main.scss +15 -0
  36. package/template/src/styles/quasar-variables.sass +8 -0
  37. package/template/src/types/global.d.ts +28 -0
  38. package/template/src/utils/date.ts +49 -0
  39. package/template/src/utils/index.ts +3 -0
  40. package/template/src/utils/storage.ts +56 -0
  41. package/template/src/vite-env.d.ts +7 -0
  42. package/template/tsconfig.app.json +32 -0
  43. package/template/tsconfig.json +7 -0
  44. package/template/tsconfig.node.json +23 -0
  45. package/template/tsconfig.server.json +29 -0
  46. package/template/vite.config.ts +42 -0
package/README.md ADDED
@@ -0,0 +1,120 @@
1
+ # create-yiougo
2
+
3
+ A Bun create script for generating full-stack applications with Elysia backend and Vue 3 frontend in a monorepo structure.
4
+
5
+ ## Usage
6
+
7
+ Create a new project using Bun:
8
+
9
+ ```bash
10
+ bun create yiougo my-app
11
+ ```
12
+
13
+ Or if you're developing locally:
14
+
15
+ ```bash
16
+ bun run index.js my-app
17
+ ```
18
+
19
+ ## What's Included
20
+
21
+ ### Frontend (Vite + Vue 3)
22
+ - **Vite** - Next generation frontend tooling
23
+ - **Vue 3** - Progressive JavaScript framework with Composition API
24
+ - **Quasar** - Material Design component framework
25
+ - **Vue Router** - Official routing solution
26
+ - **Pinia** - State management
27
+ - **Sass** - CSS preprocessor with embedded compiler
28
+ - **TypeScript** - Type safety
29
+
30
+ ### Backend (Elysia in server/)
31
+ - **Elysia** - Fast and ergonomic web framework for Bun
32
+ - **MongoDB** - NoSQL database with Mongoose ODM
33
+ - **Redis** - In-memory caching
34
+ - **Swagger** - API documentation
35
+ - **CORS** - Cross-origin resource sharing
36
+
37
+ ### Shared Code
38
+ - **TypeScript Types** - Shared types between frontend and backend
39
+ - **Utilities** - Common utilities and helpers
40
+
41
+ ## Project Structure
42
+
43
+ ```
44
+ my-app/
45
+ ├── src/ # Frontend source code
46
+ │ ├── api/ # API client
47
+ │ ├── pages/ # Vue pages
48
+ │ ├── router/ # Vue Router
49
+ │ ├── stores/ # Pinia stores
50
+ │ └── styles/ # Global styles
51
+ ├── server/ # Backend source code
52
+ │ ├── config/ # Database and Redis config
53
+ │ ├── models/ # Mongoose models
54
+ │ ├── routes/ # API routes
55
+ │ └── services/ # Business logic
56
+ ├── shared/ # Shared code
57
+ │ └── types/ # TypeScript types
58
+ ├── public/ # Static assets
59
+ ├── vite.config.ts # Vite configuration
60
+ ├── tsconfig.json # Frontend TypeScript config
61
+ ├── tsconfig.server.json # Backend TypeScript config
62
+ └── package.json # Single package.json
63
+ ```
64
+
65
+ ## Features
66
+
67
+ - 🚀 **Fast** - Built with Bun and Vite for lightning-fast development
68
+ - 🎨 **Modern UI** - Quasar components with Material Design
69
+ - 📦 **Monorepo** - Single repository with unified dependencies
70
+ - 🔒 **Type-Safe** - TypeScript throughout with shared types
71
+ - 🗄️ **Database Ready** - MongoDB with Redis caching
72
+ - 📝 **API Docs** - Automatic Swagger documentation
73
+ - 🎯 **Best Practices** - Clean architecture and separation of concerns
74
+
75
+ ## Requirements
76
+
77
+ - Bun >= 1.0.0
78
+ - MongoDB (local or remote)
79
+ - Redis (local or remote)
80
+
81
+ ## Development
82
+
83
+ After creating your project:
84
+
85
+ 1. Install dependencies:
86
+ ```bash
87
+ cd my-app
88
+ bun install
89
+ ```
90
+
91
+ 2. Configure environment variables:
92
+ ```bash
93
+ cp .env.example .env
94
+ ```
95
+ Update `.env` with your MongoDB and Redis connection strings
96
+
97
+ 3. Start development servers:
98
+ ```bash
99
+ # Frontend (default port 5173)
100
+ bun run dev
101
+
102
+ # Backend (in another terminal, default port 3000)
103
+ bun run dev:server
104
+ ```
105
+
106
+ ## Build
107
+
108
+ Build frontend for production:
109
+ ```bash
110
+ bun run build
111
+ ```
112
+
113
+ Preview production build:
114
+ ```bash
115
+ bun run preview
116
+ ```
117
+
118
+ ## License
119
+
120
+ MIT
package/index.js ADDED
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env bun
2
+ import { existsSync, mkdirSync, readdirSync, statSync, copyFileSync, readFileSync, writeFileSync } from 'fs';
3
+ import { join, dirname } from 'path';
4
+ import { fileURLToPath } from 'url';
5
+ import prompts from 'prompts';
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = dirname(__filename);
9
+
10
+ async function main() {
11
+ console.log('🚀 Creating Yiougo Full-Stack Project...\n');
12
+
13
+ const args = process.argv.slice(2);
14
+ let projectName = args[0];
15
+
16
+ if (!projectName) {
17
+ const response = await prompts({
18
+ type: 'text',
19
+ name: 'projectName',
20
+ message: 'Project name:',
21
+ initial: 'my-yiougo-app'
22
+ });
23
+ projectName = response.projectName;
24
+ }
25
+
26
+ if (!projectName) {
27
+ console.error('❌ Project name is required');
28
+ process.exit(1);
29
+ }
30
+
31
+ const projectPath = join(process.cwd(), projectName);
32
+
33
+ if (existsSync(projectPath)) {
34
+ console.error(`❌ Directory ${projectName} already exists`);
35
+ process.exit(1);
36
+ }
37
+
38
+ console.log(`📁 Creating project at ${projectPath}\n`);
39
+ mkdirSync(projectPath, { recursive: true });
40
+
41
+ const templatePath = join(__dirname, 'template');
42
+ copyDir(templatePath, projectPath);
43
+
44
+ const packageJsonPath = join(projectPath, 'package.json');
45
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
46
+ packageJson.name = projectName;
47
+ writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
48
+
49
+ console.log('\n✅ Project created successfully!\n');
50
+ console.log('📝 Next steps:\n');
51
+ console.log(` cd ${projectName}`);
52
+ console.log(' bun install');
53
+ console.log(' cp .env.example .env');
54
+ console.log('\n🚀 Start development:\n');
55
+ console.log(' Frontend: bun run dev');
56
+ console.log(' Backend: bun run dev:server');
57
+ console.log('\n📖 Check README.md for more information\n');
58
+ }
59
+
60
+ function copyDir(src, dest) {
61
+ mkdirSync(dest, { recursive: true });
62
+ const entries = readdirSync(src);
63
+
64
+ for (const entry of entries) {
65
+ const srcPath = join(src, entry);
66
+ const destPath = join(dest, entry);
67
+
68
+ if (statSync(srcPath).isDirectory()) {
69
+ copyDir(srcPath, destPath);
70
+ } else {
71
+ copyFileSync(srcPath, destPath);
72
+ }
73
+ }
74
+ }
75
+
76
+ main().catch(console.error);
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "create-yiougo",
3
+ "version": "1.0.0",
4
+ "description": "A modern full-stack application template built with Elysia, Vue 3, Quasar, and Bun",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "bin": {
8
+ "create-yiougo": "./index.js"
9
+ },
10
+ "files": [
11
+ "index.js",
12
+ "template"
13
+ ],
14
+ "scripts": {
15
+ "test": "bun run index.js test-project"
16
+ },
17
+ "keywords": [
18
+ "bun",
19
+ "create",
20
+ "template",
21
+ "vue",
22
+ "elysia",
23
+ "quasar",
24
+ "typescript",
25
+ "full-stack",
26
+ "mongodb",
27
+ "redis"
28
+ ],
29
+ "author": "Yiougo",
30
+ "license": "MIT",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/your-username/create-yiougo.git"
34
+ },
35
+ "bugs": {
36
+ "url": "https://github.com/your-username/create-yiougo/issues"
37
+ },
38
+ "homepage": "https://github.com/your-username/create-yiougo#readme",
39
+ "engines": {
40
+ "node": ">=18.0.0"
41
+ },
42
+ "dependencies": {
43
+ "prompts": "^2.4.2"
44
+ }
45
+ }
@@ -0,0 +1,7 @@
1
+ VITE_API_URL=http://localhost:3000
2
+
3
+ # Server
4
+ PORT=3000
5
+ MONGODB_URI=mongodb://localhost:27017/yiougo
6
+ REDIS_URL=redis://localhost:6379
7
+ NODE_ENV=development
@@ -0,0 +1,122 @@
1
+ # Yiougo Full-Stack Application
2
+
3
+ A modern full-stack application with Elysia backend and Vue 3 frontend in a monorepo structure.
4
+
5
+ ## Tech Stack
6
+
7
+ ### Frontend
8
+ - **Vite** - Next generation frontend tooling
9
+ - **Vue 3** - Progressive JavaScript framework
10
+ - **Quasar** - Vue component framework
11
+ - **Vue Router** - Official router for Vue.js
12
+ - **Pinia** - Vue store
13
+ - **Sass** - CSS preprocessor
14
+
15
+ ### Backend (Server)
16
+ - **Elysia** - Fast and ergonomic web framework for Bun
17
+ - **MongoDB** - NoSQL database
18
+ - **Redis** - In-memory data store for caching
19
+
20
+ ## Project Structure
21
+
22
+ ```
23
+ .
24
+ ├── src/ # Frontend source code
25
+ │ ├── api/ # API client
26
+ │ ├── pages/ # Vue pages
27
+ │ ├── router/ # Vue Router
28
+ │ ├── stores/ # Pinia stores
29
+ │ └── styles/ # Global styles
30
+ ├── server/ # Backend source code
31
+ │ ├── config/ # Database and Redis config
32
+ │ ├── models/ # Mongoose models
33
+ │ ├── routes/ # API routes
34
+ │ └── services/ # Business logic
35
+ ├── shared/ # Shared types and utilities
36
+ │ └── types/ # TypeScript types
37
+ ├── public/ # Static assets
38
+ ├── vite.config.ts # Vite configuration
39
+ ├── tsconfig.json # Frontend TypeScript config
40
+ └── tsconfig.server.json # Backend TypeScript config
41
+ ```
42
+
43
+ ## Getting Started
44
+
45
+ ### Prerequisites
46
+ - Bun >= 1.0.0
47
+ - MongoDB running locally or connection string
48
+ - Redis running locally or connection string
49
+
50
+ ### Installation
51
+
52
+ ```bash
53
+ bun install
54
+ ```
55
+
56
+ ### Configuration
57
+
58
+ Copy `.env.example` to `.env` and configure:
59
+
60
+ ```env
61
+ VITE_API_URL=http://localhost:3000
62
+
63
+ # Server
64
+ PORT=3000
65
+ MONGODB_URI=mongodb://localhost:27017/yiougo
66
+ REDIS_URL=redis://localhost:6379
67
+ NODE_ENV=development
68
+ ```
69
+
70
+ ### Development
71
+
72
+ Start frontend development server:
73
+ ```bash
74
+ bun run dev
75
+ ```
76
+
77
+ Start backend server (in another terminal):
78
+ ```bash
79
+ bun run dev:server
80
+ ```
81
+
82
+ - Frontend: http://localhost:5173
83
+ - Backend: http://localhost:3000
84
+ - API Docs: http://localhost:3000/swagger
85
+
86
+ ### Build
87
+
88
+ Build frontend for production:
89
+ ```bash
90
+ bun run build
91
+ ```
92
+
93
+ Preview production build:
94
+ ```bash
95
+ bun run preview
96
+ ```
97
+
98
+ ## API Documentation
99
+
100
+ The backend API is available at `http://localhost:3000/api`
101
+
102
+ Example endpoints:
103
+ - `GET /api/health` - Health check
104
+ - `GET /api/users` - Get all users
105
+ - `POST /api/users` - Create a user
106
+ - `GET /api/users/:id` - Get user by ID
107
+ - `PUT /api/users/:id` - Update user
108
+ - `DELETE /api/users/:id` - Delete user
109
+
110
+ ## Features
111
+
112
+ - 🚀 **Fast** - Built with Bun and Vite for lightning-fast development
113
+ - 🎨 **Modern UI** - Quasar components with Material Design
114
+ - 📦 **Monorepo** - Single repository for frontend and backend
115
+ - 🔒 **Type-Safe** - TypeScript throughout with shared types
116
+ - 🗄️ **Database Ready** - MongoDB with Redis caching
117
+ - 📝 **API Docs** - Automatic Swagger documentation
118
+ - 🎯 **Best Practices** - Clean architecture and separation of concerns
119
+
120
+ ## License
121
+
122
+ MIT
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Yiougo App</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/src/main.ts"></script>
12
+ </body>
13
+ </html>