chore: scaffold turbo monorepo with hono api and react admin web

This commit is contained in:
Jose Selesan
2026-10-15 15:24:34 -03:00
commit 2b1d2152c4
89 changed files with 4996 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
import { Hono } from 'hono'
import { resultJson } from '@/lib/result-json'
import type { AppEnv } from '@/types'
import { GetStatus } from './use-case'
/** GET /health — liveness probe. */
export const getStatusRoute = new Hono<AppEnv>()
getStatusRoute.get('/', (c) => resultJson(c, new GetStatus().execute()))

View File

@@ -0,0 +1,18 @@
import { describe, expect, it } from 'bun:test'
import { GetStatus } from './use-case'
describe('GetStatus', () => {
it('reports ok with the current uptime and timestamp', () => {
const now = new Date('2026-01-01T00:00:00.000Z')
const result = new GetStatus(() => now).execute()
expect(result.ok).toBe(true)
if (!result.ok) throw new Error('expected the use case to succeed')
expect(result.value).toEqual({
status: 'ok',
uptimeSeconds: expect.any(Number),
timestamp: '2026-01-01T00:00:00.000Z',
})
})
})

View File

@@ -0,0 +1,23 @@
import { Ok, type Result, type ProblemDetails } from '@superlist/shared'
export type HealthStatus = {
status: 'ok'
uptimeSeconds: number
timestamp: string
}
/**
* Returns the liveness status of the process.
* No dependencies and no failure mode: it must always succeed.
*/
export class GetStatus {
constructor(private readonly now: () => Date = () => new Date()) {}
execute(): Result<HealthStatus, ProblemDetails> {
return Ok({
status: 'ok',
uptimeSeconds: Math.round(process.uptime()),
timestamp: this.now().toISOString(),
})
}
}

View File

@@ -0,0 +1,8 @@
import { Hono } from 'hono'
import type { AppEnv } from '@/types'
import { getStatusRoute } from './get-status/route'
/** `health` module: every feature of the module is mounted here. */
export const healthModule = new Hono<AppEnv>().route('/', getStatusRoute)