A shift scheduling and management application built with Next.js and PostgreSQL.
- Node.js (v18 or later)
- PostgreSQL (v12 or later)
- pnpm (recommended) or npm/yarn
-
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
-
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"
-
Run database migrations:
pnpm db:migrate
First, run the development server:
pnpm dev
# or
npm run dev
# or
yarn dev
# or
bun devOpen http://localhost:3000 with your browser to see the result.
The test suite uses Vitest with PostgreSQL for database-backed tests.
# Run all tests
pnpm test
# Run tests in watch mode
pnpm test --watch
# Run tests with coverage
pnpm test --coverageTests 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.
app/- Next.js app directoryapp/lib/repositories/- Database repository layerapp/__tests__/- Test filesmigrations/- Database schema migrationsscripts/- Utility scripts including migration runner
pnpm dev- Start development serverpnpm build- Build for productionpnpm start- Start production serverpnpm test- Run test suitepnpm lint- Run ESLintpnpm db:migrate- Run database migrations
To learn more about Next.js, take a look at following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
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.