Smart Investor is an AI-powered agent that helps small businesses make informed pricing decisions and business planning. It considers costs, desired margins, and competitor pricing to recommend price for items. It also suggest business actions.Expalin reasoning clearly.
Root
├── web # React + Next.js Web UI
├── cmd/ # Entry point for backend service
├── config/ # Env handling & configuration
├── handlers/ # HTTP request handlers (pricing, ping)
├── middleware/ # Rate limiting
├── models/ # Data structures for API
├── services/ # Pricing engine, risk engine, LLM integration
├── go.mod # Go module definition
├── go.sum # Go module checksums
└── README.md
Tech Stack:
- React + Next.js (TypeScript)
- Tailwind CSS for styling
Structure Highlights:
app/– main application pagescomponents/– reusable UI components (form, results, explanation card)hooks/– React hooks for state management and API callslib/– utility librariespublic/– static assetsstyles/– global styles
Features:
- Input form for unit cost, desired margin, and competitor prices
- Displays recommended price, price range, profit scenarios, and risk
- Shows LLM-generated explanation of recommendations
- Responsive and minimal UI for quick demo
Tech Stack:
- Go
- REST API endpoints
- OpenRouter LLM integration (
google/gemini-3-flash-preview)
Structure Highlights:
cmd/service/main.go # Entry point for backend service
config/ # Env handling & configuration
handlers/ # HTTP request handlers (pricing, ping)
middleware/ # Rate limiting
models/ # Data structures for API
services/ # Pricing engine, risk engine, LLM integration
- Navigate to the project root directory:
cd SmartInvestor-AI- Create a
.envfile in the root with your OpenRouter API key:
OPENROUTER_API_KEY=<your-api-key>- Install dependencies and run the service:
go mod tidy
go run ./cmd/serviceThe internal service will start a REST API server (default port 8080).
- Navigate to the
webdirectory:
cd web- Install dependencies:
npm install- Run the development server:
npm run devThe frontend will be available at http://localhost:3000.
The frontend will call the backend API for pricing recommendations. Ensure the backend is running.
Internal:
| Variable | Description |
|---|---|
OPENROUTER_API_KEY |
API key for OpenRouter LLM access (google/gemini-3-flash-preview) |
PORT |
API port (default: 8080, set by most cloud platforms automatically) |
FRONTEND_URL |
Deployed web app origin for CORS, e.g. https://your-app.vercel.app |
Web:
| Variable | Description |
|---|---|
NEXT_PUBLIC_API_BASE_URL |
Public base URL of the internal API (example: https://smartinvestor-api.onrender.com) |
Obtain an API key by registering with OpenRouter, then create a key.
-
Open the frontend in your browser
-
Enter product information:
- Unit cost
- Desired margin
- Competitor min & max prices
-
Click “Analyze Pricing”
-
View:
- Recommended price
- Price range
- Profit scenarios
- Risk assessment
- LLM explanation of reasoning
Flow:
Frontend Form --> Backend /api/price/recommend
--> Pricing Engine --> Risk Engine --> LLM Service
--> Structured Response (JSON) --> Frontend
- Pricing Engine: Calculates recommended price & profit scenarios
- Risk Engine: Scores potential risks based on inputs
- LLM Service: Generates human-readable explanation
- Frontend: Displays results in a user-friendly UI
This project aligns with SDG 8: Decent Work and Economic Growth by supporting small businesses to make sustainable, informed pricing decisions.
- Assumes accurate input data (costs, competitor prices)
- Does not account for brand perception or marketing factors
- LLM explanation may vary slightly depending on API output
- Rate-limited to prevent excessive token usage
This project is open for educational purposes. Use responsibly and do not rely on this tool for financial/legal advice.
Build/start command:
go run ./cmd/serviceRequired env vars:
OPENROUTER_API_KEY=...
PORT=8080
FRONTEND_URL=https://<your-frontend-domain>Health checks (all supported):
GET /pingGET /healthGET /api/pingGET /api/health
Pricing endpoints (both supported):
POST /price/recommendPOST /api/price/recommend
This repo includes a root netlify.toml configured for the web app.
From web (local verification):
npm install
npm run build
npm run startRequired env var:
NEXT_PUBLIC_API_BASE_URL=https://<your-internal-api-domain>- Open
/and ensure it renders the pricing form (no homepage 404). - Call API health endpoint from browser/Postman.
- Submit the form and verify pricing response returns 200.