@kevinmarrec/create-app 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +4 -0
  2. package/dist/index.js +1 -1
  3. package/package.json +14 -16
  4. package/template/.docker/traefik/bin/install_cert +18 -0
  5. package/template/.docker/traefik/bin/uninstall_cert +9 -0
  6. package/template/.docker/traefik/dynamic/tls.yml +4 -0
  7. package/template/.github/scripts/build-stats.md.ts +71 -0
  8. package/template/.github/workflows/ci.yml +16 -0
  9. package/template/.gitignore +2 -0
  10. package/template/.npmrc +0 -1
  11. package/template/.vscode/settings.json +1 -1
  12. package/template/README.md +330 -0
  13. package/template/api/.env.development +4 -0
  14. package/template/{server → api}/package.json +8 -7
  15. package/template/{server → api}/src/auth/index.ts +4 -1
  16. package/template/{server → api}/src/database/drizzle/config.ts +3 -2
  17. package/template/{server → api}/src/database/index.ts +6 -4
  18. package/template/api/src/env.ts +67 -0
  19. package/template/api/src/main.ts +39 -0
  20. package/template/{server → api}/src/orpc/context.ts +4 -3
  21. package/template/api/src/orpc/index.ts +27 -0
  22. package/template/{server → api}/src/orpc/middlewares/auth.ts +2 -1
  23. package/template/api/src/orpc/plugins/error.ts +17 -0
  24. package/template/{server → api}/src/orpc/router/index.ts +13 -1
  25. package/template/{server → api}/src/utils/cors.ts +8 -5
  26. package/template/{server → api}/src/utils/logger.ts +3 -1
  27. package/template/app/.env +1 -0
  28. package/template/{client → app}/index.html +1 -0
  29. package/template/{client → app}/package.json +9 -10
  30. package/template/{client → app}/src/App.vue +2 -1
  31. package/template/{client → app}/src/composables/content.ts +2 -1
  32. package/template/{client → app}/src/lib/orpc.ts +3 -1
  33. package/template/{client → app}/src/main.ts +1 -1
  34. package/template/{client → app}/vite.config.ts +1 -1
  35. package/template/compose.yaml +120 -12
  36. package/template/knip.config.ts +8 -10
  37. package/template/package.json +12 -11
  38. package/template/tsconfig.json +2 -2
  39. package/template/.scripts/dev.ts +0 -8
  40. package/template/client/.env +0 -1
  41. package/template/server/.env.development +0 -4
  42. package/template/server/src/env.d.ts +0 -11
  43. package/template/server/src/main.ts +0 -51
  44. package/template/server/src/orpc/handler.ts +0 -34
  45. package/template/server/src/orpc/index.ts +0 -18
  46. package/template/server/src/orpc/middlewares/index.ts +0 -1
  47. /package/template/{server → api}/src/database/migrations/0000_init.sql +0 -0
  48. /package/template/{server → api}/src/database/migrations/meta/0000_snapshot.json +0 -0
  49. /package/template/{server → api}/src/database/migrations/meta/_journal.json +0 -0
  50. /package/template/{server → api}/src/database/schema/accounts.ts +0 -0
  51. /package/template/{server → api}/src/database/schema/index.ts +0 -0
  52. /package/template/{server → api}/src/database/schema/sessions.ts +0 -0
  53. /package/template/{server → api}/src/database/schema/users.ts +0 -0
  54. /package/template/{server → api}/src/database/schema/verifications.ts +0 -0
  55. /package/template/{server → api}/tsconfig.json +0 -0
  56. /package/template/{client → app}/public/favicon.svg +0 -0
  57. /package/template/{client → app}/public/robots.txt +0 -0
  58. /package/template/{client → app}/src/components/.gitkeep +0 -0
  59. /package/template/{client → app}/src/composables/auth.ts +0 -0
  60. /package/template/{client → app}/src/composables/index.ts +0 -0
  61. /package/template/{client → app}/src/env.d.ts +0 -0
  62. /package/template/{client → app}/src/locales/en.yml +0 -0
  63. /package/template/{client → app}/src/locales/fr.yml +0 -0
  64. /package/template/{client → app}/tsconfig.json +0 -0
  65. /package/template/{client → app}/uno.config.ts +0 -0
  66. /package/template/{client → app}/wrangler.json +0 -0
