Skip to content

Conversation

@yamcodes
Copy link
Owner

@yamcodes yamcodes commented Jan 20, 2026

Description

Use ArkEnv for environment variables. Related to #213


PR Checklist

  • Read the Developer's Guide in CONTRIBUTING.md
  • Use a concise title to represent the changes introduced in this PR
  • Provide a detailed description of the changes introduced in this PR, and, if necessary, some screenshots
  • Reference an issue or discussion where the feature or changes have been previously discussed
  • Add a failing test that passes with the changes introduced in this PR, or explain why it's not feasible
  • Add documentation for the feature or changes introduced in this PR to the docs; you can run them with bun docs

Summary by CodeRabbit

  • Refactor

    • Switched the app’s environment configuration system to a new provider; imports and internal configs updated.
    • Server now reads its listen port from the environment (PORT) instead of a hardcoded value.
  • Documentation

    • Added architecture and quickstart docs describing the new environment tooling and startup validation.
    • Updated example env to use PORT (renamed from APP_PORT).

✏️ Tip: You can customize this high-level summary in your review settings.

- Replaced env config with `arkenv` library
- Updated `env.config.ts` to `arkenv
- Remove old `@/core/env` module
- Update env import paths to use `@env` alias
- Simplify environment variable resolution
@vercel
Copy link

vercel bot commented Jan 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
bedstack Ready Ready Preview, Comment Jan 21, 2026 5:28pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 20, 2026

Walkthrough

Migrates the Conduit app from an Elysia-based env system to ArkEnv: replaces defineEnv with arkenv, updates imports to an @env alias, removes legacy core env utilities/re-exports, updates package dependency, and adjusts example and startup port usage. Documentation is added for the new configuration approach.

Changes

Cohort / File(s) Summary
Env config rewrite
apps/conduit/env.config.ts
Replaced defineEnv(...) (Elysia schema) with arkenv(...) and redefined all env keys using ArkEnv schema/literals. Export shape changed to the arkenv call.
Dependency change
apps/conduit/package.json
Removed @yolk-oss/elysia-env; added arkenv@^0.9.0.
Import updates
apps/conduit/drizzle.config.ts, apps/conduit/drizzle/seed.ts, apps/conduit/src/auth/auth.service.ts, apps/conduit/src/main.ts
Switched environment imports from named @/core/env to default @env; main.ts now uses env.PORT instead of hardcoded port.
Core env module removal
apps/conduit/src/core/env/define-env.util.ts, apps/conduit/src/core/env/env.ts, apps/conduit/src/core/env/index.ts
Deleted defineEnv utility and removed the intermediate env re-exports; env access consolidated to @env.
Docs and examples
apps/www/content/docs/(architecture)/configuration.mdx, apps/www/content/docs/(architecture)/index.mdx, apps/www/content/docs/(architecture)/meta.json, apps/www/content/docs/(architecture)/what-is-bedstack.mdx, apps/www/content/docs/realworld/quickstart.mdx, .env.example
Added ArkEnv documentation and references, updated tech stack/docs to mention ArkEnv, and renamed APP_PORTPORT in .env.example.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I hopped from old Elysia ground,

to ArkEnv fields where types abound.
Imports shifted, docs unfurled —
a tidy burrow for the config world. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Use ArkEnv' is concise and directly reflects the main change of the pull request: migrating environment variable handling from @yolk-oss/elysia-env to ArkEnv across the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the conduit This PR/issue is about the Conduit Bedstack RealWorld example app. label Jan 20, 2026
@yamcodes
Copy link
Owner Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apps/conduit/env.config.ts`:
- Around line 3-13: The current arkenv schema in env.config.ts defines
JWT_SECRET without a default, causing eager validation failures; remove
JWT_SECRET from this shared arkenv schema and create a separate auth-only env
module (e.g., auth.env.ts) that calls arkenv with JWT_SECRET as a required value
(no default), then update the authentication service to import JWT_SECRET from
the new auth.env.ts while leaving database/tooling code to import the original
env.config.ts (which may keep safe defaults for other vars); this decouples
tooling from app-only secrets (reference: arkenv export default, JWT_SECRET,
env.config.ts, and the new auth.env.ts module).

- Implement ArkEnv for robust environment validation
- Update `conduit` app to use `env.PORT`
- Add comprehensive documentation
@yamcodes yamcodes marked this pull request as ready for review January 21, 2026 17:27
@github-actions github-actions bot added the www Improvements or additions to bedstack.js.org label Jan 21, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/conduit/.env.example (1)

1-8: Consider reordering keys to satisfy dotenv-linter.

This is a minor lint warning, but reordering avoids CI noise and keeps env files consistent.

♻️ Proposed ordering tweak
 POSTGRES_USER=postgres
 POSTGRES_PASSWORD=postgres
+PORT=3000
 POSTGRES_DB=medium
 POSTGRES_HOST=0.0.0.0
 POSTGRES_PORT=5432
 JWT_SECRET=supersecretkey
 JWT_ALGORITHM=HS256
-PORT=3000

@yamcodes yamcodes merged commit f84ee19 into main Jan 21, 2026
11 checks passed
@yamcodes yamcodes deleted the use-arkenv branch January 21, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conduit This PR/issue is about the Conduit Bedstack RealWorld example app. www Improvements or additions to bedstack.js.org

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants