Skip to content

Add npm support#3

Open
Mondonno wants to merge 2 commits intoamirkabiri:mainfrom
Mondonno:npm-support
Open

Add npm support#3
Mondonno wants to merge 2 commits intoamirkabiri:mainfrom
Mondonno:npm-support

Conversation

@Mondonno
Copy link

Bun + npm Support

Added dual runtime support so the DuckAI server works with both Bun and npm!

Key Changes

  • Runtime Detection: Auto-detects Bun vs Node.js and uses the right server
  • Better Port Handling: Clear messages when ports are busy + auto-fallback
  • Dual Scripts: Added npm run dev:npm, npm run start:npm, etc.

Usage

# Bun (existing)
bun run start

# npm (new)  
npm run start:npm

Zero breaking changes - everything still works, although have not tested with bun.

Tested with both runtimes, handles port conflicts gracefully.

…rror handling

- Updated server implementation to use Node.js http module instead of Bun.serve.
- Added CORS headers and improved handling of preflight requests.
- Implemented streaming support for chat completions endpoint.
- Enhanced error handling for various endpoints and request processing.
- Updated package.json to include new devDependencies for TypeScript and Node types.
- Modified tsconfig.json to change module resolution and output settings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant