The BENDER
🤖 stack is a bun-based 🔥 BLAZINGLY FAST
🔥 full-stack 100% type-safe
native and web development solution that provides everything
you need to build production-ready
native and web apps. It consists of:
Create a new project
bun create itsyoboieltr/bender-stack
Optionally specify a name for the destination folder. If no destination is specified, the name bender-stack
will be used.
bun create itsyoboieltr/bender-stack my-app
Bun will perform the following steps:
- Download the
template
- Copy all template files into the
destination folder
- Install dependencies with
bun i
. - Initialize a fresh Git repo. Opt out with the
--no-git
flag.
You can start the development server
with:
bun dev
Unless you are running the development server and the app on the same device, you need to set the EXPO_PUBLIC_HOST_URL
environment variable to the public url
of your server. This is required for the app to do API calls, as your computer's localhost
is not accessible from external devices (such as your phone), even if they are on the same network.
EXPO_PUBLIC_HOST_URL="..."
One of the easiest ways to get a public url for your development server is by using ngrok. After installing ngrok
, you can start the development server and expose it to the internet with the following command:
ngrok http 3000
Build for production
by running the following command:
bun run build
Run in production
by running the following command:
bun start
In case your database schema does not match the schema defined by drizzle
, then the database needs to be synchronized. This can be done by running the following command:
bun push
In addition, drizzle studio
can be used to connect to the database and browse, add, delete and update data based on the declared drizzle schema
.
bun studio
Environment variables (.env)
-
PORT
: port that the application runs on. -
EXPO_PUBLIC_HOST_URL
: host URL for the application. -
DATABASE_USER
: database user for Postgres. -
DATABASE_PASSWORD
: database password for Postgres. -
DATABASE_NAME
: database name for Postgres. -
DATABASE_URL
: database connection URL for Postgres. -
DATABASE_BACKUP_PATH
: path where the database backups are stored. -
COMPOSE_PROFILES
: profiles fordocker compose
. Default:development
- In a production setting, you might want to enable backups for the database. This can be done by setting the
COMPOSE_PROFILES
environment variable toproduction
.
- In a production setting, you might want to enable backups for the database. This can be done by setting the
Using the Dockerfile or the docker-compose.yml file, the application can be deployed to any docker host
. The following command will build the docker image
and start the application.
docker compose up -d
To stop the application, run the following command:
docker compose down