This example project demonstrates how to build a simple Fibonacci API and a web page that fetches the Fibonacci sequence from this API. The project is built using the Bun runtime, a fast and efficient JavaScript/TypeScript runtime designed for high-performance applications.
One of the standout features of this project is its zero-dependency architecture. There are no external dependencies or initialization steps required to run the entire project. This is made possible by the Bun runtime, which provides native support for server-side operations, file handling, and more, right out of the box.
- Fibonacci API built with TypeScript
- Web page that fetches and displays the Fibonacci sequence
- Server and client code optimized for performance and efficiency
- Utilizes Bun's native file handlers and server capabilities
- Zero external dependencies
- Integrated Bun tests via GitHub Actions workflow
Bun runtime installed on your machine
curl -fsSL https://bun.sh/install | bash
Clone the Repository
git clone https://github.com/skullzarmy/fibonacci-bun-example.git
cd fibonacci-bun-example
bun fib-server.ts
Or if you feel like typing more:
bun run fib-server.ts
This will start the server, and it should be listening for incoming HTTP requests.
Once the server is running, you can navigate to http://localhost:3000 (or whatever port you've configured) in your web browser to see the Fibonacci sequence being printed on the page.
If you want to run your server in watch mode, so that it restarts automatically whenever you make changes to your code, you can use the --watch flag:
bun --watch fib-server.ts
For a detailed explanation of this project, its architecture, and its features, check out the accompanying blog post on So Cal Tech Lab: Peeling Back the Layers: A Comprehensive Look at Bun, the New JavaScript Runtime
While the code is free to use and I'd be thrilled to hear if you find it useful for any projects or learning, please note that this is not a maintained project. Contributions, other than pointing out mistakes or issues, would likely not be integrated and could be a waste of effort.
This project is licensed under the GNU General Public License v3.0 (GPL-3.0). For more information, please see the LICENSE file in the repository or consult the official GPL-3.0 documentation.