Skip to content

Make the app deployable to Render: configurable port, pnpm start, and render.yaml#10

Merged
mahata merged 6 commits intomainfrom
copilot/fix-9
Jul 9, 2025
Merged

Make the app deployable to Render: configurable port, pnpm start, and render.yaml#10
mahata merged 6 commits intomainfrom
copilot/fix-9

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jul 8, 2025

This PR makes the mlack app easily deployable to Render by implementing all the necessary infrastructure changes for production deployment.

Changes Made

1. Configurable Port

  • Updated hono/index.ts to use the PORT environment variable with fallback to 3000
  • Enables compatibility with Render's dynamic port assignment
const port = Number(process.env.PORT) || 3000;

2. Production Build System

  • Created tsconfig.prod.json for production TypeScript compilation
  • Updated package.json with new scripts:
    • build: Compiles TypeScript to JavaScript in dist/ directory
    • build:check: Type checking only (preserves existing behavior)
    • start:prod: Runs compiled JavaScript from dist/hono/index.js
  • Fixed ES module imports to use .js extensions for Node.js compatibility

3. Render Deployment Configuration

  • Added render.yaml with complete deployment configuration:
    • Uses pnpm for package management
    • Configures build and start commands for production
    • Sets up health check endpoint (/health)
    • Specifies Node.js 20 runtime
    • Enables automatic deployment

4. Development Environment Consistency

  • Added .nvmrc file specifying Node.js 20
  • Ensures consistent Node.js version across development and production

Testing

All existing functionality remains intact:

  • ✅ All tests pass
  • ✅ Development mode works with pnpm dev
  • ✅ Production build compiles successfully
  • ✅ Production server runs with pnpm run start:prod
  • ✅ Port configuration works via environment variable
  • ✅ Health endpoint responds correctly

Deployment Ready

The app can now be deployed to Render with minimal configuration - just connect the repository and Render will automatically use the render.yaml configuration for build and deployment.

Fixes #9.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits July 8, 2025 09:38
Co-authored-by: mahata <23497+mahata@users.noreply.github.com>
Co-authored-by: mahata <23497+mahata@users.noreply.github.com>
Copilot AI changed the title [WIP] Make the app deployable to Render: configurable port, pnpm start, and render.yaml Make the app deployable to Render: configurable port, pnpm start, and render.yaml Jul 8, 2025
Copilot finished work on behalf of mahata July 8, 2025 09:40
Copilot AI requested a review from mahata July 8, 2025 09:40
@mahata
Copy link
Copy Markdown
Owner

mahata commented Jul 8, 2025

@copilot Fix the CI process in GitHub Actions.

Co-authored-by: mahata <23497+mahata@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jul 8, 2025

@copilot Fix the CI process in GitHub Actions.

Fixed the CI process! The issues were:

  1. Node.js version inconsistency: CI was using Node.js 24 while .nvmrc specified 20
  2. Linting failures: Missing newline in tsconfig.prod.json

Changes made:

  • Updated CI workflow to use node-version-file: '.nvmrc' for consistency
  • Fixed linting issues with automatic formatting

All CI steps now pass: tests ✅, linting ✅, and build ✅

Commit: 5b8828b

Copilot finished work on behalf of mahata July 8, 2025 09:46
Comment thread .nvmrc Outdated
Comment thread render.yaml Outdated
Comment thread hono/index.ts
@@ -1,7 +1,7 @@
import { serve } from "@hono/node-server";
import { app, injectWebSocket } from "./app";
import { app, injectWebSocket } from "./app.js";
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@copilot What's the purpose of this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The .js extension was added to make the import compatible with Node.js ES modules when running the compiled JavaScript. TypeScript can resolve ./app but Node.js requires explicit file extensions for ES module imports when running the compiled code in production.

Co-authored-by: mahata <23497+mahata@users.noreply.github.com>
Co-authored-by: mahata <23497+mahata@users.noreply.github.com>
Copilot finished work on behalf of mahata July 8, 2025 10:00
@mahata mahata marked this pull request as ready for review July 9, 2025 02:19
@mahata mahata merged commit 299e51f into main Jul 9, 2025
1 check passed
@mahata mahata deleted the copilot/fix-9 branch July 9, 2025 02:21
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.

Make the app deployable to Render: configurable port, pnpm start, and render.yaml

2 participants