Skip to main content

Installation

Prerequisites​

  • Node.js — see .nvmrc for the required version (use nvm use to switch)
  • Yarn — package manager (do not use npm or pnpm)
  • Docker & Docker Compose — for PostgreSQL and Mailcatcher
  • Git

Step-by-Step Setup​

1. Clone the repository​

git clone https://github.com/Bitnoise/dutyduke.git
cd dutyduke

2. Install dependencies​

yarn install

3. Configure environment​

cp .env.dist .env

Edit .env and set the required values:

  • PRISMA_FIELD_ENCRYPTION_KEY — generate at https://cloak.47ng.com/ (click "New key")
  • JWT_SECRET — generate with:
    node -e "console.log(require('crypto').randomBytes(128).toString('hex'))"

See Configuration for all environment variables.

4. Start services​

docker compose up -d

This starts:

  • PostgreSQL (port 5432) with PostGIS extension
  • Mailcatcher (SMTP on port 1025, UI on port 1080)

Verify services are running:

docker compose ps

5. Setup database​

Generate the Prisma client:

yarn prisma:generate

Run migrations (when prompted, name the migration e.g. "init"):

yarn prisma:migrate

Seed the database with the default organization and OWNER role:

yarn prisma:seed

6. Create your admin account​

yarn create:owner admin@example.com YourPassword123 John Doe

This creates an identity with the OWNER role and full system permissions.

7. Create your organization​

yarn organization:create "My Company"

8. Start the development server​

yarn dev

Open http://localhost:3000 and sign in with your admin credentials.

Verify Installation​

After starting, you should be able to:

  1. Access the sign-in page at http://localhost:3000
  2. Sign in with the admin account you created
  3. See the dashboard with employee management, company settings, etc.
  4. Access Mailcatcher at http://localhost:1080 to view sent emails

Troubleshooting​

Database connection issues​

# Check if services are running
docker compose ps

# View database logs
docker compose logs postgres

# Test connection manually
psql postgresql://dutyduke:password@localhost:5432/dutyduke

Reset database​

# Reset via Prisma (deletes all data, re-applies migrations)
yarn prisma:reset

# Or full reset (removes Docker volume)
docker compose down -v
docker compose up -d
yarn prisma:migrate
yarn prisma:seed

Clean install​

If you have dependency or build cache issues:

yarn nuke

This removes node_modules, .next, clears the Yarn cache, and reinstalls everything.