This project is a backend application built with Hono and Vite.
- Fast Development: Leverages Vite for a fast development experience.
- Modern Backend Framework: Uses Hono, a small, simple, and ultrafast web framework for the Edge.
- Environment Configuration: Supports environment variable configuration using
.envfiles via thedotenvpackage. - Logging: Integrated with
pinofor efficient JSON logging, likely usinghono-pinomiddleware.
- Node.js (version specified in
package.jsonif applicable, or latest LTS) - npm, yarn, or pnpm
-
Clone the repository:
git clone <your-repository-url> cd <folder-name>
-
Install dependencies:
npm install # or # yarn install # or # pnpm install
-
Set up your environment variables: Create a
.envfile in the root of the project and add your necessary environment variables. Example:PORT=3000 ANOTHER_VARIABLE=your_value
(Note: While Hono might listen on a specific port if configured, when running with
vitefor development, it typically serves through Vite's port.)
To start the development server, run:
npm run dev
# or
# yarn dev
# or
# pnpm devThe application will typically be accessible at http://localhost:5173. Vite's dev server will proxy requests to your Hono application.
To build the application for production, run:
npm run build
# or
# yarn build
# or
# pnpm buildThis will create a production-ready build in the dist directory. You can then deploy the contents of this directory or use a Node.js server (like @hono/node-server, which is in your dependencies) to serve the application.
After building the project, you can run the server using:
node ./dist/index.cjsMake sure you have configured any necessary environment variables for your production environment.
To build and run the application using Docker, follow these steps:
-
Build the Docker image:
docker build -t hono-server . -
Run the Docker container:
docker run -d -p 3000:3000 --name hono-server hono-server
This command runs the container in detached mode (
-d), maps port 3000 of the host to port 3000 of the container (-p 3000:3000), and names the containerhono-serverfor easier management.
