Skip to content
/ kosmo Public

Structured Vite template for type-safe full-stack apps. Multiple source folders. Directory-based routing. Nested layouts. Runtime validation. Generated fetch clients. Multiple frameworks.

Notifications You must be signed in to change notification settings

kosmojs/kosmo

Repository files navigation

KosmoJS

Structured Vite template for type-safe full-stack apps

Structured Vite template for type-safe full-stack apps. Multiple source folders. Directory-based routing. Nested layouts. Runtime validation. Generated fetch clients. Multiple frameworks.

📘 Documentation → kosmojs.dev


🎯 What is KosmoJS?

It's a structured Vite template that gives your Vite project a scalable shape:

  • Multiple source folders for distinct areas (website, admin dashboard, API).
  • Each folder splits into api/ and pages/, creating a clean boundary between server and client.
  • Generators that produce validation schemas, fetch clients, and OpenAPI specs from your types.

📘 Learn more


🚀 Getting Started

1. Create a new KosmoJS project:

pnpm dlx kosmojs app # or any name for your project
# or `npx kosmojs app` / `yarn dlx kosmojs app`

After the project is created, navigate to your app directory:

cd ./app

All subsequent operations run from inside this directory.

2. Install dependencies

Use your favorite package manager:

pnpm install
# or `npm install` / `yarn install`

3. Create a source folder

pnpm +folder
# or `npm run +folder` / `yarn +folder`

The source folder may have added new dependencies. Run the package manager again:

pnpm install
# or `npm install` / `yarn install`

4. Start the dev server

pnpm dev
# or `npm run dev` / `yarn dev`

Each source folder runs on its own port with its own base URL.

📘 Learn more


✨ Features

  • 🗂️ Multiple Source Folders
    Organize distinct concerns - public site, customer app, admin dashboard - all connected in one Vite project.

  • 🛣️ Directory-Based Routing
    Your folder structure defines your routes. Works identically for both API endpoints and client pages

  • 🛡️ End-to-End Type Safety
    Write TypeScript types once, get runtime validation automatically. No separate schemas to maintain.

  • 🔗 Generated Fetch Clients + OpenAPI spec
    Fully-typed fetch clients with client-side validation. Invalid requests never reach your server.

  • 🎨 Multiple Frameworks
    Currently supports SolidJS, React and Vue. Additional frameworks may be added based on community interest.

  • 🔧 Built on Proven Tools
    Koa for APIs, Vite for frontend, TypeScript for safety. No proprietary abstractions.

📘 Learn more


🧭 Example Use Cases

  • Monorepo-like projects where frontend and API must live side by side.
  • Teams needing strong typing and runtime validation without duplicating schemas.
  • Developers who want framework freedom while keeping consistent structure.
  • Projects that must scale from prototype → production with a deterministic structure.

🛠️ Contributing

Contributions are welcome! Check out the issues and submit PRs. Please follow the project's coding style and include tests when possible.


📄 License

MIT © Slee Woo

About

Structured Vite template for type-safe full-stack apps. Multiple source folders. Directory-based routing. Nested layouts. Runtime validation. Generated fetch clients. Multiple frameworks.

Topics

Resources

Stars

Watchers

Forks