This repository is deprecated and no longer actively maintained. It contains outdated code examples or practices that do not align with current MongoDB best practices. While the repository remains accessible for reference purposes, we strongly discourage its use in production environments. Users should be aware that this repository will not receive any further updates, bug fixes, or security patches. This code may expose you to security vulnerabilities, compatibility issues with current MongoDB versions, and potential performance problems. Any implementation based on this repository is at the user's own risk. For up-to-date resources, please refer to the MongoDB Developer Center.
This project sets up a server using JavaScript runtime Bun and MongoDB, using the Hono framework for routing and controllers.
- Bun
- MongoDB instance or MongoDB Atlas account
-
Clone the repository:
git clone <repo-url> cd getting-started-bun-mongodb
-
Install dependencies:
bun install
-
Configure MongoDB:
Create a
.env
file in the root directory with your MongoDB URI and Port:MONGODB_URI=the_mongodb_uri PORT=<port>
-
Start the server:
bun run start
-
Access the server:
Visit
http://localhost:3000
(default port, configurable via.env
).