Skip to content

Commit d6d5ae6

Browse files
chore: wip
1 parent 8102980 commit d6d5ae6

File tree

46 files changed

+358
-180
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+358
-180
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ custom-cli
2525
.cursor
2626
.zed
2727
./test.ts
28-
28+
generated/*
2929
resources/assets/fonts/*.woff
3030
resources/assets/fonts/*.woff2
3131
storage/framework/api/storage/logs/stacks.log

app/Models/.qb-migrations.postgres.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,5 +394,5 @@
394394
]
395395
},
396396
"hash": "b0b509d250f98e39bb933bb8a0db6310b608a8466dea8e3cd1c489ee083087fb",
397-
"updatedAt": "2025-10-28T10:35:04.927Z"
397+
"updatedAt": "2025-10-28T14:38:24.714Z"
398398
}

bun.lock

Lines changed: 80 additions & 46 deletions
Large diffs are not rendered by default.

config/app.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type { AppConfig } from '@stacksjs/types'
2-
import { env } from '@stacksjs/env'
2+
3+
// Use direct environment variable access to avoid circular dependencies
4+
const envVars = typeof Bun !== 'undefined' ? Bun.env : process.env
35

46
/**
57
* **Application Configuration**
@@ -9,15 +11,15 @@ import { env } from '@stacksjs/env'
911
* you have any questions, feel free to reach out via Discord or GitHub Discussions.
1012
*/
1113
export default {
12-
name: env.APP_NAME ?? 'Stacks',
14+
name: envVars.APP_NAME ?? 'Stacks',
1315
description: 'Stacks is a full-stack framework for building modern web applications.',
14-
env: env.APP_ENV ?? 'local',
15-
url: env.APP_URL ?? 'stacks.localhost',
16+
env: envVars.APP_ENV ?? 'local',
17+
url: envVars.APP_URL ?? 'stacks.localhost',
1618
redirectUrls: ['stacksjs.com'],
17-
debug: env.DEBUG ?? false,
18-
key: env.APP_KEY,
19+
debug: envVars.DEBUG ? envVars.DEBUG === 'true' : false,
20+
key: envVars.APP_KEY,
1921

20-
maintenanceMode: env.APP_MAINTENANCE ?? false,
22+
maintenanceMode: envVars.APP_MAINTENANCE ? envVars.APP_MAINTENANCE === 'true' : false,
2123
// docMode: true, // instead of example.com/docs, deploys example.com as main entry point for docs
2224
docMode: false,
2325

config/auth.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type { AuthConfig } from '@stacksjs/types'
2-
import { env } from '@stacksjs/env'
2+
3+
// Use direct environment variable access to avoid circular dependencies
4+
const envVars = typeof Bun !== 'undefined' ? Bun.env : process.env
35

46
/**
57
* **Authentication Configuration**
@@ -37,17 +39,17 @@ export default {
3739
/**
3840
* The username field used for authentication.
3941
*/
40-
username: env.AUTH_USERNAME_FIELD || 'email',
42+
username: envVars.AUTH_USERNAME_FIELD || 'email',
4143

4244
/**
4345
* The password field used for authentication.
4446
*/
45-
password: env.AUTH_PASSWORD_FIELD || 'password',
47+
password: envVars.AUTH_PASSWORD_FIELD || 'password',
4648

4749
/**
4850
* The token expiry time in milliseconds (default: 30 days).
4951
*/
50-
tokenExpiry: env.AUTH_TOKEN_EXPIRY || 30 * 24 * 60 * 60 * 1000,
52+
tokenExpiry: envVars.AUTH_TOKEN_EXPIRY || 30 * 24 * 60 * 60 * 1000,
5153

5254
/**
5355
* The token rotation time in hours (default: 24 hours).

config/cache.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type { CacheConfig } from '@stacksjs/types'
2-
import { env } from '@stacksjs/env'
2+
3+
// Use direct environment variable access to avoid circular dependencies
4+
const envVars = typeof Bun !== 'undefined' ? Bun.env : process.env
35

46
/**
57
* **Cache Configuration**
@@ -15,9 +17,9 @@ export default {
1517

1618
drivers: {
1719
dynamodb: {
18-
key: env.AWS_ACCESS_KEY_ID || '',
19-
secret: env.AWS_SECRET_ACCESS_KEY || '',
20-
region: env.AWS_DEFAULT_REGION || 'us-east-1',
20+
key: envVars.AWS_ACCESS_KEY_ID || '',
21+
secret: envVars.AWS_SECRET_ACCESS_KEY || '',
22+
region: envVars.AWS_DEFAULT_REGION || 'us-east-1',
2123
table: 'cache',
2224
endpoint: '',
2325
},

config/cloud.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import type { CloudConfig } from '@stacksjs/types'
2-
import { env } from '@stacksjs/env'
32
import security from './security'
43

4+
// Use direct environment variable access to avoid circular dependencies
5+
const envVars = typeof Bun !== 'undefined' ? Bun.env : process.env
6+
57
/**
68
* **Cloud**
79
*
@@ -59,7 +61,7 @@ export default {
5961
storage: {},
6062

6163
api: {
62-
prefix: env.API_PREFIX || 'api',
64+
prefix: envVars.API_PREFIX || 'api',
6365
// version: 'v1',
6466
description: 'My awesome Stacks API',
6567
deploy: true,

config/database.ts

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type { DatabaseConfig } from '@stacksjs/types'
2-
import { env } from '@stacksjs/env'
32
import type { SupportedDialect } from 'bun-query-builder'
3+
4+
// Use direct environment variable access to avoid circular dependencies
5+
const envVars = typeof Bun !== 'undefined' ? Bun.env : process.env
46
/**
57
* **Database Configuration**
68
*
@@ -9,37 +11,37 @@ import type { SupportedDialect } from 'bun-query-builder'
911
* you have any questions, feel free to reach out via Discord or GitHub Discussions.
1012
*/
1113
export default {
12-
default: env.DB_CONNECTION as SupportedDialect || 'postgres',
14+
default: envVars.DB_CONNECTION as SupportedDialect || 'postgres',
1315

1416
connections: {
1517
sqlite: {
16-
database: env.DB_DATABASE || 'stacks',
18+
database: envVars.DB_DATABASE || 'stacks',
1719
prefix: '',
1820
},
1921

2022
dynamodb: {
21-
key: env.AWS_ACCESS_KEY_ID || '',
22-
secret: env.AWS_SECRET_ACCESS_KEY || '',
23-
region: env.AWS_DEFAULT_REGION || 'us-east-1',
24-
prefix: env.DB_DATABASE || 'stacks',
25-
endpoint: env.DB_PORT ? `http://localhost:${env.DB_PORT}` : 'http://localhost:8000',
23+
key: envVars.AWS_ACCESS_KEY_ID || '',
24+
secret: envVars.AWS_SECRET_ACCESS_KEY || '',
25+
region: envVars.AWS_DEFAULT_REGION || 'us-east-1',
26+
prefix: envVars.DB_DATABASE || 'stacks',
27+
endpoint: envVars.DB_PORT ? `http://localhost:${envVars.DB_PORT}` : 'http://localhost:8000',
2628
},
2729

2830
mysql: {
29-
name: env.DB_DATABASE || 'stacks',
30-
host: env.DB_HOST || '127.0.0.1',
31-
port: Number(env.DB_PORT) || 3306,
32-
username: env.DB_USERNAME || 'root',
33-
password: env.DB_PASSWORD || '',
31+
name: envVars.DB_DATABASE || 'stacks',
32+
host: envVars.DB_HOST || '127.0.0.1',
33+
port: Number(envVars.DB_PORT) || 3306,
34+
username: envVars.DB_USERNAME || 'root',
35+
password: envVars.DB_PASSWORD || '',
3436
prefix: '',
3537
},
3638

3739
postgres: {
38-
name: env.DB_DATABASE || 'stacks',
39-
host: env.DB_HOST || '127.0.0.1',
40-
port: Number(env.DB_PORT) || 3306,
41-
username: env.DB_USERNAME || '',
42-
password: env.DB_PASSWORD || '',
40+
name: envVars.DB_DATABASE || 'stacks',
41+
host: envVars.DB_HOST || '127.0.0.1',
42+
port: Number(envVars.DB_PORT) || 3306,
43+
username: envVars.DB_USERNAME || '',
44+
password: envVars.DB_PASSWORD || '',
4345
prefix: '',
4446
},
4547
},
@@ -56,22 +58,22 @@ export default {
5658
/**
5759
* Enable query logging to database
5860
*/
59-
enabled: env.DB_QUERY_LOGGING_ENABLED === 'true' || true,
61+
enabled: envVars.DB_QUERY_LOGGING_ENABLED === 'true' || true,
6062

6163
/**
6264
* The threshold in milliseconds to mark a query as slow
6365
*/
64-
slowThreshold: Number(env.DB_QUERY_LOGGING_SLOW_THRESHOLD || 100),
66+
slowThreshold: Number(envVars.DB_QUERY_LOGGING_SLOW_THRESHOLD || 100),
6567

6668
/**
6769
* How many days to keep query logs
6870
*/
69-
retention: Number(env.DB_QUERY_LOGGING_RETENTION_DAYS || 7),
71+
retention: Number(envVars.DB_QUERY_LOGGING_RETENTION_DAYS || 7),
7072

7173
/**
7274
* How often to run the pruning job in hours
7375
*/
74-
pruneFrequency: Number(env.DB_QUERY_LOGGING_PRUNE_FREQUENCY || 24),
76+
pruneFrequency: Number(envVars.DB_QUERY_LOGGING_PRUNE_FREQUENCY || 24),
7577

7678
/**
7779
* Patterns to exclude from logging
@@ -88,22 +90,22 @@ export default {
8890
/**
8991
* Enable detailed query analysis
9092
*/
91-
enabled: env.DB_QUERY_LOGGING_ANALYSIS_ENABLED === 'true' || true,
93+
enabled: envVars.DB_QUERY_LOGGING_ANALYSIS_ENABLED === 'true' || true,
9294

9395
/**
9496
* Analyze all queries, not just slow ones
9597
*/
96-
analyzeAll: env.DB_QUERY_LOGGING_ANALYZE_ALL === 'true' || false,
98+
analyzeAll: envVars.DB_QUERY_LOGGING_ANALYZE_ALL === 'true' || false,
9799

98100
/**
99101
* Collect EXPLAIN plans for SELECT queries
100102
*/
101-
explainPlan: env.DB_QUERY_LOGGING_EXPLAIN_PLAN === 'true' || true,
103+
explainPlan: envVars.DB_QUERY_LOGGING_EXPLAIN_PLAN === 'true' || true,
102104

103105
/**
104106
* Generate optimization suggestions
105107
*/
106-
suggestions: env.DB_QUERY_LOGGING_SUGGESTIONS === 'true' || true,
108+
suggestions: envVars.DB_QUERY_LOGGING_SUGGESTIONS === 'true' || true,
107109
},
108110
},
109111
} satisfies DatabaseConfig

