Bun Nookit (BNK) is a comprehensive toolkit for software development, leveraging the power of Bun and TypeScript. With zero third-party dependencies, strong TypeScript inferencing, and a focus on Web API standards, BNK offers a modular, type-safe, and efficient way to build robust applications.
bash <(curl -fsSL https://raw.githubusercontent.com/nookit-dev/bnkit/main/scripts/quickstart.sh)
Visit http://localhost:3000
in your browser and you should see Hello world and
http://localhost:3000/json
for the json
Install in your project:
bun add bnkit
Plugin install example:
bun add @bnk/react
Use any an all Bun Nookit modules - server example with json response (similar to starter project)
index.ts
import { jsonRes, serverFactory } from 'bnkit/server'
import { middleware, type RoutesWithMiddleware } from './middlewares'
const routes = {
'/': {
// parse from request if neeeded
get: (request) => new Response('Hello World!'),
},
'/json': {
get: (request) =>
bnk.server.jsonRes({
message: 'Hello JSON Response!',
}),
},
} satisfies RoutesWithMiddleware
const { start, routes } = bnk.server.serverFactory({
routes,
middleware,
})
// start on default port 3000
start()
Join our Discord Server https://discord.gg/rQyWN7V6, drop in and ask questions, give feedback or just for a chat!
-
Zero Third Paty Dependencies - BNK uses nothin' but Bun
-
Unit Tested - To ensure BNK is reliable, changeable, and upgradeable.
-
TypeSafe with Strong TypeScript type Inferencing - Strong types tell you where things are incorrect, strong type inferrence allows you to utilize the advantages of strong types and not having to deal with too much TypeScript.
-
Modular Everything is built with as little direct dependency on other modules in the repo, however they still work together. Soon I'll be working on a full stack auth package which will utilize everything from server routes, cookies, database(sqlite).
-
Builds on Web APIs Bun itself is built on strong principles of sticking to Web APIs In order to maintain as much comptaibility across various packages, BNK sticks to the fundementals of the webplatform APIs.
Currently Bun Nookit has a React plugin, as well as a hook called useServerState
for connecting to a Bun Nookit websocket server state, a useLocalStorage
hook, and a useClipboard
hook.
Bun Nookit is built upon a robust and flexible architecture using factory functions, taking full advantage of their benefits to offer a streamlined, efficient, and versatile toolkit for your development needs.
-
Encapsulation: Bun Nookit employs factory functions to streamline object creation, concealing the complexity of the process and offering a user-friendly interface. This enables you to utilize module functionalities without delving into the detailed construction logic.
-
Adaptability: Factory functions in Bun Nookit are engineered to return varied object types, dependent on input parameters, ensuring the toolkit can be precisely adapted to meet your project's unique requirements.
-
Code Reusability: Adhering to functional programming principles, Bun Nookit’ factory functions facilitate efficient code management and hasten development through enabling code reusability and composability.
-
Object Initialization: Bun Nookit' factory functions manage complex object initialization, ensuring modules are instantiated with necessary properties or states.
Moreover, Bun Nookit employs factory functions to inject additional context where needed. For example, in the files folder module, a base path can be specified to anchor all operations to a particular directory. In the fetcher’s case, it allows the provision of a TypeSafe interface to the module, enabling type-safe fetch requests throughout your project. It also enhances user experience and usability by providing intellisense for available functions in the module. Although Bun Nookit heavily utilizes factory functions, almost all functions within them can also be used directly.
This version aims to maintain the original meaning while enhancing clarity and grammatical structure. Let me know if further modifications are needed!
Please use at your own risk, this is alpha software and is still very much in the early stages and the APIs are guranteed to change.
I have a few templates for building full stack apps in the works.
- BNK Payments Stack - Use BNKs built in HTMLody and it's CSS engine to create interactive full stack applications with payments and auth preconfigured.
- BNK SSR React With Client Side Hydration with Auth - A Stack that will come preconfigurated with a full stack SSR'd BNK based server plugin. This allows you to take full advantage of the existing React ecosystem.
- Decoupled Client/Server with Auth
Close To Final For V1:
- Server
- SQLite
- UUID
- JWT
- Cookies
- HTMLody/CSS-Engine
- Fetcher
(if you made it this far)
Create typesafe server routes and middleware!
None! Be the first to sponsor BNK :)
Bun Nookit is licensed under the MIT License. Enjoy the freedom to use, modify, and distribute the software under very permissive terms.
Jumpstart your journey to revolutionary software development with Bun Nookit!
Contribute to the docs: