A Next.js application for tracking order status with PostgreSQL database.
- Node.js (v18 or higher)
- npm or yarn
- PostgreSQL database (or Supabase account)
- Clone the repository
git clone https://github.com/yourusername/order-status-tracker.git
cd order-status-tracker- Install dependencies
npm install
# or
yarn install- Set up environment variables
# Create a .env file in the root directory and add:
DATABASE_URL="your_database_connection_string"- Set up Prisma
# Generate Prisma Client
npx prisma generate
# Push schema to database
npx prisma db push
# (Optional) If you want to view/edit data
npx prisma studio- Run the development server
npm run dev
# or
yarn devOpen http://localhost:3000 with your browser to see the result.
If you need to modify the database connection:
- Update the
DATABASE_URLin your.envfile - Regenerate Prisma client:
npx prisma generate- Push schema changes:
npx prisma db pushThe application uses the following schema:
model Order {
id String @id @default(cuid())
customerName String
address String
status OrderStatus @default(PENDING)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
orderLineItems OrderLineItem[]
}
model OrderLineItem {
id String @id @default(cuid())
productName String
quantity Int
price Float
orderId String
order Order @relation(fields: [orderId], references: [id])
}
enum OrderStatus {
PENDING
PROCESSING
COMPLETED
CANCELLED
}- Create and manage orders
- Track order status
- View order details including line items
- Pagination support
- Real-time status updates