🚀 Welcome to HonoJS REST API Template 🚀
🛠️ Minimal Setup, Maximum Power
⚙️ Middleware Magic
🔐 JWT token Authentication
📚 Swagger UI and openapi documentation (with auto generate code for the frontend)
✅ Route validation with zod
🧪 Testing with jest
🦋 Beautiful code with eslint and prettier
Create a new project
npx degit https://github.com/TheSmartMonkey/create-hono-cloudflare-workers-rest-api backendCreate a wrangler.toml based on wrangler.default.toml
Install dependancies
bun iStart coding 🧑💻
bun startDeploy to cloudflare 🚀
bun run deploySwagger UI 📚 : http://127.0.0.1:8787/public/api
You can add the JWT token in the Authorize button in the top right corner
Exemple token with secret 1234 :
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJmYWtlVXNlcklkIiwiZW1haWwiOiJmYWtlRW1haWwiLCJpYXQiOjE3NDAyMjUwODh9.PcHnkcIxknYZbaR7G4R0KaYAWAKeaHJ5cZYIUIPSYRAEncode a JWT token: JWT Encoder/Decoder
Edit openapitools.json config to specify the code generation (typescript-angular, typescript-fetch, etc)
Then run this command to generate the code
bun run genapiYou should have the generated code in dist/api
Test you code 🧪
bun run testRun unit tests 🧪 Test individual components or functions
bun run unitRun integration tests 🧪 Test your code with external dependencies like databases, APIs, etc
bun run integrationTests are grouped using Jest's @group annotation:
/**
* @group unit
*//**
* @group integration
*/This helps in organizing and running specific groups of tests
Fix you code to make it Beautiful 🦋
bun run fixFor more commands:
bun runHappy coding! 🎉