A powerful profit & conversion calculator for coin trading businesses. Track sales, manage inventory, calculate profits, and export reports.
Features • Quick Start • Deployment • Supabase Setup • Documentation
- 💰 Profit Calculator — Compute profit in PKR from USDT investment, selling rate per 100k coins, and quantity sold
- 📱 Multi-App Support — Tracks transactions across multiple platforms (Baat, Wafa, Taka, etc.)
- 📦 Inventory Management — Record coin purchases, track sold vs. unsold inventory, compute unrealized vs. realized profit
- 📊 Transactions Ledger — Full history with cost-basis breakdown using FIFO accounting
- 👛 Wallet Dashboard — Aggregate view of capital, inventory value, and net profit
- 📄 PDF Reports — Export transactions and payroll reports with professional formatting
- ☁️ Cloud Sync — Data persists across devices via Supabase backend
- 🌓 Dark/Light Theme — Beautiful Apple-inspired design with seamless theme switching
- FIFO Cost Accounting — First-In-First-Out cost basis calculation for accurate profit tracking
- Real-time Calculations — Live profit estimates as you process sales
- Multiple Currency Support — Track different apps with different rates and ratios
- Secure Authentication — Supabase-powered secure data storage
- Responsive Design — Works perfectly on desktop, tablet, and mobile
- PWA Ready — Can be installed as a progressive web app
- Node.js 18 or higher
- A Supabase project (free tier available at supabase.com)
- npm or yarn package manager
# Clone the repository
git clone https://github.com/mrtomdev/coins-selling-business.git
cd coins-selling-business
# Install dependencies
npm install
# Create environment file
cp .env.example .env.local
# Configure your Supabase credentials in .env.local
# See "Supabase Setup" section below
# Start development server
npm run devOpen http://localhost:3000 to view the app.
- Go to supabase.com and sign up/login
- Click New Project and fill in the details
- Wait for the project to be created (usually takes ~2 minutes)
- Go to Settings > API to find your:
- Project URL
anonpublic key
Go to SQL Editor in your Supabase dashboard and run this schema:
-- Enable UUID extension
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- App State Table
CREATE TABLE IF NOT EXISTS app_state (
id BIGINT PRIMARY KEY DEFAULT 1,
wallet_pkr NUMERIC DEFAULT 0,
wallet_coins NUMERIC DEFAULT 0,
taka_coins NUMERIC DEFAULT 0,
usdt_rate TEXT DEFAULT '285',
conversion_ratio INTEGER DEFAULT 1000000,
taka_ratio INTEGER DEFAULT 1000000,
baat_selling_rate INTEGER DEFAULT 3250,
taka_selling_rate INTEGER DEFAULT 3100,
taka_rate TEXT DEFAULT '285',
updated_at TIMESTAMPTZ DEFAULT NOW()
);
INSERT INTO app_state (id) VALUES (1) ON CONFLICT (id) DO NOTHING;
-- Transactions Table
CREATE TABLE IF NOT EXISTS transactions (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
timestamp BIGINT NOT NULL,
amount_pkr NUMERIC NOT NULL,
coins_sold NUMERIC NOT NULL,
profit_pkr NUMERIC NOT NULL,
rate_applied NUMERIC NOT NULL,
app TEXT DEFAULT 'Baat',
cost_basis_details JSONB,
created_at TIMESTAMPTZ DEFAULT NOW()
);
-- Payroll Table
CREATE TABLE IF NOT EXISTS payroll (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
timestamp BIGINT NOT NULL,
cost_pkr NUMERIC NOT NULL,
beans NUMERIC NOT NULL,
beans_sold NUMERIC DEFAULT 0,
selling_rate NUMERIC NOT NULL,
estimated_value NUMERIC NOT NULL,
profit NUMERIC NOT NULL,
status TEXT DEFAULT 'unrealized',
app TEXT DEFAULT 'Baat',
created_at TIMESTAMPTZ DEFAULT NOW()
);
-- Enable RLS
ALTER TABLE app_state ENABLE ROW LEVEL SECURITY;
ALTER TABLE transactions ENABLE ROW LEVEL SECURITY;
ALTER TABLE payroll ENABLE ROW LEVEL SECURITY;
-- Create policies for public access
CREATE POLICY "Allow public read/write on app_state" ON app_state FOR ALL USING (true) WITH CHECK (true);
CREATE POLICY "Allow public read/write on transactions" ON transactions FOR ALL USING (true) WITH CHECK (true);
CREATE POLICY "Allow public read/write on payroll" ON payroll FOR ALL USING (true) WITH CHECK (true);Edit .env.local:
VITE_SUPABASE_URL=https://your-project-id.supabase.co
VITE_SUPABASE_ANON_KEY=your-anon-key-here- Click the button above
- Import your GitHub repository
- Add environment variables:
VITE_SUPABASE_URL= your Supabase project URLVITE_SUPABASE_ANON_KEY= your Supabase anon key
- Click Deploy
- Click the button above
- Connect your GitHub repository
- Set build command:
npm run build - Set publish directory:
dist - Add environment variables
- Click Deploy site
- Push code to GitHub
- Go to repository Settings > Pages
- Select source branch
- Site available at
https://username.github.io/coins-selling-business
├── App.tsx # Main application component
├── index.tsx # React entry point
├── index.html # HTML template with SEO meta tags
├── index.css # Global styles and theme tokens
├── types.ts # TypeScript type definitions
├── vite.config.ts # Vite bundler configuration
├── vercel.json # Vercel deployment config
├── netlify.toml # Netlify deployment config
├── supabase_schema.sql # Database schema
├── components/
│ ├── Dashboard.tsx # Main dashboard
│ ├── BSalesPage.tsx # Sales terminal
│ ├── PayrollPage.tsx # Inventory management
│ ├── WalletPage.tsx # Wallet balance
│ ├── TransactionsPage.tsx # Transaction ledger
│ └── ...
├── lib/
│ ├── supabase.ts # Supabase client
│ └── theme.ts # Theme utilities
└── utils/
└── format.ts # Formatting utilities
| Technology | Purpose |
|---|---|
| React 18 | UI framework |
| TypeScript | Type-safe development |
| Vite 7 | Build tool |
| Tailwind CSS | Styling (CDN) |
| Supabase | Backend & database |
| jsPDF | PDF reports |
| Lucide React | Icons |
| Constant | Value |
|---|---|
DEFAULT_COINS_PER_100_USDT |
1,000,000 |
DEFAULT_USDT_RATE |
285 PKR |
DEFAULT_SELLING_RATE_PER_100K |
3,250 PKR |
TAKA_SELLING_RATE_PER_100K |
3,100 PKR |
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes
- Push to the branch
- Open a Pull Request
This project is open source under the MIT License.
⭐ Star this repo if you find it useful!