@strav/spring 0.4.30 → 1.0.0-alpha.28
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/README.md +11 -52
- package/package.json +19 -20
- package/src/args.ts +119 -0
- package/src/cli.ts +134 -0
- package/src/index.ts +10 -176
- package/src/prompts.ts +49 -127
- package/src/scaffold.ts +115 -36
- package/src/spring_error.ts +11 -0
- package/src/templates/shared/README.md.tt +37 -0
- package/src/templates/shared/_dot_env.example.tt +12 -0
- package/src/templates/shared/_dot_env.tt +12 -0
- package/src/templates/shared/_dot_gitignore +12 -0
- package/src/templates/shared/app/console/_dot_gitkeep +0 -0
- package/src/templates/shared/app/exceptions/_dot_gitkeep +0 -0
- package/src/templates/shared/app/http/controllers/_dot_gitkeep +0 -0
- package/src/templates/shared/app/http/middleware/_dot_gitkeep +0 -0
- package/src/templates/shared/app/http/requests/_dot_gitkeep +0 -0
- package/src/templates/shared/app/jobs/_dot_gitkeep +0 -0
- package/src/templates/shared/app/mail/_dot_gitkeep +0 -0
- package/src/templates/shared/app/models/_dot_gitkeep +0 -0
- package/src/templates/shared/app/notifications/_dot_gitkeep +0 -0
- package/src/templates/shared/app/policies/_dot_gitkeep +0 -0
- package/src/templates/shared/app/providers/app_provider.ts +18 -0
- package/src/templates/shared/app/repositories/_dot_gitkeep +0 -0
- package/src/templates/shared/bin/strav.ts +21 -0
- package/src/templates/shared/bootstrap/app.ts +13 -0
- package/src/templates/shared/bootstrap/providers.ts +29 -0
- package/src/templates/shared/config/app.ts.tt +13 -0
- package/src/templates/shared/config/http.ts +9 -0
- package/src/templates/shared/config/logger.ts +9 -0
- package/src/templates/shared/database/factories/_dot_gitkeep +0 -0
- package/src/templates/shared/database/migrations/_dot_gitkeep +0 -0
- package/src/templates/shared/database/schemas/_dot_gitkeep +0 -0
- package/src/templates/shared/database/seeders/_dot_gitkeep +0 -0
- package/src/templates/shared/package.json.tt +22 -0
- package/src/templates/shared/routes/api.ts +11 -0
- package/src/templates/shared/routes/console.ts +10 -0
- package/src/templates/shared/storage/cache/_dot_gitkeep +0 -0
- package/src/templates/shared/storage/logs/_dot_gitkeep +0 -0
- package/src/templates/shared/storage/uploads/_dot_gitkeep +0 -0
- package/src/templates/shared/tests/feature/healthz.test.ts.tt +19 -0
- package/src/templates/shared/tests/unit/_dot_gitkeep +0 -0
- package/src/templates/shared/tsconfig.json +21 -11
- package/src/templates/web/README.md.tt +42 -0
- package/src/templates/web/_dot_gitignore +13 -0
- package/src/templates/web/app/providers/app_provider.ts +21 -0
- package/src/templates/web/bootstrap/providers.ts +34 -0
- package/src/templates/web/config/http.ts +17 -8
- package/src/templates/web/config/view.ts +7 -7
- package/src/templates/web/package.json.tt +26 -0
- package/src/templates/web/public/assets/_dot_gitkeep +0 -0
- package/src/templates/web/resources/css/app.css +41 -0
- package/src/templates/web/resources/ts/islands/counter.vue +11 -0
- package/src/templates/web/resources/ts/islands/setup.ts +13 -0
- package/src/templates/web/resources/views/components/_dot_gitkeep +0 -0
- package/src/templates/web/resources/views/errors/404.strav +8 -0
- package/src/templates/web/resources/views/errors/500.strav +8 -0
- package/src/templates/web/resources/views/layouts/app.strav.tt +15 -0
- package/src/templates/web/resources/views/pages/index.strav.tt +12 -0
- package/src/templates/web/routes/broadcast.ts +9 -0
- package/src/templates/web/routes/web.ts +19 -0
- package/src/templates/web/tests/browser/_dot_gitkeep +0 -0
- package/src/version.ts +9 -0
- package/src/templates/api/app/controllers/controller.ts +0 -15
- package/src/templates/api/app/controllers/user_controller.ts +0 -69
- package/src/templates/api/config/database.ts +0 -9
- package/src/templates/api/config/http.ts +0 -17
- package/src/templates/api/database/factories/user_factory.ts +0 -11
- package/src/templates/api/database/schemas/user.ts +0 -13
- package/src/templates/api/database/seeders/database_seeder.ts +0 -8
- package/src/templates/api/database/seeders/user_seeder.ts +0 -15
- package/src/templates/api/index.ts +0 -11
- package/src/templates/api/package.json +0 -24
- package/src/templates/api/start/providers.ts +0 -10
- package/src/templates/api/start/routes.ts +0 -22
- package/src/templates/shared/config/app.ts +0 -7
- package/src/templates/shared/config/encryption.ts +0 -5
- package/src/templates/shared/package.json +0 -24
- package/src/templates/shared/storage/uploads/.gitkeep +0 -1
- package/src/templates/shared/strav.ts +0 -2
- package/src/templates/shared/tests/example.test.ts +0 -11
- package/src/templates/web/index.ts +0 -28
- package/src/templates/web/package.json +0 -26
- package/src/templates/web/public/builds/.gitkeep +0 -1
- package/src/templates/web/public/css/.gitkeep +0 -1
- package/src/templates/web/resources/css/app.scss +0 -77
- package/src/templates/web/resources/islands/counter.vue +0 -31
- package/src/templates/web/resources/views/layouts/app.strav +0 -18
- package/src/templates/web/resources/views/pages/index.strav +0 -32
- package/src/templates/web/start/providers.ts +0 -11
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { router } from '@strav/http'
|
|
2
|
-
import UserController from '../app/controllers/user_controller'
|
|
3
|
-
|
|
4
|
-
// Health check endpoint
|
|
5
|
-
router.get('/health', async (ctx) => {
|
|
6
|
-
return ctx.json({
|
|
7
|
-
status: 'ok',
|
|
8
|
-
timestamp: new Date().toISOString(),
|
|
9
|
-
app: '__PROJECT_NAME__',
|
|
10
|
-
version: '0.1.0'
|
|
11
|
-
})
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
// API routes
|
|
15
|
-
router.group('/api/v1', () => {
|
|
16
|
-
// User resource routes
|
|
17
|
-
router.get('/users', [UserController, 'index'])
|
|
18
|
-
router.get('/users/:id', [UserController, 'show'])
|
|
19
|
-
router.post('/users', [UserController, 'store'])
|
|
20
|
-
router.put('/users/:id', [UserController, 'update'])
|
|
21
|
-
router.delete('/users/:id', [UserController, 'destroy'])
|
|
22
|
-
})
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "__PROJECT_NAME__",
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"type": "module",
|
|
5
|
-
"private": true,
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "bun --hot index.ts",
|
|
8
|
-
"start": "bun index.ts",
|
|
9
|
-
"test": "bun test tests/",
|
|
10
|
-
"typecheck": "tsc --noEmit"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@strav/kernel": "__STRAV_VERSION__",
|
|
14
|
-
"@strav/http": "__STRAV_VERSION__",
|
|
15
|
-
"@strav/database": "__STRAV_VERSION__",
|
|
16
|
-
"@strav/cli": "__STRAV_VERSION__",
|
|
17
|
-
"reflect-metadata": "^0.2.2"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@types/bun": "latest",
|
|
21
|
-
"@strav/testing": "__STRAV_VERSION__",
|
|
22
|
-
"typescript": "^5.9.3"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# This file keeps the uploads directory in git
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { test, expect } from 'bun:test'
|
|
2
|
-
|
|
3
|
-
test('example test', () => {
|
|
4
|
-
expect(1 + 1).toBe(2)
|
|
5
|
-
})
|
|
6
|
-
|
|
7
|
-
test('health endpoint returns ok', async () => {
|
|
8
|
-
// TODO: Add integration tests for your routes
|
|
9
|
-
// Use @strav/testing for HTTP testing helpers
|
|
10
|
-
expect(true).toBe(true)
|
|
11
|
-
})
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata'
|
|
2
|
-
import { app } from '@strav/kernel'
|
|
3
|
-
import { IslandBuilder, ViewEngine } from '@strav/view'
|
|
4
|
-
import { providers } from './start/providers'
|
|
5
|
-
|
|
6
|
-
// Build islands + CSS before the server starts
|
|
7
|
-
// Outputs: public/css/app.css (from SCSS) and public/builds/islands.js (Vue components)
|
|
8
|
-
const builder = new IslandBuilder({
|
|
9
|
-
css: {
|
|
10
|
-
entry: 'resources/css/app.scss',
|
|
11
|
-
outDir: './public/css',
|
|
12
|
-
},
|
|
13
|
-
outDir: './public/builds',
|
|
14
|
-
})
|
|
15
|
-
await builder.build()
|
|
16
|
-
|
|
17
|
-
// Register service providers
|
|
18
|
-
app
|
|
19
|
-
.useProviders(providers)
|
|
20
|
-
.onBooted(async() => {
|
|
21
|
-
// Watch for island and template changes in dev
|
|
22
|
-
if (Bun.env.NODE_ENV !== 'production') {
|
|
23
|
-
builder.watch()
|
|
24
|
-
ViewEngine.instance.watch()
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
await app.start()
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "__PROJECT_NAME__",
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"type": "module",
|
|
5
|
-
"private": true,
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "bun --hot index.ts",
|
|
8
|
-
"start": "bun index.ts",
|
|
9
|
-
"test": "bun test tests/",
|
|
10
|
-
"typecheck": "tsc --noEmit"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@strav/kernel": "__STRAV_VERSION__",
|
|
14
|
-
"@strav/http": "__STRAV_VERSION__",
|
|
15
|
-
"@strav/view": "__STRAV_VERSION__",
|
|
16
|
-
"@strav/database": "__STRAV_VERSION__",
|
|
17
|
-
"@strav/cli": "__STRAV_VERSION__",
|
|
18
|
-
"vue": "^3.5.28",
|
|
19
|
-
"reflect-metadata": "^0.2.2"
|
|
20
|
-
},
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"@types/bun": "latest",
|
|
23
|
-
"@strav/testing": "__STRAV_VERSION__",
|
|
24
|
-
"typescript": "^5.9.3"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# This directory will contain compiled Vue islands and manifest files
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# This directory will contain compiled CSS files
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--bg: #f4f4f0;
|
|
3
|
-
--text: #1e293b;
|
|
4
|
-
--accent: #f97316;
|
|
5
|
-
--bg-feature: #e8e8e3;
|
|
6
|
-
--border-feature: #d8d8d0;
|
|
7
|
-
--border-link-hover: #abab9c;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
* {
|
|
11
|
-
margin: 0;
|
|
12
|
-
padding: 0;
|
|
13
|
-
box-sizing: border-box;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
body {
|
|
17
|
-
font-family: "Barlow Semi Condensed", sans-serif;
|
|
18
|
-
font-weight: 400;
|
|
19
|
-
font-style: normal;
|
|
20
|
-
font-size: 15px;
|
|
21
|
-
color: var(--text);
|
|
22
|
-
background-color: var(--bg);
|
|
23
|
-
line-height: 1.8;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
main {
|
|
27
|
-
width: 800px;
|
|
28
|
-
margin: 50px auto 0;
|
|
29
|
-
text-align: center;
|
|
30
|
-
h3 {
|
|
31
|
-
font-size: 50px;
|
|
32
|
-
font-weight: 400;
|
|
33
|
-
color: #374151;
|
|
34
|
-
margin-bottom: 30px;
|
|
35
|
-
em {
|
|
36
|
-
font-style: normal;
|
|
37
|
-
color: var(--accent);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
.features {
|
|
41
|
-
display: grid;
|
|
42
|
-
grid-template-columns: repeat(2, 1fr);
|
|
43
|
-
grid-template-rows: repeat(2, 1fr);
|
|
44
|
-
grid-column-gap: 20px;
|
|
45
|
-
grid-row-gap: 20px;
|
|
46
|
-
margin-top: 50px;
|
|
47
|
-
.feature {
|
|
48
|
-
padding: 20px;
|
|
49
|
-
background-color: var(--bg-feature);
|
|
50
|
-
border: 1px solid var(--border-feature);
|
|
51
|
-
border-radius: 10px;
|
|
52
|
-
text-align: left;
|
|
53
|
-
h4 {
|
|
54
|
-
text-align: left;
|
|
55
|
-
color: var(--accent);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
.links {
|
|
60
|
-
display: flex;
|
|
61
|
-
justify-content: center;
|
|
62
|
-
margin-top: 50px;
|
|
63
|
-
a {
|
|
64
|
-
display: inline-block;
|
|
65
|
-
padding: 7px 15px;
|
|
66
|
-
margin: 0 20px;
|
|
67
|
-
border-radius: 10px;
|
|
68
|
-
text-decoration: none;
|
|
69
|
-
color: var(--text);
|
|
70
|
-
background-color: var(--bg-feature);
|
|
71
|
-
border: 1px solid var(--border-feature);
|
|
72
|
-
&:hover {
|
|
73
|
-
border-color: var(--border-link-hover);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<p>Vue Island</p>
|
|
4
|
-
<p>Current count: {{ count }}</p>
|
|
5
|
-
<button @click="increment">Increment</button>
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
<script setup lang="ts">
|
|
9
|
-
import { ref } from 'vue'
|
|
10
|
-
|
|
11
|
-
const count = ref(0)
|
|
12
|
-
|
|
13
|
-
const increment = () => {
|
|
14
|
-
count.value++
|
|
15
|
-
}
|
|
16
|
-
</script>
|
|
17
|
-
<style scoped>
|
|
18
|
-
div {
|
|
19
|
-
border: 1px solid var(--bg-feature);
|
|
20
|
-
padding: 10px;
|
|
21
|
-
border-radius: 5px;
|
|
22
|
-
margin: 20px 0;
|
|
23
|
-
}
|
|
24
|
-
h1 {
|
|
25
|
-
color: red;
|
|
26
|
-
font-size: 18px;
|
|
27
|
-
}
|
|
28
|
-
button {
|
|
29
|
-
padding: 5px 10px;
|
|
30
|
-
}
|
|
31
|
-
</style>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>Strav Spring</title>
|
|
7
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
8
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
9
|
-
<link href="https://fonts.googleapis.com/css2?family=Barlow+Semi+Condensed:ital,wght@0,400;0,500;1,400;1,500&display=swap" rel="stylesheet">
|
|
10
|
-
<link rel="stylesheet" href="{{ asset('/css/app.css') }}">
|
|
11
|
-
</head>
|
|
12
|
-
<body class="bg-gray-50">
|
|
13
|
-
<main>
|
|
14
|
-
@show('content')
|
|
15
|
-
</main>
|
|
16
|
-
@islands
|
|
17
|
-
</body>
|
|
18
|
-
</html>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
@layout('layouts/app')
|
|
2
|
-
|
|
3
|
-
@section('content')
|
|
4
|
-
<h3>Welcome <em>Strav Spring</em></h3>
|
|
5
|
-
<p>
|
|
6
|
-
You're all set. Your project is live and ready to build. <br/>
|
|
7
|
-
Blazing fast, powered by Bun and Vue.js
|
|
8
|
-
</p>
|
|
9
|
-
<vue:counter/>
|
|
10
|
-
<div class="features">
|
|
11
|
-
<div class="feature">
|
|
12
|
-
<h4>Schema-First Architecture</h4>
|
|
13
|
-
<p>Define your database schema once, automatically migrations and models. No more manual SQL and model boilerplate.</p>
|
|
14
|
-
</div>
|
|
15
|
-
<div class="feature">
|
|
16
|
-
<h4>Vue Islands</h4>
|
|
17
|
-
<p>Embed Vue.js components as interactive islands within server-rendered HTML. Get reactivity where you need it without the complexity of a full SPA.</p>
|
|
18
|
-
</div>
|
|
19
|
-
<div class="feature">
|
|
20
|
-
<h4>AI as a First-Class Citizen</h4>
|
|
21
|
-
<p>Built-in AI agents, workflows, and memory management with multi-provider support (Claude, GPT, Gemini). Create AI-powered features with a single import.</p>
|
|
22
|
-
</div>
|
|
23
|
-
<div class="feature">
|
|
24
|
-
<h4>Zero-Config Real-Time Stack</h4>
|
|
25
|
-
<p>WebSocket broadcasting, multi-channel notifications, and transactional email built-in. From chat to live updates, ship real-time features instantly.</p>
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
<div class="links">
|
|
29
|
-
<a href="https://spring.strav.dev/docs" target="_blank">Documentation</a>
|
|
30
|
-
<a href="https://github.com/stravigor/strav" target="_blank">GitHub</a>
|
|
31
|
-
</div>
|
|
32
|
-
@end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { HttpProvider } from "@strav/http"
|
|
2
|
-
import { ConfigProvider, EncryptionProvider, ServiceProvider } from "@strav/kernel"
|
|
3
|
-
import { ViewProvider, PagesProvider } from '@strav/view'
|
|
4
|
-
|
|
5
|
-
export const providers: ServiceProvider[] = [
|
|
6
|
-
new ConfigProvider(),
|
|
7
|
-
new HttpProvider(),
|
|
8
|
-
new EncryptionProvider(),
|
|
9
|
-
new ViewProvider(),
|
|
10
|
-
new PagesProvider(),
|
|
11
|
-
]
|