For detailed information about the project architecture, patterns, and technical implementation, see TECHNICAL_DOCUMENTATION.MD.
- Install dependencies:
npm install- Start the PostgreSQL database with Docker:
docker-compose up -d- Set up environment variables:
# Copy environment files
cp env.example .env
cp env.test.example .env.testThe .env file should contain your PostgreSQL database URL:
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/tracking_db"- Run database migrations:
npx prisma migrate dev- Start the development server:
npm run devBefore running tests:
The test script automatically switches the Prisma provider from PostgreSQL to SQLite for testing. This is handled by the scripts/switch-prisma-provider.js script.
Running tests:
npm testAfter running tests:
- Switch back to PostgreSQL provider:
npx prisma migrate dev- Then start the development server:
npm run devThe application uses different database providers:
- Development/Production: PostgreSQL
- Testing: SQLite
The provider switching is handled automatically by the test script, but you may need to manually reset it after testing as described above.
npm run dev- Start development servernpm test- Run tests (switches to SQLite provider)npm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLint
docker-compose up -d- Start PostgreSQL database in backgrounddocker-compose down- Stop and remove database containerdocker-compose logs postgres- View database logsdocker-compose restart postgres- Restart database service