Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jd-apprentice/jd-bun

πŸ§… Template repository for my bun projects
https://github.com/jd-apprentice/jd-bun

bun template

Last synced: 22 days ago
JSON representation

πŸ§… Template repository for my bun projects

Awesome Lists containing this project

README

        

# πŸ§… Bun template

[![All Contributors](https://img.shields.io/github/all-contributors/jd-apprentice/jd-bun?color=ee8449&style=flat-square)](#contributors)

Sample bun template with Turso DB, eslint, prettier, docker, husky, sonarjs, testing with coverage, and more.

## πŸ“š Features

- βœ… [Turso](https://turso.tech)
- βœ… [Kysely](https://www.kysely.dev/)
- βœ… [Eslint](https://eslint.org/)
- βœ… [eslint-sonarjs](https://github.com/SonarSource/eslint-plugin-sonarjs)
- βœ… [eslint-plugin-security](https://github.com/eslint-community/eslint-plugin-security)
- βœ… [Prettier](https://prettier.io/)
- βœ… [Husky](https://typicode.github.io/husky/)
- βœ… [Esdoc](https://esdoc.org/)
- βœ… [CodeQL](https://codeql.github.com/)
- βœ… [Joi](https://joi.dev/)
- βœ… [Sentry](https://sentry.io/)
- βœ… Jsconfig with checkjs and strict
- βœ… Docker ready
- βœ… Bun ready
- βœ… Bun testing with coverage
- βœ… Path aliases
- βœ… Types

## 🧰 Requirements

- Bun (^1.1.13)
- Docker (optional)

## πŸ’Ύ Instalation

To install BUN, do the following:

```shell
curl -fsSL https://bun.sh/install | bash
```

Now we are going to do a bun create with this template.

Just in case, here are additiona flags for the bun create command:

```shell
--force Overwrite existing files
--no-install Skip installing node_modules & tasks
--no-git Don’t initialize a git repository
--open Start & open in-browser after finish
```

```shell
mkdir your_app
bun create github.com/jd-apprentice/jd-bun your_app
cd your_app
cp .env.example .env
```

Make sure to complete the `.env` file with the following information:

| Variable | Description |
| --- | --- |
| TURSO_URL | Turso url |
| TURSO_DB_TOKEN | Turso db token |

Change the default names with the following script:

```bash
bun run replace
$ bash ./scripts/app_name.sh
Enter the new name: sample
Replacement completed. πŸš€
```

This will replace all `app_name` with `sample` in the project.

### Run with Bun πŸ§…

```bash
make
```

This will build the app with bunjs and execute the binary.

### Run with Docker 🐳

Bun still needs to be installed to build the binary.

1. Prepare the binary

```bash
bun install
bun test (optional)
bun run build
```

2. Build the image manually

Remember to replace `app_name` with the name of your app.

```bash
docker build -f docker/base-x86_64.Dockerfile -t app_bin .
docker build -f docker/app.Dockerfile -t app_name .
docker compose up -d
```

## 🀝 Contribute

- For more information, check the [CONTRIBUTE](./CONTRIBUTE.md) file

## ✨ Contributors

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):



Jonathan Dyallo

πŸ’» ⚠️ πŸ“– 🚧