Microservice starter using Hono framework and Vine.js validator and Knex.js database driver and Objection.js as ORM.
To install dependencies:
bun install
Then copy .env.example
to .env
cp .env.example .env
Note: You need to copy oauth-private.key and oauth-public.key to src/storage
, this is used to sign and verify JWT.
To run:
bun dev
To run commands:
bun shin
$ bun scripts/index.ts
Available Commands:
make:controller Create a new controller class
make:middleware Create a new middleware class
make:model Create a new Eloquent model class
make:request Create a new form request class
make:resource Create a new resource
To make a new controller:
bun shin make:controller UserController
To make a compiled file:
Note: .env must be set first before compiling, if any change in src/
you will need to run bun compile
again
bun compile AppName
├── src // Root Directory
│ ├── app // Application Directory
│ │ ├── Controllers // Controller Directory
│ │ │ ├── index.ts // All Controller export here. auto export using command
│ │ │ └── UserController.ts
│ │ ├── Middleware // Middleware Directory
│ │ │ ├── index.ts // All Middleware export here. auto export using command
│ │ │ └── AuthMiddleware.ts
│ │ │ └── InitMiddleware.ts
│ │ ├── Models // Model Directory
│ │ │ └── index.ts // All Model export here. auto export using command
│ │ │ └── User.ts
│ │ ├── Requests // Request Directory
│ │ │ └── index.ts // All Request export here. auto export using command
│ │ │ └── UserRequest.ts
│ │ ├── Resources // Resource Directory
│ │ │ └── index.ts // All Resource export here. auto export using command
│ │ │ └── BaseResource.ts // Base Resource Class. use for all resource class to parse data
│ │ │ └── UserResource.ts
│ │ └── Services // Service Directory
│ │ │ └── index.ts // All Service export here no command to make services
│ │ └── Types // Types Directory. All Interface is here
│ │
│ └── config // Configuration Directory
│ │ └── database.ts // Database Configuration. use for knex and objection setting
│ │ └── index.ts // All Configuration export here
│ │ └── ErrorHandler.ts // Error Handler. use for exception error handling
│ │ └── RateLimiter.ts // Rate Limiter. use for rate limiting
│ │
│ └── Lang // Language Directory
│ │ └── index.ts // This is use for translation eg: t("Hi :name, Welcome back", {name: "Hono"})
│ │ └── messages.ts // This is library for translation
│ │ └── validation.ts // This is library for validation
│ │
│ └── routes // Routing Directory
│ │ └── index.ts // All Route export here
│ │ └── api // API Route Directory
│ │ └── index.ts // All API Route export here
│ │
│ └── storage // Storage Directory
│ │ └── database-config.json // Database Configuration. use for knex and objection connections
│ │ └── oauth-private.key
│ │ └── oauth-public.key
│ │
│ └── utils // Utility Directory
│ └── index.ts // All Utility export here
│ └── Mail.ts // Mail Utility. use for sending email
For more information about Hono see docs
For more information about Objection.js see docs
For more information about Vine.js see docs
For more details, see CONTRIBUTING.md
Distributed under the MIT License.