Skip to content

Developer Setup

Utsha Basak edited this page Oct 1, 2026 · 2 revisions

Developer Setup

The short path to a running copy. The README has every option and every environment variable.

You need

  • Node.js 24 (or 22.13+). nvm use reads the version from .nvmrc.
  • MongoDB: a local instance or a free Atlas cluster. Docker can provide one.
  • For sign-up codes and password resets: a Gmail account, with an App Password for SMTP.

Option 1: on your machine

git clone https://github.com/UtshaBasak/BookStoreBD.git
cd BookStoreBD
npm install
npm run install:all

cp server/.env.example server/.env
cp client/.env.example client/.env

Fill in server/.env. At minimum you need MONGO and JWT_SECRET (32+ characters; openssl rand -hex 48 makes one), plus SMTP_USER and SMTP_PASS for e-mail. The server checks these at start-up and explains anything missing. For demo data, also set SEED_PASSWORD to a password of your choice.

npm run seed   # demo accounts and books, using your SEED_PASSWORD (optional)
npm run dev    # API and client together
Shop http://localhost:5173
API http://localhost:4000
Health http://localhost:4000/health

To make yourself an administrator, put your e-mail in ADMIN_EMAILS in server/.env and sign in again.

Option 2: Docker

No Node or MongoDB to install. Compose reads its settings from .env:

cp .env.example .env      # set JWT_SECRET and SEED_PASSWORD
docker compose up --build
docker compose run --rm seed

The source is mounted into the containers, so edits reload as usual. The seed creates admin@, seller@ and buyer@bookstorebd.local, all using your SEED_PASSWORD.

Option 3: the published image

The whole shop in one container, as the live site runs it:

docker run -p 4000:4000 \
  -e MONGO="mongodb+srv://<your-cluster>/bookstorebd" \
  -e JWT_SECRET="$(openssl rand -hex 48)" \
  ghcr.io/utshabasak/bookstorebd

It contains no configuration of its own; supply any other setting from server/.env.example the same way.

Everyday commands

Run from the repository root:

Command Does
npm run dev API and client with hot reload
npm test Both test suites
npm run typecheck Type-checks both packages, tests included
npm run lint Lints both packages
npm run build Production build of both
npm run seed -- --reset Empties the database and seeds it again

Vite and tsx only strip types; they do not check them. npm run typecheck is what catches a type error.

Before you open a pull request

CI runs type-checking, lint, both test suites and the build on every push and pull request. Run them locally first:

npm run typecheck && npm run lint && npm test && npm run build

Branch names, commit style and conventions are in CONTRIBUTING.md.

Clone this wiki locally