config/dns.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type { DnsConfig } from '@stacksjs/types'
2-
import { env } from '@stacksjs/env'
2+
3+
// Use direct environment variable access to avoid circular dependencies
4+
const envVars = typeof Bun !== 'undefined' ? Bun.env : process.env
35

46
/**
57
* **DNS Options**
@@ -11,7 +13,7 @@ import { env } from '@stacksjs/env'
1113
export default {
1214
a: [
1315
{
14-
name: env.APP_URL || '', // Hostname (root domain)
16+
name: envVars.APP_URL || '', // Hostname (root domain)
1517
address: '10.0.0.1', // IPv4 address
1618
ttl: 300, // Time-to-live in seconds
1719
},

config/email.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type { EmailConfig } from '@stacksjs/types'
2-
import { env } from '@stacksjs/env'
2+
3+
// Use direct environment variable access to avoid circular dependencies
4+
const envVars = typeof Bun !== 'undefined' ? Bun.env : process.env
35

46
/**
57
* **Email Configuration**
@@ -10,18 +12,18 @@ import { env } from '@stacksjs/env'
1012
*/
1113
export default {
1214
from: {
13-
name: env.MAIL_FROM_NAME || 'Stacks',
14-
address: env.MAIL_FROM_ADDRESS || 'no-reply@stacksjs.org',
15+
name: envVars.MAIL_FROM_NAME || 'Stacks',
16+
address: envVars.MAIL_FROM_ADDRESS || 'no-reply@stacksjs.org',
1517
},
1618

1719
mailboxes: ['chris@stacksjs.org', 'blake@stacksjs.org', 'glenn@stacksjs.org'],
1820

19-
url: env.APP_URL || 'http://localhost:3000',
21+
url: envVars.APP_URL || 'http://localhost:3000',
2022
charset: 'UTF-8',
2123

2224
server: {
2325
scan: true, // scans for spam and viruses
2426
},
2527

26-
default: env.MAIL_DRIVER || 'ses',
28+
default: envVars.MAIL_DRIVER || 'ses',
2729
} satisfies EmailConfig

0 commit comments

Comments
 (0)