create-mantiq 0.5.1 → 0.5.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.
- package/package.json +2 -1
- package/skeleton/.env.example +12 -0
- package/skeleton/README.md +46 -0
- package/skeleton/app/Http/Controllers/HomeController.ts +78 -0
- package/skeleton/app/Http/Middleware/.gitkeep +0 -0
- package/skeleton/app/Models/PersonalAccessToken.ts +5 -0
- package/skeleton/app/Models/User.ts +18 -0
- package/skeleton/app/Providers/DatabaseServiceProvider.ts +27 -0
- package/skeleton/config/app.ts +11 -0
- package/skeleton/config/auth.ts +16 -0
- package/skeleton/config/database.ts +12 -0
- package/skeleton/config/filesystem.ts +17 -0
- package/skeleton/config/heartbeat.ts +45 -0
- package/skeleton/config/logging.ts +27 -0
- package/skeleton/config/mail.ts +52 -0
- package/skeleton/config/notify.ts +3 -0
- package/skeleton/config/queue.ts +23 -0
- package/skeleton/config/search.ts +25 -0
- package/skeleton/database/factories/.gitkeep +0 -0
- package/skeleton/database/migrations/001_create_users_table.ts +19 -0
- package/skeleton/database/migrations/002_create_personal_access_tokens_table.ts +22 -0
- package/skeleton/database/seeders/DatabaseSeeder.ts +7 -0
- package/skeleton/index.ts +20 -0
- package/skeleton/mantiq.ts +8 -0
- package/skeleton/package.json +33 -0
- package/skeleton/public/.gitkeep +0 -0
- package/skeleton/routes/api.ts +8 -0
- package/skeleton/routes/web.ts +6 -0
- package/skeleton/tsconfig.json +27 -0
- package/src/index.ts +50 -14
- package/src/templates.ts +75 -864
- package/stubs/react/src/components/layout/nav-user.tsx.stub +1 -1
- package/stubs/react/src/components/layout/sidebar-data.ts.stub +1 -1
- package/stubs/react/vite.config.ts.stub +1 -1
- package/stubs/svelte/src/lib/components/layout/sidebar-data.ts.stub +1 -1
- package/stubs/svelte/vite.config.ts.stub +1 -1
- package/stubs/vue/src/components/layout/sidebar-data.ts.stub +1 -1
- package/stubs/vue/vite.config.ts.stub +1 -1
- package/src/kits/react.ts +0 -437
- package/src/kits/svelte.ts +0 -464
- package/src/kits/vue.ts +0 -532
- package/src/ui/shadcn.ts +0 -910
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-mantiq",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Scaffold a new MantiqJS application",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"files": [
|
|
36
36
|
"src/",
|
|
37
37
|
"stubs/",
|
|
38
|
+
"skeleton/",
|
|
38
39
|
"package.json",
|
|
39
40
|
"README.md"
|
|
40
41
|
],
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# MantiqJS Skeleton
|
|
2
|
+
|
|
3
|
+
The official MantiqJS application skeleton — API-only, no frontend framework.
|
|
4
|
+
|
|
5
|
+
This is the reference implementation used by `create-mantiq` to scaffold new projects.
|
|
6
|
+
|
|
7
|
+
## Getting Started
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun install
|
|
11
|
+
bun mantiq migrate
|
|
12
|
+
bun run dev
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Structure
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
├── app/
|
|
19
|
+
│ ├── Http/Controllers/ # Request handlers
|
|
20
|
+
│ ├── Models/ # Database models
|
|
21
|
+
│ └── Providers/ # Service providers
|
|
22
|
+
├── config/ # Configuration files
|
|
23
|
+
├── database/
|
|
24
|
+
│ ├── migrations/ # Database migrations
|
|
25
|
+
│ ├── seeders/ # Data seeders
|
|
26
|
+
│ └── factories/ # Model factories
|
|
27
|
+
├── routes/
|
|
28
|
+
│ ├── web.ts # Web routes
|
|
29
|
+
│ └── api.ts # API routes
|
|
30
|
+
├── storage/ # Logs, cache, uploads
|
|
31
|
+
├── index.ts # Application bootstrap
|
|
32
|
+
├── mantiq.ts # CLI entry point
|
|
33
|
+
└── package.json
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Available Commands
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
bun run dev # Start dev server (with watch)
|
|
40
|
+
bun run start # Start production server
|
|
41
|
+
bun mantiq migrate # Run migrations
|
|
42
|
+
bun mantiq seed # Run seeders
|
|
43
|
+
bun mantiq make:model # Generate a model
|
|
44
|
+
bun mantiq make:migration # Generate a migration
|
|
45
|
+
bun mantiq route:list # List all routes
|
|
46
|
+
```
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { MantiqRequest } from '@mantiq/core'
|
|
2
|
+
import { config } from '@mantiq/core'
|
|
3
|
+
|
|
4
|
+
export class HomeController {
|
|
5
|
+
async index(_request: MantiqRequest): Promise<Response> {
|
|
6
|
+
const appName = config('app.name') ?? 'MantiqJS'
|
|
7
|
+
const appEnv = config('app.env') ?? 'production'
|
|
8
|
+
const debug = config('app.debug') ? 'Enabled' : 'Disabled'
|
|
9
|
+
const bunVersion = typeof Bun !== 'undefined' ? Bun.version : 'unknown'
|
|
10
|
+
|
|
11
|
+
let mantiqVersion = '0.0.0'
|
|
12
|
+
try {
|
|
13
|
+
const pkg = await Bun.file(require.resolve('@mantiq/core/package.json')).json()
|
|
14
|
+
mantiqVersion = pkg.version
|
|
15
|
+
} catch { /* fallback */ }
|
|
16
|
+
|
|
17
|
+
const html = `<!DOCTYPE html>
|
|
18
|
+
<html lang="en">
|
|
19
|
+
<head>
|
|
20
|
+
<meta charset="UTF-8">
|
|
21
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
22
|
+
<title>${appName}</title>
|
|
23
|
+
<style>
|
|
24
|
+
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
|
|
25
|
+
body{
|
|
26
|
+
font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',system-ui,sans-serif;
|
|
27
|
+
background:#0a0a0b;color:#fafafa;min-height:100vh;
|
|
28
|
+
display:flex;align-items:center;justify-content:center;
|
|
29
|
+
-webkit-font-smoothing:antialiased;
|
|
30
|
+
}
|
|
31
|
+
.c{width:100%;max-width:460px;padding:32px;animation:up .5s ease}
|
|
32
|
+
@keyframes up{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
|
|
33
|
+
.w{font-size:28px;font-weight:600;letter-spacing:-0.04em;color:#fafafa}
|
|
34
|
+
.w .d{color:#10b981}
|
|
35
|
+
.v{font-family:'SF Mono',ui-monospace,monospace;font-size:12px;color:#52525b;margin-top:6px}
|
|
36
|
+
hr{border:none;border-top:1px solid #1e1e1e;margin:24px 0}
|
|
37
|
+
.g{display:grid;grid-template-columns:1fr 1fr;gap:8px}
|
|
38
|
+
.l{
|
|
39
|
+
background:#111113;border:1px solid #1e1e1e;border-radius:8px;
|
|
40
|
+
padding:14px 16px;text-decoration:none;color:#a1a1aa;font-size:13px;
|
|
41
|
+
display:flex;align-items:center;justify-content:space-between;
|
|
42
|
+
transition:border-color .15s,color .15s;
|
|
43
|
+
}
|
|
44
|
+
.l:hover{border-color:#27272a;color:#34d399}
|
|
45
|
+
.l .a{color:#52525b;font-size:11px;transition:color .15s}
|
|
46
|
+
.l:hover .a{color:#34d399}
|
|
47
|
+
.e{
|
|
48
|
+
margin-top:24px;font-family:'SF Mono',ui-monospace,monospace;
|
|
49
|
+
font-size:11px;color:#3f3f46;line-height:2;
|
|
50
|
+
}
|
|
51
|
+
.e span{color:#52525b}
|
|
52
|
+
</style>
|
|
53
|
+
</head>
|
|
54
|
+
<body>
|
|
55
|
+
<div class="c">
|
|
56
|
+
<div class="w"><span class="d">.</span>mantiq</div>
|
|
57
|
+
<div class="v">v${mantiqVersion} — ${appName}</div>
|
|
58
|
+
<hr>
|
|
59
|
+
<div class="g">
|
|
60
|
+
<a class="l" href="/_heartbeat">Heartbeat<span class="a">→</span></a>
|
|
61
|
+
<a class="l" href="/api/ping">API Ping<span class="a">→</span></a>
|
|
62
|
+
<a class="l" href="https://github.com/mantiqjs/mantiq" target="_blank" rel="noopener">GitHub<span class="a">↗</span></a>
|
|
63
|
+
<a class="l" href="https://www.npmjs.com/org/mantiq" target="_blank" rel="noopener">npm<span class="a">↗</span></a>
|
|
64
|
+
</div>
|
|
65
|
+
<div class="e">
|
|
66
|
+
<span>Runtime</span> Bun ${bunVersion}<br>
|
|
67
|
+
<span>Environment</span> ${appEnv}<br>
|
|
68
|
+
<span>Debug</span> ${debug}
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</body>
|
|
72
|
+
</html>`
|
|
73
|
+
|
|
74
|
+
return new Response(html, {
|
|
75
|
+
headers: { 'Content-Type': 'text/html; charset=utf-8' },
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Model } from '@mantiq/database'
|
|
2
|
+
import type { Authenticatable } from '@mantiq/auth'
|
|
3
|
+
|
|
4
|
+
export class User extends Model implements Authenticatable {
|
|
5
|
+
static override table = 'users'
|
|
6
|
+
static override fillable = ['name', 'email', 'password']
|
|
7
|
+
static override guarded = ['id']
|
|
8
|
+
static override hidden = ['password', 'remember_token']
|
|
9
|
+
static override timestamps = true
|
|
10
|
+
|
|
11
|
+
getAuthIdentifierName(): string { return 'id' }
|
|
12
|
+
getAuthIdentifier(): number { return this.getAttribute('id') as number }
|
|
13
|
+
getAuthPasswordName(): string { return 'password' }
|
|
14
|
+
getAuthPassword(): string { return this.getAttribute('password') as string }
|
|
15
|
+
getRememberToken(): string | null { return (this.getAttribute('remember_token') as string) ?? null }
|
|
16
|
+
setRememberToken(token: string | null): void { this.setAttribute('remember_token', token) }
|
|
17
|
+
getRememberTokenName(): string { return 'remember_token' }
|
|
18
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ServiceProvider, config } from '@mantiq/core'
|
|
2
|
+
import { DatabaseManager, setupModels, setManager, Migrator } from '@mantiq/database'
|
|
3
|
+
import { applyHasApiTokens, PersonalAccessToken } from '@mantiq/auth'
|
|
4
|
+
import { User } from '../Models/User.ts'
|
|
5
|
+
|
|
6
|
+
export class DatabaseServiceProvider extends ServiceProvider {
|
|
7
|
+
override register(): void {
|
|
8
|
+
this.app.singleton(DatabaseManager, () => {
|
|
9
|
+
const dbConfig = config('database')
|
|
10
|
+
const manager = new DatabaseManager(dbConfig)
|
|
11
|
+
|
|
12
|
+
setManager(manager)
|
|
13
|
+
setupModels(manager)
|
|
14
|
+
|
|
15
|
+
return manager
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
override async boot(): Promise<void> {
|
|
20
|
+
// Resolve the manager (triggers creation via the singleton factory)
|
|
21
|
+
const manager = this.app.make(DatabaseManager)
|
|
22
|
+
|
|
23
|
+
// Set up PersonalAccessToken connection and apply HasApiTokens mixin
|
|
24
|
+
PersonalAccessToken.setConnection(manager.connection())
|
|
25
|
+
applyHasApiTokens(User)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { env } from '@mantiq/core'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
name: env('APP_NAME', 'MantiqJS'),
|
|
5
|
+
env: env('APP_ENV', 'production'),
|
|
6
|
+
debug: env('APP_DEBUG', false),
|
|
7
|
+
key: env('APP_KEY', ''),
|
|
8
|
+
url: env('APP_URL', 'http://localhost:3000'),
|
|
9
|
+
port: Number(env('APP_PORT', '3000')),
|
|
10
|
+
basePath: import.meta.dir + '/..',
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { User } from '../app/Models/User.ts'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
defaults: {
|
|
5
|
+
guard: 'web',
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
guards: {
|
|
9
|
+
web: { driver: 'session', provider: 'users' },
|
|
10
|
+
api: { driver: 'token', provider: 'users' },
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
providers: {
|
|
14
|
+
users: { driver: 'database', model: User },
|
|
15
|
+
},
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { env } from '@mantiq/core'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
default: env('DB_CONNECTION', 'sqlite'),
|
|
5
|
+
|
|
6
|
+
connections: {
|
|
7
|
+
sqlite: {
|
|
8
|
+
driver: 'sqlite' as const,
|
|
9
|
+
database: env('DB_DATABASE', import.meta.dir + '/../database/database.sqlite'),
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { env } from '@mantiq/core'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
default: env('FILESYSTEM_DISK', 'local'),
|
|
5
|
+
|
|
6
|
+
disks: {
|
|
7
|
+
local: {
|
|
8
|
+
driver: 'local' as const,
|
|
9
|
+
root: import.meta.dir + '/../storage/app',
|
|
10
|
+
},
|
|
11
|
+
public: {
|
|
12
|
+
driver: 'local' as const,
|
|
13
|
+
root: import.meta.dir + '/../storage/app/public',
|
|
14
|
+
visibility: 'public' as const,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
enabled: true,
|
|
3
|
+
|
|
4
|
+
storage: {
|
|
5
|
+
driver: 'sqlite' as const,
|
|
6
|
+
path: 'storage/heartbeat/heartbeat.sqlite',
|
|
7
|
+
retention: 86400, // 24 hours
|
|
8
|
+
pruneInterval: 300, // 5 minutes
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
queue: {
|
|
12
|
+
connection: 'sync',
|
|
13
|
+
queue: 'heartbeat',
|
|
14
|
+
batchSize: 50,
|
|
15
|
+
flushInterval: 1000,
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
watchers: {
|
|
19
|
+
request: { enabled: true, slow_threshold: 1000, ignore: [] },
|
|
20
|
+
query: { enabled: true, slow_threshold: 100, detect_n_plus_one: true },
|
|
21
|
+
exception: { enabled: true, ignore: [] },
|
|
22
|
+
cache: { enabled: true },
|
|
23
|
+
job: { enabled: true },
|
|
24
|
+
event: { enabled: true, ignore: [] },
|
|
25
|
+
model: { enabled: true },
|
|
26
|
+
log: { enabled: true, level: 'debug' },
|
|
27
|
+
schedule: { enabled: true },
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
tracing: {
|
|
31
|
+
enabled: true,
|
|
32
|
+
propagate: true,
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
sampling: {
|
|
36
|
+
rate: 1.0,
|
|
37
|
+
always_sample_errors: true,
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
dashboard: {
|
|
41
|
+
enabled: true,
|
|
42
|
+
path: '/_heartbeat',
|
|
43
|
+
middleware: [],
|
|
44
|
+
},
|
|
45
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { env } from '@mantiq/core'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
default: env('LOG_CHANNEL', 'stack'),
|
|
5
|
+
|
|
6
|
+
channels: {
|
|
7
|
+
stack: {
|
|
8
|
+
driver: 'stack' as const,
|
|
9
|
+
channels: ['console', 'daily'],
|
|
10
|
+
},
|
|
11
|
+
console: {
|
|
12
|
+
driver: 'console' as const,
|
|
13
|
+
level: 'debug' as const,
|
|
14
|
+
},
|
|
15
|
+
daily: {
|
|
16
|
+
driver: 'daily' as const,
|
|
17
|
+
path: 'storage/logs/mantiq.log',
|
|
18
|
+
level: 'debug' as const,
|
|
19
|
+
days: 14,
|
|
20
|
+
},
|
|
21
|
+
file: {
|
|
22
|
+
driver: 'file' as const,
|
|
23
|
+
path: 'storage/logs/mantiq.log',
|
|
24
|
+
level: 'debug' as const,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { env } from '@mantiq/core'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
default: env('MAIL_MAILER', 'log'),
|
|
5
|
+
|
|
6
|
+
from: {
|
|
7
|
+
address: env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
|
8
|
+
name: env('MAIL_FROM_NAME', 'skeleton'),
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
mailers: {
|
|
12
|
+
smtp: {
|
|
13
|
+
driver: 'smtp' as const,
|
|
14
|
+
host: env('MAIL_HOST', 'localhost'),
|
|
15
|
+
port: Number(env('MAIL_PORT', '587')),
|
|
16
|
+
username: env('MAIL_USERNAME', ''),
|
|
17
|
+
password: env('MAIL_PASSWORD', ''),
|
|
18
|
+
encryption: env('MAIL_ENCRYPTION', 'starttls') as 'tls' | 'starttls' | 'none',
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
resend: {
|
|
22
|
+
driver: 'resend' as const,
|
|
23
|
+
apiKey: env('RESEND_API_KEY', ''),
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
sendgrid: {
|
|
27
|
+
driver: 'sendgrid' as const,
|
|
28
|
+
apiKey: env('SENDGRID_API_KEY', ''),
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
mailgun: {
|
|
32
|
+
driver: 'mailgun' as const,
|
|
33
|
+
apiKey: env('MAILGUN_API_KEY', ''),
|
|
34
|
+
domain: env('MAILGUN_DOMAIN', ''),
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
postmark: {
|
|
38
|
+
driver: 'postmark' as const,
|
|
39
|
+
serverToken: env('POSTMARK_TOKEN', ''),
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
ses: {
|
|
43
|
+
driver: 'ses' as const,
|
|
44
|
+
region: env('AWS_REGION', 'us-east-1'),
|
|
45
|
+
accessKeyId: env('AWS_ACCESS_KEY_ID', ''),
|
|
46
|
+
secretAccessKey: env('AWS_SECRET_ACCESS_KEY', ''),
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
log: { driver: 'log' as const },
|
|
50
|
+
array: { driver: 'array' as const },
|
|
51
|
+
},
|
|
52
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { env } from '@mantiq/core'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
default: env('QUEUE_CONNECTION', 'sync'),
|
|
5
|
+
|
|
6
|
+
connections: {
|
|
7
|
+
sync: {
|
|
8
|
+
driver: 'sync' as const,
|
|
9
|
+
},
|
|
10
|
+
sqlite: {
|
|
11
|
+
driver: 'sqlite' as const,
|
|
12
|
+
database: import.meta.dir + '/../database/queue.sqlite',
|
|
13
|
+
table: 'jobs',
|
|
14
|
+
retryAfter: 60,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
failed: {
|
|
19
|
+
driver: 'sqlite' as const,
|
|
20
|
+
database: import.meta.dir + '/../database/queue.sqlite',
|
|
21
|
+
table: 'failed_jobs',
|
|
22
|
+
},
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
default: 'collection',
|
|
3
|
+
prefix: '',
|
|
4
|
+
queue: false,
|
|
5
|
+
softDelete: false,
|
|
6
|
+
|
|
7
|
+
engines: {
|
|
8
|
+
collection: {
|
|
9
|
+
driver: 'collection' as const,
|
|
10
|
+
},
|
|
11
|
+
database: {
|
|
12
|
+
driver: 'database' as const,
|
|
13
|
+
},
|
|
14
|
+
// algolia: {
|
|
15
|
+
// driver: 'algolia' as const,
|
|
16
|
+
// applicationId: env('ALGOLIA_APP_ID', ''),
|
|
17
|
+
// apiKey: env('ALGOLIA_SECRET', ''),
|
|
18
|
+
// },
|
|
19
|
+
// meilisearch: {
|
|
20
|
+
// driver: 'meilisearch' as const,
|
|
21
|
+
// host: env('MEILISEARCH_HOST', 'http://127.0.0.1:7700'),
|
|
22
|
+
// apiKey: env('MEILISEARCH_KEY', ''),
|
|
23
|
+
// },
|
|
24
|
+
},
|
|
25
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Migration } from '@mantiq/database'
|
|
2
|
+
import type { SchemaBuilder } from '@mantiq/database'
|
|
3
|
+
|
|
4
|
+
export default class CreateUsersTable extends Migration {
|
|
5
|
+
override async up(schema: SchemaBuilder) {
|
|
6
|
+
await schema.create('users', (t) => {
|
|
7
|
+
t.id()
|
|
8
|
+
t.string('name', 100)
|
|
9
|
+
t.string('email', 150).unique()
|
|
10
|
+
t.string('password', 255)
|
|
11
|
+
t.string('remember_token', 100).nullable()
|
|
12
|
+
t.timestamps()
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
override async down(schema: SchemaBuilder) {
|
|
17
|
+
await schema.dropIfExists('users')
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Migration } from '@mantiq/database'
|
|
2
|
+
import type { SchemaBuilder } from '@mantiq/database'
|
|
3
|
+
|
|
4
|
+
export default class CreatePersonalAccessTokensTable extends Migration {
|
|
5
|
+
override async up(schema: SchemaBuilder) {
|
|
6
|
+
await schema.create('personal_access_tokens', (t) => {
|
|
7
|
+
t.id()
|
|
8
|
+
t.string('tokenable_type')
|
|
9
|
+
t.unsignedBigInteger('tokenable_id')
|
|
10
|
+
t.string('name')
|
|
11
|
+
t.string('token', 64).unique()
|
|
12
|
+
t.json('abilities').nullable()
|
|
13
|
+
t.timestamp('last_used_at').nullable()
|
|
14
|
+
t.timestamp('expires_at').nullable()
|
|
15
|
+
t.timestamps()
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
override async down(schema: SchemaBuilder) {
|
|
20
|
+
await schema.dropIfExists('personal_access_tokens')
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Application, CoreServiceProvider, HttpKernel, RouterImpl, Discoverer } from '@mantiq/core'
|
|
2
|
+
|
|
3
|
+
const app = await Application.create(import.meta.dir, 'config')
|
|
4
|
+
|
|
5
|
+
const discoverer = new Discoverer(import.meta.dir)
|
|
6
|
+
const isDev = process.env['APP_ENV'] !== 'production'
|
|
7
|
+
const manifest = await discoverer.resolve(isDev)
|
|
8
|
+
const userProviders = await discoverer.loadProviders(manifest)
|
|
9
|
+
|
|
10
|
+
await app.bootstrap([CoreServiceProvider], userProviders)
|
|
11
|
+
|
|
12
|
+
const router = app.make(RouterImpl)
|
|
13
|
+
await discoverer.loadRoutes(manifest, router)
|
|
14
|
+
|
|
15
|
+
export default app
|
|
16
|
+
|
|
17
|
+
if (import.meta.main) {
|
|
18
|
+
const kernel = app.make(HttpKernel)
|
|
19
|
+
await kernel.start()
|
|
20
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "skeleton",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "bun run --watch index.ts",
|
|
8
|
+
"start": "bun run index.ts",
|
|
9
|
+
"mantiq": "bun run mantiq.ts"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@mantiq/0,
|
|
13
|
+
"@mantiq/0,
|
|
14
|
+
"@mantiq/0,
|
|
15
|
+
"@mantiq/0,
|
|
16
|
+
"@mantiq/0,
|
|
17
|
+
"@mantiq/0,
|
|
18
|
+
"@mantiq/0,
|
|
19
|
+
"@mantiq/0,
|
|
20
|
+
"@mantiq/0,
|
|
21
|
+
"@mantiq/0,
|
|
22
|
+
"@mantiq/0,
|
|
23
|
+
"@mantiq/0,
|
|
24
|
+
"@mantiq/0,
|
|
25
|
+
"@mantiq/0,
|
|
26
|
+
"@mantiq/0,
|
|
27
|
+
"@mantiq/0
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"bun-types": "latest",
|
|
31
|
+
"typescript": "^5.7.0"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"lib": [
|
|
7
|
+
"ESNext"
|
|
8
|
+
],
|
|
9
|
+
"types": [
|
|
10
|
+
"bun-types"
|
|
11
|
+
],
|
|
12
|
+
"strict": true,
|
|
13
|
+
"noImplicitAny": true,
|
|
14
|
+
"strictNullChecks": true,
|
|
15
|
+
"noUncheckedIndexedAccess": true,
|
|
16
|
+
"noImplicitOverride": true,
|
|
17
|
+
"allowImportingTsExtensions": true,
|
|
18
|
+
"noEmit": true,
|
|
19
|
+
"skipLibCheck": true
|
|
20
|
+
},
|
|
21
|
+
"include": [
|
|
22
|
+
"./**/*"
|
|
23
|
+
],
|
|
24
|
+
"exclude": [
|
|
25
|
+
"node_modules"
|
|
26
|
+
]
|
|
27
|
+
}
|