A modern, interactive dashboard built with Next.js 15, featuring multiple data visualization components and real-time data fetching capabilities.
- 🔐 Secure authentication system
- 📊 Interactive data visualizations using Recharts
- 🎯 Multiple data sources integration (REST APIs & SQL Database)
- 💅 Modern UI with Tailwind CSS and shadcn/ui
- 🔄 Real-time data updates with TanStack Query
- 🗃️ Supabase database integration
- Framework: Next.js 15
- Styling: Tailwind CSS
- UI Components: shadcn/ui
- Charts: Recharts
- Icons: Lucide React
- State Management: TanStack Query
- Database: Supabase
- Data Fetching: Server Actions
- Node.js 18+ installed
- npm or yarn package manager
- Supabase account
- Active internet connection for API access
-
Clone the repository
git clone 'https://github.com/dontforgetsemicologne/salesway' cd salesway
-
Install dependencies
npm install # or yarn install -
Set up environment variables Create a
.env.localfile in the root directory:NEXT_PUBLIC_API_BASE_URL=http://3.111.196.92:8020 NEXT_PUBLIC_SUPABASE_URL=your_supabase_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_key
-
Run the development server
npm run dev # or yarn dev
├── app/
│ ├── (auth)/
│ │ └── page.tsx
│ ├── dashboard/
│ │ └── page.tsx
│ └── layout.tsx
├── components/
│ └── ui/
├── lib/
├── hooks/
└── utils/
The application includes a custom login page with the following credentials:
- Username:
trial - Password:
assignment123
-
Component 1
- Data Source: REST API
- Endpoint:
api/v1/sample_assignment_api_1/ - Authentication Required: Yes
-
Component 2
- Data Source: SQL Database (Supabase)
- Table:
2
-
Component 3
- Data Source: REST API
- Endpoint:
api/v1/sample_assignment_api_3/ - Authentication Required: Yes
-
Component 4
- Data Source: SQL Database (Supabase)
- Table:
4
-
Component 5
- Data Source: REST API
- Endpoint:
api/v1/sample_assignment_api_5/ - Authentication Required: Yes
-
Component 6
- Data Source: SQL Database (Supabase)
- Table:
6
// Example of a server action
async function fetchAPI(endpoint: string) {
const response = await fetch(`${process.env.API_URL}/${endpoint}`, {
method: 'GET',
headers: {
Authorization: `Basic ${btoa(`${process.env.AUTH_USERNAME}:${process.env.AUTH_PASSWORD}`)}`
},
cache: 'no-cache',
});
if(!response.ok) {
throw new Error('Failed to fetch data');
}
return response.json();
}
export async function fetchComponentData(componentId: number) {
const endpoints = `api/v1/sample_assignment_api_${componentId}`;
if(!endpoints) throw new Error('Invalid component ID');
return fetchAPI(endpoints);
}// Example of TanStack Query usage
const { data, isLoading, error } = useQuery({
queryKey: ['component', id],
queryFn: () => fetchComponentData(id),
enabled: isLoggedIn,
});- Using Tailwind CSS utility classes
- shadcn/ui components for consistent UI
- Responsive design patterns
- Dark mode support
Swagger documentation is available for testing the APIs. Make sure to include the authentication headers:
headers: {
'Authorization': 'Basic ' + btoa('trial:assignment123')
}- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE.md file for details
- Next.js team for the amazing framework
- Tailwind CSS for the utility-first CSS framework
- shadcn/ui for the beautiful components
- Recharts for the charting library
- Supabase for the backend services