A modern, full-stack gas cylinder booking and management platform designed for agencies and customers.
Built with Next.js 15 (App Router), TypeScript, Prisma, and PostgreSQL.
π Live Application: agani-gas-agency-system.vercel.app
Our Gas Agency System is built with cutting-edge technologies to ensure performance, security, and scalability:
- Next.js 15.4.7 - React framework with App Router
- TypeScript 5.0 - Type-safe JavaScript
- Tailwind CSS 4.0 - Utility-first CSS framework
- React Hook Form - Form handling and validation
- Zod - Schema validation
- Framer Motion - Animation library
- Lucide React - Beautiful icons
- Next.js API Routes - Server-side API endpoints
- Prisma 6.14.0 - Database ORM
- PostgreSQL - Multi-environment cloud or local database support
- NextAuth.js 4.24.11 - Authentication framework
- Nodemailer - Email service
- Puppeteer - PDF invoice generation
- ESLint - Code linting
- Prettier - Code formatting
- Husky - Git hooks
- Jest - Testing framework
- Multi-role Authentication: User and Admin roles with secure session management.
- Email Verification: Account verification with email confirmation.
- Password Reset: Secure password reset with email tokens.
- Session Security: NextAuth.js with secure session handling.
- Quota Management: Track remaining cylinder quota (12 per year).
- Booking System: Easy cylinder booking with multiple payment options.
- Booking History: Complete booking history with status tracking.
- Real-time Tracking: Live delivery tracking with status updates.
- Payment Integration: UPI and Cash on Delivery (COD) support.
- Profile Management: Update personal information and preferences.
- Comprehensive Analytics: Revenue, bookings, deliveries, and user statistics.
- User Management: View, edit, and manage user accounts.
- Booking Management: Approve, reject, and track all bookings.
- Inventory Management: Real-time cylinder stock monitoring.
- Delivery Management: Assign delivery partners and track deliveries.
- Payment Review: Review and approve UPI payments.
- Contact Management: Handle customer support inquiries.
- Reporting: Export data and generate reports.
Here's a preview of the key features and interfaces in the Gas Agency System:
| Feature | Preview |
|---|---|
| User Dashboard | ![]() |
| Booking Form | ![]() |
| Payment Interface | ![]() |
| Tracking Page | ![]() |
| Admin Dashboard | ![]() |
| Booking Management | ![]() |
| Inventory Management | ![]() |
| User Management | ![]() |
Before setting up the Gas Agency System, ensure you have the following:
- Node.js (v18.0.0 or higher) - Download here
- npm (v9.0.0 or higher) or yarn
- Git for version control
- PostgreSQL Database (You can choose one of the options below):
- Local PostgreSQL: Installed on your local machine (port 5432).
- Supabase: Managed PostgreSQL database with built-in connection pooling.
- Railway: Cloud PostgreSQL hosting.
- Neon: Serverless Cloud PostgreSQL database.
- Gmail Account: Required for email notifications (with 2-Factor Authentication enabled to generate an App Password).
git clone https://github.com/dhruvpatel16120/Gas-Agency-System.git
cd Gas-Agency-System
npm installConfigure environment variables quickly and interactively by running:
npm run setupThis guided CLI will prompt you for:
- Database Connection URLs (Pooler/Transaction and Direct URLs)
- NextAuth configuration details (automatically generating secure secrets if needed)
- SMTP Gmail credentials (providing steps to generate a Gmail App Password)
- Payment gateway configurations (
ADMIN_UPI_ID)
Based on your database choice in the Prerequisites, configure your .env variables accordingly.
Important
Since Prisma migrations execute DDL commands, connecting to a pooled database in Transaction Mode (e.g. Supabase port 6543) will result in prepared statement "s1" already exists errors. You must provide a DIRECT_URL connecting to port 5432 (or direct database host) to bypass the connection pooler.
Follow the instructions below for your selected setup:
- Make sure your local PostgreSQL service is running.
- In
.env, set:DATABASE_URL="postgresql://postgres:password@localhost:5432/gas_agency?schema=public" DIRECT_URL="postgresql://postgres:password@localhost:5432/gas_agency?schema=public"
- Go to Supabase Console and provision a new project.
- Under Project Settings β Database, get your connection strings.
- Select Transaction Mode (port 6543) for
DATABASE_URL(requires?pgbouncer=trueparameter). - Select Session Mode or use the direct connection (port 5432) for
DIRECT_URL.DATABASE_URL="postgresql://postgres.ref:password@aws-0-ap-southeast-1.pooler.supabase.com:6543/postgres?pgbouncer=true" DIRECT_URL="postgresql://postgres.ref:password@aws-0-ap-southeast-1.pooler.supabase.com:5432/postgres"
- Go to Railway and create a new project with PostgreSQL.
- Under variables, copy the
DATABASE_PUBLIC_URL(orDATABASE_URL). - If not using a pooler, you can point both variables to the same connection URL:
DATABASE_URL="postgresql://postgres:password@host:port/railway" DIRECT_URL="postgresql://postgres:password@host:port/railway"
- Go to Neon Console and create a database project.
- In your connection details, choose the pooled connection URL for
DATABASE_URL(for transaction handling). - Choose the unpooled direct connection URL for
DIRECT_URL.DATABASE_URL="postgresql://user:password@ep-pooled-instance.aws.neon.tech/neondb?sslmode=require" DIRECT_URL="postgresql://user:password@ep-direct-instance.aws.neon.tech/neondb?sslmode=require"
You can easily handle this step interactively by running:
npm run setup:dbThis CLI tool allows you to:
- Generate the Prisma Client
- Run migrations (
npm run db:migrate/npm run db:push) - Reset Database (
β οΈ Destructive) - Seed Sample Data (
npm run db:seed) - Launch Prisma Studio (
npm run db:studio)
Create and manage your administrator account interactively:
npm run adminSelect Create or Update Admin User from the menu and follow the prompts.
npm run devVisit http://localhost:3000 in your browser!
Our system comes with a built-in admin utility to manage roles, credentials, and user deletion. Run:
npm run adminAvailable Commands in Menu:
- Create or Update Admin User: Register new administrators or promote existing users.
- List Admin Users: Quickly view all admin emails and identifiers.
- Change Admin Password: Prompt to securely change password with validation checks.
- Delete Admin User: Permanently remove administrator users from the database.
gas-agency-system/
βββ π prisma/ # Database schema and migrations
β βββ π migrations/ # Database migration files
β βββ schema.prisma # Database schema definition
βββ π public/ # Static assets
βββ π scripts/ # Setup and utility scripts
β βββ utils.js # Core interactive prompts utilities
β βββ setup-project.js # Master setup orchestrator
β βββ setup-env.js # Environment setup module
β βββ setup-db.js # Database command manager
β βββ admin-ops.js # Unified Admin operations CLI
βββ π src/
β βββ π app/ # Next.js App Router pages & API
β βββ π components/ # Reusable UI & Context providers
β βββ π lib/ # Auth, DB, email, security, validation
βββ package.json # Dependencies and scripts
βββ tsconfig.json # TypeScript configuration
| Command | Description |
|---|---|
npm run dev |
Starts Next.js development server in Turbopack mode |
npm run build |
Builds the application for production (includes client generation) |
npm run start |
Starts Next.js production server |
npm run setup |
Launches master interactive project setup menu |
npm run setup:env |
Launches interactive environment config builder |
npm run setup:db |
Launches interactive database migrations and commands utility |
npm run admin |
Launches interactive administrator account manager |
npm run db:generate |
Manually generates the Prisma Client |
npm run db:push |
Syncs schema changes directly with the database |
npm run db:migrate |
Runs database migrations safely via Prisma Migrate |
npm run db:reset |
Wipes and resets database schema and data ( |
npm run db:seed |
Runs seed script to populate sample cylinders and data |
npm run db:studio |
Opens Prisma Studio GUI in your browser |
npm run lint |
Runs ESLint analysis for code quality |
npm run format |
Formats codebase with Prettier |
We welcome contributions! Please see our Contributing Guide and adhere to our Code of Conduct.
This project is licensed under the MIT License - see the LICENSE file for details.
Dhruv Patel
- GitHub: @dhruvpatel16120
- Portfolio: dhruvpatelofficial.vercel.app
If you have questions or need support:
- Refer to our Technical Documentation
- Open an Issue on our repository
- Star this project if you find it helpful! β








