A Hono starter boilerplate for TypeScript with minimal dependencies and a clean architecture. All dependencies are
initiated at the start of the application and passed to the controllers and services. A swagger API doc is attached in
the static folder: openapi.yaml
.


- Authentication: JWT
- Validation: Zod
- Worker: BullMQ
- Logging: Pino
- ORM: Drizzle
- Queue: Redis
- DB: MySQL
- Runtime: NodeJS
- Framework: Hono
- Formatter: Biome
- API Doc: Swagger
- Language: TypeScript
- Package Manager: PNPM
pnpm install
pnpm install -g typescript
pnpm install -g pino-pretty
Create a new file .env
in the root folder and copy contents from the .env.template
file and run this command. You must have docker installed on your computer. If not, skip to Install Docker Desktop
then return here once done. Ideally for local developemnt you only need to run this step once to install require dependencies like mysql. Subsequently you can just turn the container on or off at will in Docker desktop
docker compose up -d
pnpm run db:generate
pnpm run db:migrate
pnpm run dev
open http://localhost:3000/doc
The OpenAPI YAML doc is in the static
folder.
If you need the JSON file, it can be generated with the help of yq
.
https://github.com/mikefarah/yq
yq eval -o=json static/openapi.yaml > static/openapi.json
And the JSON doc will be generated.
pnpm drizzle-kit studio
open https://local.drizzle.studio/
To install Docker on Windows, you'll need to install Docker Desktop and WSL 2 (Windows Subsystem for Linux). Below are the step-by-step instructions:
WSL 2 is required for Docker to run on Windows efficiently.
-
Open PowerShell as Administrator and run the following command to enable WSL:
wsl --install
This will install the default Linux distribution (Ubuntu) and enable WSL 2.
-
Restart your computer after installation.
- Visit the official Docker website and download Docker Desktop for Windows.
-
Run the Docker Desktop Installer.exe file.
-
In the installation settings:
- Ensure "Use WSL 2 instead of Hyper-V" is checked.
- Click Install and wait for the process to complete.
-
Once the installation is done, click Close and restart.
- Open Docker Desktop.
- Go to Settings > General.
- Check "Use the WSL 2 based engine".
- Click Apply & Restart.
-
Open PowerShell or Command Prompt and run:
docker --version
This should return the installed Docker version.
-
Run the hello-world container to test:
docker run hello-world
If everything is set up correctly, you will see a message confirming that Docker is working.
Once the migration is complete, and you've run:
pnpm run db:generate
pnpm run db:migrate
Confirm that MySQL inside the container works on the WSL Ubuntu command line using the credentials from your .env
file.
To connect to MySQL using the .env
credentials you provided (DB_USER=user
, DB_PASSWORD=password
), follow these steps:
Run the following in PowerShell or Command Prompt:
wsl
Inside Ubuntu, check if MySQL is running in Docker:
docker ps
Look for the CONTAINER ID of the MySQL container.
Now, use the CONTAINER ID to execute MySQL:
sudo docker exec -it <CONTAINER_ID> mysql -u user -p
Replace <CONTAINER_ID>
with the actual ID from docker ps
. When prompted, enter the password (password
from .env
).
Once inside MySQL, check if the database exists:
SHOW DATABASES;
To use a specific database:
USE your_database_name;
SHOW TABLES;
To exit the MySQL shell, type:
EXIT;
- If the container is not running, start it:
docker start <CONTAINER_ID>
- If you donβt see the container in
docker ps
, check all containers:docker ps -a
- If MySQL is not installed in Docker, check the logs:
docker logs <CONTAINER_ID>
This ensures that MySQL is running correctly within the Docker container on WSL! π
Now you have Docker installed with WSL 2 support. You can run Linux-based Docker containers efficiently on Windows! π