Easily integrates elysia with nuxt, now supporting @nuxt/devtools and @elysiajs/eden!
Demo
demo.mp4
- install packages
# currently only supports Bun
bun add elysiajs-nuxt
bun add nuxt elysia --dev
- configure nuxt.config.ts
// src-client/nuxt.config.ts
export default defineNuxtConfig({
// mandatory configuration!
nitro: { preset: import.meta.resolveSync('elysiajs-nuxt/preset') },
// mandatory configuration!
vite: { server: { origin: 'localhost:3000' } }
})
- use elysiajs-nuxt as a plugin
// src-server/index.ts
import { Elysia } from 'elysia'
import elysiaNuxt from 'elysiajs-nuxt'
new Elysia().use(elysiaNuxt).listen(5566)
- simultaneously start dev servers, both client(nuxt) and server(elysia)
# server
bun run --watch src-server
# client
bun --bun nuxt dev src-client/index.ts
- compile the Client
bun --bun nuxt build src-client
- start the Server
# mandatory configuration!
NODE_ENV=production bun run src-server/index.ts