Investment System Builder
New Prompt
9.7/10

Overall Feedback

This is an excellent prompt! It is very detailed and clear. You used all the best ways to talk to an AI.

google/gemini-3-flash

Your Prompt
Act as a Senior Full-Stack Engineer and Finance Systems Architect.

We are continuing Phase 3 (Investment Flows) using Lovable Cloud with our existing Supabase backend. Authentication, users, admin dashboard, deposits, wallets, balances, triggers, and RLS policies already exist and must NOT be broken.

Refer to the existing database schema (profiles, deposits, wallets, transactions, investments) and follow existing UI patterns in @src/components/UI.

Your goal is to design and implement a realistic, transparent investment system that works automatically for users while preserving full admin control.

INVESTMENT CATEGORIES
Create investment plans for the following five categories:
	1.	Crypto Mining
	2.	Gold Mining (brokered mining companies, not spot trading)
	3.	REITs (fractional real estate exposure)
	4.	Quantum Stocks (high-growth tech exposure)
	5.	Diversified Auto-Invest (allocates across all categories)

INVESTMENT RULES
Minimum investment: $1,000
Duration must be flexible: minimum 60 days, with options such as 60, 120, 180, and 360 days.
ROI is defined per 60-day cycle and scales linearly with duration.
Example: if 60 days = 55% ROI, then 120 days = 110%, 180 days = 165%, etc.
All categories accrue profits daily.
No auto-compounding by default.
No black-box profit calculations. All values must be explainable and visible.

ROI VALUES (USE THESE EXACTLY)
Crypto Mining: 55% per 60 days
Gold Mining: 35% per 60 days
REITs: 30% per 60 days
Quantum Stocks: 55% per 60 days
Diversified Auto-Invest: 40% per 60 days

These are platform-configured ROI rates, not guarantees. Display a disclaimer: “Past performance does not guarantee future results.”

USER INVESTMENT FLOW (AUTOMATED)
When a user selects an investment plan:
	1.	Validate sufficient balance
	2.	Automatically create an investment record
	3.	Deduct the investment amount from the user balance
	4.	Mark the investment as active
	5.	Begin daily profit accrual immediately

No admin approval is required to start an investment.

PROFIT VISIBILITY (MANDATORY)

User Dashboard must show:
	•	Total invested
	•	Total earned profit (to date)
	•	Active investments
	•	Available balance

“My Investments” section must show per investment:
	•	Invested amount
	•	Category
	•	Duration
	•	ROI rate
	•	Start date and end date
	•	Profit earned so far
	•	Daily profit amount
	•	Status (active, completed, paused)

Investment detail view must show:
	•	Principal
	•	Expected total profit
	•	Earned profit so far
	•	Remaining expected profit
	•	Days elapsed and days remaining
	•	Progress indicator

Transaction history must log profits as:
	•	Type: Investment Profit
	•	Amount
	•	Date
	•	Investment ID

BALANCE AND PROFIT LOGIC
Track separately:
	•	Balance (available funds)
	•	Invested principal
	•	Accrued profit

Profits must not silently merge into balance.
Profit should only move into balance when:
	•	The investment completes, or
	•	An admin manually releases profits.

ADMIN CONTROLS
Admins must be able to:
	•	View all user investments
	•	Edit ROI per plan
	•	Edit ROI per individual user
	•	Edit accrued profits
	•	Pause or resume investments
	•	Manually credit profits
	•	Adjust balances (existing functionality must remain intact)
	•	View a full audit trail of all changes

SECURITY AND QUALITY RULES
Respect all existing RLS policies.
Never expose admin-only actions to users.
Handle errors gracefully with clear UI messages.
Reuse existing UI components and design tokens.
Do not refactor unrelated working systems.
If any table or field is unclear, ask before coding.

IMPLEMENTATION ORDER
	1.	Investment plan configuration or data model
	2.	User investment creation flow
	3.	Daily profit accrual logic
	4.	User profit displays
	5.	Admin investment and ROI controls

BEFORE WRITING CODE
Explain your implementation plan and list edge cases (insufficient balance, ROI edited mid-cycle, paused investments, etc.).
Confirm assumptions with me before proceeding.
How Did Your Prompt Do?