saas
Built on fullstackStart a logged-in product on its own API: sign-in, a guarded shell, a projects CRUD, analytics.
site: webssrapi: serverkitr new my-app --kit saasStart the app kit with a server-rendered site, an API server, actions and realtime channels.
For: Anyone building an app and its own backend together, in one project and one language.
kitr new my-app --kit fullstackFirst time? Run npm i -g @kitr/kitr once. Inside a project, the global kitr runs your project's own version.
kitr startThe dashboard kit with SSR, so the first paint has the data and search engines see it.
server/routes.ts serves typed routes to the app and to any other client, with an OpenAPI file.
Functions in app/actions/ run on the server and are called like local functions.
A realtime channel in app/channels/ pushes changes to every open screen.
Read from the kit's output in the kitr repository, so it matches what kitr new writes today. 18 packages · 11 components · 56 files.
Start with server/routes.ts. Pick any file to read it.
import { defineRoutes } from '@kitr/kitr/app'
import api from '@kitr/api/routes'
import realtime from '@kitr/realtime/routes'
import HealthController from '#server/controllers/health-controller'
import { exampleChannel } from '#app/channels/example'
/**
* Endpoints and sockets of this app. `kitr add` keeps the extension list current; `createServer({ routes })`
* in server/main.ts serves it.
*/
export const routes = defineRoutes([api, realtime], (root) =>
root.group('/api', (r) =>
r.get('/health', [HealthController, 'show'], { name: 'health' }),
// r.resource('projects', () => import('#server/controllers/projects-controller'))
)
.ws('/api/ws', { channels: [exampleChannel] /* , authorize: (request) => ... */ }),
)
/** Pass to createApiClient<ServerRoutes>() on the client. */
export type ServerRoutes = typeof routes.$typesThe same base with a small working app on top, to read or to keep.
Start a logged-in product on its own API: sign-in, a guarded shell, a projects CRUD, analytics.
site: webssrapi: serverkitr new my-app --kit saasStart a marketing site: server-rendered, prerendered, SEO heads, i18n, a blog and a newsletter form.
site: webssrapi: serverkitr new my-app --kit siteStart a chat room: typed WebSocket channels that feed the query cache, rooms in the URL.
site: webssrapi: serverkitr new my-app --kit realtime