@@ -1,51 +0,0 @@
1
- import process from 'node:process'
2
-
3
- import { createBetterAuth } from '@server/auth'
4
- import { db } from '@server/database'
5
- import { createRpcHandler } from '@server/orpc'
6
- import { router } from '@server/orpc/router'
7
- import { cors } from '@server/utils/cors'
8
- import { logger } from '@server/utils/logger'
9
-
10
- const auth = createBetterAuth({ db, logger })
11
- const rpcHandler = createRpcHandler(router)
12
-
13
- const routes = {
14
- '/auth/*': cors(async (req) => {
15
- return await auth.handler(req)
16
- }),
17
- '/rpc/*': cors(async (req) => {
18
- const { matched, response } = await rpcHandler.handle(req, {
19
- prefix: '/rpc',
20
- context: { auth, db, logger },
21
- })
22
-
23
- if (matched)
24
- return response
25
-
26
- return new Response('Not found', { status: 404 })
27
- }),
28
- }
29
-
30
- const server = Bun.serve({
31
- hostname: import.meta.env.HOST ?? '0.0.0.0',
32
- port: import.meta.env.PORT ?? 4000,
33
- routes,
34
- error(error) {
35
- logger.error(error)
36
- return new Response('Internal Server Error', { status: 500 })
37
- },
38
- })
39
-
40
- logger.info(`Listening on ${server.url}`)
41
-
42
- // Graceful Shutdown
43
-
44
- async function gracefulShutdown() {
45
- logger.info('Gracefully shutting down...')
46
- await server.stop()
47
- process.exit(0)
48
- }
49
-
50
- process.on('SIGINT', gracefulShutdown)
51
- process.on('SIGTERM', gracefulShutdown)
@@ -1,34 +0,0 @@
1
- import { onError, ORPCError, type Router } from '@orpc/server'
2
- import { RPCHandler } from '@orpc/server/fetch'
3
- import {
4
- RequestHeadersPlugin,
5
- ResponseHeadersPlugin,
6
- } from '@orpc/server/plugins'
7
- import { APIError } from 'better-auth/api'
8
-
9
- import type { Context } from './context'
10
-
11
- export function createRpcHandler<T extends Context>(router: Router<any, T>) {
12
- return new RPCHandler<T>(router, {
13
- plugins: [
14
- new RequestHeadersPlugin(),
15
- new ResponseHeadersPlugin(),
16
- ],
17
- clientInterceptors: [
18
- onError((error, { context }) => {
19
- if (error instanceof APIError) {
20
- throw new ORPCError(error.body?.code ?? 'INTERNAL_SERVER_ERROR', {
21
- status: error.statusCode,
22
- message: error.body?.message,
23
- })
24
- }
25
-
26
- if (error instanceof ORPCError) {
27
- throw error
28
- }
29
-
30
- context.logger.error(error)
31
- }),
32
- ],
33
- })
34
- }
@@ -1,18 +0,0 @@
1
- import { os } from '@orpc/server'
2
- import { authMiddleware } from '@server/orpc/middlewares'
3
-
4
- import type { Context } from './context'
5
-
6
- export { createRpcHandler } from './handler'
7
-
8
- export type { Context }
9
-
10
- export const pub = os
11
- .$context<Context>()
12
- .errors({
13
- UNAUTHORIZED: { status: 401 },
14
- })
15
-
16
- /** @beta */
17
- export const authed = pub
18
- .use(authMiddleware)
@@ -1 +0,0 @@
1
- export * from './auth'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes