An AI-assisted financial modeling platform that generates comprehensive 3-statement financial models from business descriptions in plain English.
- AI-Powered Business Classification: Automatically identifies business models (SaaS, eCommerce, Marketplace, etc.)
- Adaptive Question Engine: Generates relevant follow-up questions based on business type and context
- Deterministic Modeling Engine: Creates accurate 3-statement financial models with schedules and scenarios
- Template System: YAML/JSON DSL for defining business model templates
- Excel Export: Generates auditable Excel files with named ranges, cross-sheet formulas, and audit sheets
- CSV Export: Exports individual sheets as CSV files for external analysis
- Audit & Validation: Built-in checks for model integrity and reasonableness
-
Business Classifier (LLM)
- Analyzes business descriptions
- Extracts structured intents (currency, time granularity, units, taxes, geos)
- Identifies business models and key drivers
-
Adaptive Question Engine
- Question graphs per module (Revenue, COGS, Opex, Capex, WC, Financing, Tax)
- Gated by business model type and previous answers
- Each question includes conditions, validation, and explanations
-
Deterministic Modeling Engine
- Inputs β normalized drivers schema β computation DAG
- Handles circular references (interest, revolver, tax) with bounded iteration
- Generates Income Statement, Balance Sheet, and Cash Flow Statement
-
Template/DSL Layer
- YAML/JSON DSL defines lines, formulas, dependencies
- New business models as templates, not code
- Configurable validation and formatting rules
-
Exporter
- Excel generation with named ranges, cross-sheet formulas, styles
- Audit tab with trace & checks
- CSV export for each sheet
- Frontend: Next.js 14 with TypeScript
- Backend: Next.js API Routes
- Database: SQLite with better-sqlite3
- AI: OpenAI GPT-4 for business classification and question generation
- Excel: ExcelJS for Excel file generation
- Validation: Zod for input validation
- Node.js 18+
- npm or yarn
- OpenAI API key
-
Clone the repository
git clone git@github.com:iyanski/finmod.git cd finmod -
Install dependencies
npm install
-
Set up environment variables
cp env.example .env.local
Edit
.env.localand add your configuration:# Application Configuration NEXT_PUBLIC_APP_URL=http://localhost:3000 NODE_ENV=development # Database Configuration DATABASE_URL=file:./finmod.db # JWT Configuration JWT_SECRET=your-super-secret-jwt-key-here JWT_EXPIRES_IN=24h # OpenAI Configuration OPENAI_API_KEY=your-openai-api-key-here OPENAI_MODEL=gpt-4 # File Storage UPLOAD_DIR=./uploads MAX_FILE_SIZE=10485760 # Logging LOG_LEVEL=debug
-
Run the development server
npm run dev
-
Open your browser Navigate to http://localhost:3000
Start by describing your business in plain English:
"We are a SaaS company that provides project management software to small businesses.
We charge $29/month per user and currently have 500 active users. Our customer churn
rate is 5% monthly and we spend about 30% of revenue on sales and marketing."
The system will automatically:
- Classify your business model (SaaS, eCommerce, etc.)
- Extract key intents (currency, time granularity, planning horizon)
- Identify relevant financial drivers
The system generates follow-up questions based on your business type:
- Revenue: MRR, growth rate, churn rate, pricing strategy
- Costs: COGS percentage, operating expenses, margins
- Working Capital: DSO, DIO, DPO, cash conversion cycle
- Capital Expenditure: Asset requirements, depreciation
- Financing: Debt structure, interest rates, repayment terms
- Tax: Effective tax rate, tax considerations
Based on your answers, the system generates:
- Income Statement: Revenue, COGS, operating expenses, net income
- Balance Sheet: Assets, liabilities, equity
- Cash Flow Statement: Operating, investing, financing cash flows
- Schedules: Depreciation, debt, working capital
- Scenarios: Base case, optimistic, pessimistic
- Audit Checks: Model validation and reasonableness checks
Export your model in multiple formats:
- Excel: Full-featured workbook with formulas, named ranges, and audit sheets
- CSV: Individual sheets as CSV files for external analysis
POST /api/business/classify
Content-Type: application/json
{
"description": "Business description in plain English"
}POST /api/questions/generate
Content-Type: application/json
{
"businessDescription": "Business description",
"businessModel": { /* classified business model */ },
"businessIntent": { /* extracted intents */ },
"answeredQuestions": { /* previous answers */ },
"previousQuestions": [ /* previous questions */ ]
}POST /api/models/generate
Content-Type: application/json
{
"businessType": "saas",
"inputs": {
"initial_mrr": 14500,
"revenue_growth_rate": 0.05,
"churn_rate": 0.05,
"gross_margin": 0.8,
"sales_marketing_budget": 0.3,
"tax_rate": 0.25
}
}POST /api/export/excel
Content-Type: application/json
{
"businessType": "saas",
"inputs": { /* financial inputs */ },
"options": {
"includeAuditSheet": true,
"includeScenarios": true,
"includeSchedules": true
}
}POST /api/export/csv
Content-Type: application/json
{
"businessType": "saas",
"inputs": { /* financial inputs */ }
}The platform includes pre-built templates for common business models:
- Revenue: Subscription-based with MRR growth and churn
- Costs: High gross margins, significant R&D and sales/marketing
- Metrics: CAC, LTV, churn rate, expansion revenue
- Revenue: Transaction-based with AOV and conversion rates
- Costs: COGS, fulfillment, marketing, payment processing
- Metrics: Conversion rate, repeat purchase rate, inventory turnover
- Revenue: Take rate on gross merchandise value
- Costs: Platform development, customer acquisition
- Metrics: GMV, take rate, active users, transaction volume
- Revenue: Billable hours, project-based pricing
- Costs: Labor, overhead, client acquisition
- Metrics: Utilization rate, project margins, client retention
src/
βββ lib/ # Core business logic
β βββ business-classifier.ts
β βββ adaptive-question-engine.ts
β βββ financial-modeling-engine.ts
β βββ template-engine.ts
β βββ excel-exporter.ts
β βββ database.ts
βββ pages/
β βββ api/ # API routes
β β βββ business/
β β βββ questions/
β β βββ models/
β β βββ export/
β βββ index.tsx # Landing page
βββ types/ # TypeScript definitions
βββ utils/ # Utility functions
-
Create Template
// In template-engine.ts const newTemplate: ModelTemplate = { id: 'new_model', name: 'New Business Model', businessTypes: ['new_model'], schema: { inputs: [/* input definitions */], outputs: [/* output definitions */], schedules: [/* schedule definitions */] }, formulas: [/* formula definitions */], validation: [/* validation rules */] };
-
Add Question Graph
// In adaptive-question-engine.ts this.questionGraphs.set('new_model', { nodes: [/* question nodes */], edges: [/* question dependencies */] });
-
Update Business Classifier
// In business-classifier.ts const defaultMetrics: Record<string, string[]> = { new_model: ['metric1', 'metric2', 'metric3'] };
# Run tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:cov-
Install Vercel CLI
npm i -g vercel
-
Deploy
vercel
-
Set environment variables in Vercel dashboard
-
Build image
docker build -t finmod-ai . -
Run container
docker run -p 3000:3000 finmod-ai
- Response Time: < 2 seconds for business classification
- Model Generation: < 5 seconds for complete 3-statement model
- Excel Export: < 10 seconds for full workbook with all sheets
- Concurrent Users: Supports 100+ concurrent users
- Input validation and sanitization
- Rate limiting on API endpoints
- Environment variable protection
- SQL injection prevention
- XSS protection
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: Wiki
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: support@finmod.ai
- OpenAI for GPT-4 integration
- ExcelJS for Excel file generation
- Next.js team for the amazing framework
- Financial modeling community for best practices
FinMod AI Platform - Making financial modeling accessible to everyone through AI.
