Skip to content

Commit

Permalink
feat: migrate from fastify to hono (#37)
Browse files Browse the repository at this point in the history
* chore: upgrade packages

* feat: create a basic hono server

* chore: cleanup

* build: get the build working

* chore: organize the package.json

* feat: getting all logs without authentication

* feat: get all logs with authentication

* feat: create log for authenticated req

* feat: add health check

* feat: middleware 🎉

* feat: deleting logs

* refactor: match consistency

* feat: get services for admin

* feat: create a service

* feat: get service by id

* feat: disable service

* feat: enable service

* fix: compat for the authentication header name

* feat: move the routers into their own folder

* feat: api documentation

* feat: cors

* style: ordering

* feat: coerce numbers for search params

* feat: update documentation

* feat: use yaml

* feat: restore readme

* chore: update readme

* feat: update the openapi transformer

* feat: handle dirs not existing
  • Loading branch information
SeanCassiere authored Jun 23, 2024
1 parent e7d4995 commit ee4b688
Show file tree
Hide file tree
Showing 37 changed files with 5,795 additions and 1,676 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,6 @@ dist
.pnp.*

#
.DS_Store
.DS_Store
ignore/
public/static/openapi.v*
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enable-pre-post-scripts=true
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ This is a dead simple log server that allows you to log messages to a persisted
## Development

1. Clone the repository.
2. Install dependencies `npm install`.
2. Install dependencies `pnpm install`.
3. Create a `.env` file and add the necessary `secrets` into it. You can use the `.env.example` file as a reference.
4. Run the development server using `npm run dev`. If you haven't run an init on your database, run `npm run db:push`.
4. Run the development server using `pnpm run dev`. If you haven't run an init on your database, run `pnpm run db:push`.

## Usage

Expand All @@ -17,7 +17,7 @@ OpenAPI 3 specification with Swagger explorer is available at `/docs`.

To make any logs into the database, you'll need a valid service account which is active. These account should be regulated by yourself, and should not generated by the public.

You can use the `npm run db:explorer` to view the database, and create a service.
You can use the `pnpm run db:explorer` to view the database, and create a service.

### Endpoints

Expand Down
38 changes: 20 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"name": "simple-logging-server",
"version": "2.2.0",
"license": "MIT",
"version": "2.3.0",
"description": "This is a simple API for logging messages",
"author": "Sean Cassiere",
"keywords": [],
"private": true,
"main": "dist/index.js",
"packageManager": "[email protected]",
"main": "dist/index.js",
"scripts": {
"lint": "eslint --max-warnings=0 src",
"lint:fix": "eslint --fix --max-warnings=0 src",
Expand All @@ -14,39 +17,38 @@
"test": "vitest --typecheck",
"test:ci": "vitest run --typecheck",
"build:kill-dist": "rimraf ./dist",
"build:code": "tsc",
"build:code": "tsc && tscpaths -p tsconfig.json -s ./src -o ./dist",
"build": "pnpm run build:kill-dist && pnpm run build:code",
"postbuild": "node postbuild.mjs",
"db:explorer": "drizzle-kit studio",
"db:migrate-generate": "drizzle-kit generate:pg",
"db:migrate-run": "tsx ./migrator.ts"
},
"keywords": [],
"author": "Sean Cassiere",
"license": "MIT",
"devDependencies": {
"@types/node": "^20.14.3",
"@types/node": "^20.14.8",
"@typescript-eslint/eslint-plugin": "^6.18.0",
"@typescript-eslint/parser": "^6.18.0",
"drizzle-kit": "^0.22.7",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.2",
"pg": "^8.11.3",
"prettier": "^3.1.1",
"rimraf": "^5.0.5",
"tsx": "^4.15.6",
"typescript": "^5.3.3",
"pg": "^8.12.0",
"prettier": "^3.3.2",
"rimraf": "^5.0.7",
"tscpaths": "^0.0.9",
"tsx": "^4.15.7",
"typescript": "^5.5.2",
"vitest": "^1.6.0"
},
"dependencies": {
"@fastify/rate-limit": "^9.1.0",
"@hono/node-server": "^1.11.4",
"@paralleldrive/cuid2": "^2.2.2",
"dotenv": "^16.3.1",
"@scalar/hono-api-reference": "^0.5.77",
"dotenv": "^16.4.5",
"drizzle-orm": "^0.31.2",
"fastify": "^4.25.2",
"fastify-zod": "^1.4.0",
"hono": "^4.4.7",
"hono-rate-limiter": "^0.3.0",
"postgres": "^3.4.4",
"zod": "^3.22.4",
"zod-to-json-schema": "^3.22.3"
"zod": "^3.23.8"
}
}
Loading

0 comments on commit ee4b688

Please sign in to comment.