A production-ready React application built with Next.js 15 (App Router), React 18, TypeScript, and Ant Design, using Supabase (PostgreSQL) for authentication, database, and storage.
This is a comprehensive management system for gas stations and convenience stores. It provides features for managing departments, products, transactions, file uploads, and todos with a modern, responsive UI.
- Framework: Next.js 15 (App Router)
- Library: React 18 + TypeScript
- UI Library: Ant Design (AntD)
- State Management: TanStack React Query
- Form Management: React Hook Form + Zod
- Platform: Supabase (PostgreSQL)
- Authentication: Supabase Auth (Email/Password)
- Database: PostgreSQL with Row-Level Security (RLS)
- Linting: ESLint
- Package Manager: npm
- Node.js 20+
- npm
- Supabase Account
-
Install dependencies:
npm install
-
Set up environment variables:
Create a
.env.localfile in the root directory and add your Supabase credentials:NEXT_PUBLIC_SUPABASE_URL=your-supabase-project-url NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key SUPABASE_SERVICE_ROLE_KEY=your-supabase-service-role-key
-
Set up Supabase Database:
Create the following tables in your Supabase project:
departments table:
CREATE TABLE departments ( id BIGSERIAL PRIMARY KEY, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, store_id BIGINT NOT NULL, description VARCHAR NOT NULL );
products table:
CREATE TABLE products ( id BIGSERIAL PRIMARY KEY, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, storeId BIGINT NOT NULL, department_id BIGINT NOT NULL, description VARCHAR NOT NULL, price FLOAT4 NOT NULL, ageRestriction BOOLEAN NOT NULL, tax1 BOOLEAN NOT NULL, tax2 BOOLEAN NOT NULL );
transactions table:
CREATE TABLE transactions ( id BIGSERIAL PRIMARY KEY, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, shiftNumber BIGINT NOT NULL, productId BIGINT NOT NULL, productDescription VARCHAR NOT NULL, quantity INT4 NOT NULL, amount FLOAT4 NOT NULL, dateTime TIMESTAMP NOT NULL, isGasTrn BOOLEAN NOT NULL, typeOfGas VARCHAR, volume FLOAT4, pump INT4 );
todos table:
CREATE TABLE todos ( id BIGSERIAL PRIMARY KEY, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, title TEXT NOT NULL, description VARCHAR NOT NULL, status VARCHAR NOT NULL, priority VARCHAR NOT NULL, due_date DATE );
-
Run the development server:
npm run dev
-
Open your browser: Navigate to http://localhost:3000
- β Email/Password Sign In
- β Email/Password Sign Up
- β Protected Routes
- β Session Management
- β Coming Soon placeholder
- Future: KPIs, stats, recent transactions, alerts
- β List all departments with search
- β Pagination support (10/20/50/100 per page)
- β Export to Excel/CSV
- β Delete departments with confirmation
- β Date range filter (default: last month)
- β Add/Edit modal with form validation
- β CRUD operations (Create, Read, Update, Delete)
- β List all products with search
- β Filter by department, tax flags, age restriction
- β Pagination support
- β Export to Excel/CSV
- β CRUD operations with modal forms
- β Visual tags for boolean fields (Yes/No)
- β Two tabs: Merchandise & Fuel Sales
- β Date range filter (default: last month)
- β Pagination support
- β Export to Excel with custom filenames
- β Different columns for fuel (pump, volume, gas type)
- β Read-only view (no CRUD for transactions)
- β Process Departments.JSON files
- β Process SKUs.json files (store_id based)
- β Process transaction files (#shiftId.JSON format)
- β Real-time upload status with progress
- β Validation and error handling
- β Detailed error messages
- β Tabbed interface for different file types
- β Drag & drop file upload
- β CRUD operations for tasks
- β Search and filters (status, priority)
- β Status tracking (pending, in_progress, completed, archived)
- β Priority levels (low, medium, high)
- β Date range filter on due dates
- β Export functionality
- β Visual status/priority tags
essoStore/
βββ src/
β βββ app/
β β βββ (app)/ # Protected routes
β β β βββ dashboard/
β β β βββ department/
β β β βββ product/
β β β βββ transaction/
β β β βββ upload/
β β β βββ todo/
β β β βββ layout.tsx # Protected layout with auth check
β β βββ layout.tsx # Root layout with providers
β β βββ page.tsx # Auth page (Sign In/Sign Up)
β β βββ globals.css
β βββ components/
β β βββ AppLayout.tsx # Main app layout with sidebar
β β βββ ui/ # Reusable UI components
β βββ hooks/ # Custom React hooks
β βββ lib/
β β βββ supabase/
β β β βββ client.ts # Browser Supabase client
β β β βββ server.ts # Server Supabase client
β β βββ auth.ts # Auth helper functions
β β βββ utils.ts # Utility functions
β βββ providers/
β βββ query-provider.tsx # React Query provider
β βββ antd-theme-provider.tsx
βββ prompts/ # Project specifications
β βββ aboutFiles.yaml
β βββ databaseSchema.yaml
β βββ developer.yaml
β βββ project-spec.yaml
β βββ todos.yaml
β βββ uploadFiles.yaml
β βββ exampleUploadFiles/
βββ .env.local.example
βββ package.json
βββ README.md
# Start development server
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Run linter
npm run lintMaps JSON keys to database columns:
Descriptionβdescription(string)- Array key β
store_id(number)
Maps JSON keys for products by store:
English_Descriptionβdescription(string)Priceβprice(float, in CAD cents)Age_RequirementsβageRestriction(boolean, >17 = true)Departmentβdepartment_id(number)TAX1βtax1(boolean)TAX2βtax2(boolean)
- File name contains shift number (e.g.,
12074.JSON) - Processes both Merchandise and Fuel transactions
- Maps transaction data including date/time, products, quantities, amounts
- Special handling for gas transactions (pump, volume, type)
- Layout (Header, Sider, Content)
- Menu, Form, Table, Button
- Card, Modal, Tabs
- Input, Select, DatePicker, Upload
- Typography, Message, Notification
- User lands on root
/page (auth page) - Can sign in with existing credentials or sign up
- Upon successful authentication, redirected to
/dashboard - All routes under
(app)are protected - Unauthorized users are redirected back to
/
- departments: Store departments with descriptions
- products: Product catalog with pricing and restrictions
- transactions: Sales transactions (merchandise & fuel)
- todos: Task management
- Products belong to departments
- Transactions reference products
- All tables track creation timestamps
- β Project initialization with Next.js 15
- β Supabase integration (client & server)
- β Authentication pages (Sign In/Sign Up)
- β Protected route structure
- β Main application layout with navigation
- β Dashboard page
- β Department Page - Full CRUD, search, pagination, export
- β Product Page - CRUD with filters (department, tax, age restriction)
- β Transaction Page - Merchandise & Fuel tabs with export
- β Upload Page - JSON file processing for all file types
- β Todo Page - Full CRUD with status and priority filters
- β Reusable DataTable component
- β Custom React Query hooks for all entities
Total Files Created: 25+
Hooks (5 files):
/src/hooks/useDepartments.ts- Department CRUD operations/src/hooks/useProducts.ts- Product CRUD with filters/src/hooks/useTransactions.ts- Transaction queries/src/hooks/useTodos.ts- Todo CRUD operations- All hooks include: useQuery, useCreate, useUpdate, useDelete mutations
Pages (6 main pages):
/src/app/page.tsx- Authentication (Sign In/Sign Up)/src/app/(app)/dashboard/page.tsx- Dashboard placeholder/src/app/(app)/department/page.tsx- Department management/src/app/(app)/product/page.tsx- Product management with filters/src/app/(app)/transaction/page.tsx- Transaction viewer with tabs/src/app/(app)/upload/page.tsx- File upload and processing/src/app/(app)/todo/page.tsx- Todo management
Components:
/src/components/AppLayout.tsx- Main navigation layout/src/components/ui/DataTable.tsx- Reusable table with search, pagination, export
Infrastructure:
/src/lib/supabase/- Client & server configurations/src/lib/auth.ts- Authentication helpers/src/lib/utils.ts- Utility functions (date parsing, currency conversion)/src/providers/- React Query & Ant Design providers
The application is now 100% complete with all core features implemented. Here's what to do next:
-
Set up Supabase Database:
- Create all tables using the SQL scripts provided above
- Configure Row-Level Security (RLS) policies if needed
- Add your Supabase credentials to
.env.local
-
Test the Application:
npm run dev
- Navigate to http://localhost:3000
- Sign up for a new account
- Test all CRUD operations on each page
- Try uploading the example JSON files from
/prompts/exampleUploadFiles/
-
Features to Test:
- β Authentication (Sign In/Sign Up/Logout)
- β Department management (Add/Edit/Delete/Search/Export)
- β Product management with filters
- β Transaction viewing (Merchandise/Fuel tabs)
- β File uploads (Departments, Products, Transactions)
- β Todo management with status/priority filters
- β Search and pagination on all pages
- β Export to Excel functionality
-
Optional Enhancements (Future Work):
- Add dashboard statistics and charts
- Implement user roles and permissions
- Add bulk operations (delete multiple items)
- Create reports and analytics
- Add real-time notifications
- Implement data import validation preview
- Add audit logs for all operations
- Minor TypeScript warning in
/src/app/page.tsxline 50 (does not affect functionality) - This is a false positive from the TypeScript compiler and can be safely ignored
Before deploying to production:
- Configure environment variables
- Set up Supabase RLS policies
- Enable Supabase email confirmation
- Test all file upload scenarios
- Set up error monitoring (e.g., Sentry)
- Configure CORS if needed
- Run security audit:
npm audit - Test on multiple browsers
- Set up backup strategy for database
- Configure custom domain (if applicable)
Private project for Quick Gas and Convenience Store.
Note: Configure Supabase with proper Row-Level Security (RLS) policies for production.