Skip to content

Repository files navigation

ShiftCadence

A shift scheduling and management application built with Next.js and PostgreSQL.

Prerequisites

  • Node.js (v18 or later)
  • PostgreSQL (v12 or later)
  • pnpm (recommended) or npm/yarn

Database Setup

  1. Create databases:

    # Create development database
    createdb shiftcadence_dev
    
    # Create test database (or use the setup script)
    createdb shiftcadence_test
    # OR run the setup script:
    ./scripts/setup-test-db.sh
  2. Set up environment variables:

    # Copy the example environment file
    cp .env.example .env.local
    
    # Edit .env.local with your database connection details:
    DATABASE_URL="postgres://username:password@localhost:5432/shiftcadence_dev"
    EMAIL_PROVIDER_API_KEY="your_email_provider_api_key"
    GOOGLE_CLIENT_ID="your_google_client_id"
    GOOGLE_CLIENT_SECRET="your_google_client_secret"
    NEXTAUTH_URL="http://localhost:3000"
    NEXTAUTH_SECRET="your_nextauth_secret"
  3. Run database migrations:

    pnpm db:migrate

Getting Started

First, run the development server:

pnpm dev
# or
npm run dev
# or
yarn dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

Testing

The test suite uses Vitest with PostgreSQL for database-backed tests.

Running Tests

# Run all tests
pnpm test

# Run tests in watch mode
pnpm test --watch

# Run tests with coverage
pnpm test --coverage

Test Database Setup

Tests automatically use the shiftcadence_test database defined in .env.test. The test setup:

  • Loads environment variables from .env.test
  • Runs database migrations before tests
  • Uses transactions for test isolation
  • Cleans up automatically after each test

The test database is created and maintained separately from development data to ensure test isolation.

Project Structure

  • app/ - Next.js app directory
  • app/lib/repositories/ - Database repository layer
  • app/__tests__/ - Test files
  • migrations/ - Database schema migrations
  • scripts/ - Utility scripts including migration runner

Available Scripts

  • pnpm dev - Start development server
  • pnpm build - Build for production
  • pnpm start - Start production server
  • pnpm test - Run test suite
  • pnpm lint - Run ESLint
  • pnpm db:migrate - Run database migrations

Learn More

To learn more about Next.js, take a look at following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

About

A shift scheduling and management application.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages