A high-performance, server-rendered Next.js App Router B2B ecommerce application with dual authentication system.
This application connects to the Imagination Media B2B ordering middleware API and provides separate login interfaces for sales representatives and customers. Built with React Server Components, Server Actions, Suspense
, Apollo Client, and modern authentication patterns.
- Sales Representative Login: Full access to sales dashboard with customer management, orders, quotes, and more
- Customer Login: Coming soon - dedicated customer portal for order management and account access
- Protected Routes: Automatic redirection based on user type and authentication status
- JWT Token Management: Secure authentication with automatic token validation and refresh
- Customer management and company oversight
- Order tracking and management
- Quote generation and management
- Cart and wishlist oversight
- Responsive design with mobile-friendly navigation
- GraphQL API: Connects to Imagination Media B2B ordering middleware
- Apollo Client: Robust GraphQL client with caching and error handling
- Real-time Updates: Automatic data synchronization with backend systems
- Next.js 15: Latest App Router with React Server Components
- TypeScript: Full type safety throughout the application
- Tailwind CSS: Utility-first styling with responsive design
- Server Actions: Optimized server-side operations
- Node.js 18+
- npm or pnpm package manager
- Access to the B2B ordering middleware API
- Copy the environment variables from
.env.example
to.env.local
:
cp .env.example .env.local
- Configure the required environment variables in
.env.local
:
COMPANY_NAME="Your Company Name"
SITE_NAME="B2B Ordering Storefront"
NEXT_PUBLIC_API_URL="https://b2bapp-api.imdigital.com/graphql"
Note: You should not commit your
.env.local
file as it may contain sensitive configuration.
- Install dependencies:
npm install
# or
pnpm install
- Run the development server:
npm run dev
# or
pnpm dev
- Open http://localhost:3000 in your browser.
- Navigate to
/login/sales-rep
- Enter your sales representative credentials
- Access the sales dashboard at
/dashboard
- Navigate to
/login/customer
- Currently shows "Coming Soon" - customer authentication will be available soon
- Sign up for notifications when customer portal is ready
npm run dev
- Start development servernpm run build
- Build for productionnpm run start
- Start production servernpm run lint
- Run ESLintnpm run prettier:check
- Check code formatting
This application connects to the Imagination Media B2B ordering middleware API using GraphQL. The API provides:
- Sales representative authentication
- Customer and company management
- Order and quote processing
- Cart and wishlist functionality
- Product catalog access
The default API endpoint is configured to use the demo environment:
https://b2bapp-api.imdigital.com/graphql
For production deployments, update the NEXT_PUBLIC_API_URL
environment variable to point to your production API endpoint.
This application can be deployed to any platform that supports Next.js applications:
- Vercel: Recommended for seamless deployment with automatic builds
- Netlify: Alternative hosting with similar features
- Docker: Containerized deployment for custom infrastructure
Make sure to configure the environment variables in your deployment platform to match your production API endpoints.