This app is made of 3 sub-apps:
- users, a module that offers a Svelte component
UserList.svelte
and an API/api/users.json
- messages, a module that offers a Svelte component
Chat.svelte
and an API/api/messages.json
; it depends on users' library - app, the main SvelteKit app, that offers an entrypoint
/
and uses the two other modules
- Dependencies are managed by pnpm with the Workspace feature
- All modules are built with adapter-node (with #3362 merged)
- They are loaded dynamically as vite middlewares
vite: { plugins: [loadModules('@gauben/users', '@gauben/messages')], },
You'll need to clone gauben/kit:
git clone https://github.com/GauBen/kit
cd kit
pnpm install
pnpm build
cd ..
You'll also need to clone this very repo:
git clone https://github.com/GauBen/modularized-sveltekit-app
cd modularized-sveltekit-app
pnpm install
# Link gauben/kit
cd app && pnpm link ../kit/packages/adapter-node && cd ..
cd messages && pnpm link ../kit/packages/adapter-node && cd ..
cd users && pnpm link ../kit/packages/adapter-node && cd ..
pnpm dev
# ✨
Even server-side rendering works!
- Type declarations