Installation
Step-by-step guide to install and set up ZeroStarter.
Overview
This guide will walk you through installing and setting up ZeroStarter on your local machine. You'll learn how to clone the repository, install dependencies, configure environment variables, set up the database, and configure authentication.
Getting Started
Prerequisites
- Bun (v1.3.0 or later)
Installation
-
Clone this template:
bunx gitpick https://github.com/nrjdalal/zerostarter/tree/main cd zerostarterNote: The
mainbranch is the latest stable release. -
Install dependencies:
bun installNote: If the installation fails, try using
bun install --ignore-scripts -
Set up environment variables:
Create a
.envfile in the root directory with the following variables:NODE_ENV=local # -------------------- Server variables -------------------- HONO_APP_URL=http://localhost:4000 HONO_TRUSTED_ORIGINS=http://localhost:3000 # Generate using `openssl rand -base64 32` BETTER_AUTH_SECRET= # Generate at `https://github.com/settings/developers` GITHUB_CLIENT_ID= GITHUB_CLIENT_SECRET= # Generate at `https://console.cloud.google.com/apis/credentials` GOOGLE_CLIENT_ID= GOOGLE_CLIENT_SECRET= # Generate using `bunx pglaunch -k` POSTGRES_URL= # -------------------- Client variables -------------------- NEXT_PUBLIC_APP_URL=http://localhost:3000 NEXT_PUBLIC_API_URL=http://localhost:4000 # Optional: Manage user feedback `https://zerostarter.dev/docs/manage/feedback` NEXT_PUBLIC_USERJOT_URL=
Database Setup
-
Ensure your PostgreSQL server is running.
-
Run the generation:
bun run db:generate -
Run the migration:
bun run db:migrate
Authentication Setup
ZeroStarter comes with some default authentication plugins using Better Auth, you can extend as needed.
GitHub
- Create a GitHub OAuth App at GitHub Developer Settings.
- Set the Homepage URL to
http://localhost:3000. - Set the Authorization callback URL to
http://localhost:3000/api/auth/callback/github. - Copy the Client ID and Client Secret into your
.envfile.
- Create a Google OAuth App in the Google Cloud Console.
- Configure the OAuth consent screen (External).
- Create an OAuth Client ID (Application type: Web).
- Set the Authorized JavaScript origins to
http://localhost:3000. - Set the Authorized redirect URI to
http://localhost:4000/api/auth/callback/google. - Copy the Client ID and Client Secret into your
.envfile.
Running the Application
bun devRunning the Application with Docker Compose
docker compose upAccessing the Application
- Frontend: http://localhost:3000
- Backend: http://localhost:4000