Files
moneymind/src/app/api/analytics/overview/route.ts
Rosario Moscato 5270bbd40a feat: implement MoneyMind personal finance management application
- Complete transformation from boilerplate to full-featured financial app
- Add comprehensive dashboard with KPI cards and interactive charts
- Implement transaction management with predefined expense/income categories
- Create account management system with multiple account types
- Add authentication flow with session management
- Implement analytics overview with demo financial data
- Add budget tracking and goal progress visualization
- Include custom category creation functionality
- Update branding and footer with MoneyMind by RoMoS
- Add shadcn/ui components and Recharts for data visualization

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-29 14:41:40 +02:00

125 lines
2.8 KiB
TypeScript

import { NextRequest, NextResponse } from "next/server";
// Demo analytics data for MoneyMind
const demoAnalytics = {
metrics: {
currentBalance: 15420.50,
totalIncome: 3500.00,
totalExpenses: 2180.75,
netCashFlow: 1319.25,
},
categoryBreakdown: {
expenses: [
{ category: "Housing", total: 850.00, percentage: 39 },
{ category: "Food", total: 420.50, percentage: 19 },
{ category: "Transport", total: 280.25, percentage: 13 },
{ category: "Entertainment", total: 180.00, percentage: 8 },
{ category: "Utilities", total: 250.00, percentage: 11 },
{ category: "Other", total: 200.00, percentage: 10 },
],
income: [
{ category: "Salary", total: 3000.00, percentage: 86 },
{ category: "Freelance", total: 500.00, percentage: 14 },
]
},
monthlyTrends: [
{
month: "Apr 2025",
income: 3200.00,
expenses: 2100.00,
balance: 1100.00
},
{
month: "May 2025",
income: 3400.00,
expenses: 2250.00,
balance: 1150.00
},
{
month: "Jun 2025",
income: 3300.00,
expenses: 2050.00,
balance: 1250.00
},
{
month: "Jul 2025",
income: 3500.00,
expenses: 2180.75,
balance: 1319.25
},
],
budgetStatus: [
{
id: "1",
name: "Monthly Food Budget",
categoryName: "Food",
amount: 500.00,
spent: 420.50,
remaining: 79.50,
percentage: 84.1,
},
{
id: "2",
name: "Entertainment Budget",
categoryName: "Entertainment",
amount: 200.00,
spent: 180.00,
remaining: 20.00,
percentage: 90.0,
},
{
id: "3",
name: "Transport Budget",
categoryName: "Transport",
amount: 300.00,
spent: 280.25,
remaining: 19.75,
percentage: 93.4,
},
],
goalProgress: [
{
id: "1",
name: "Emergency Fund",
priority: "high",
targetAmount: 10000.00,
currentAmount: 7500.00,
remaining: 2500.00,
percentage: 75.0,
targetDate: "2025-12-31",
},
{
id: "2",
name: "New Car",
priority: "medium",
targetAmount: 25000.00,
currentAmount: 8500.00,
remaining: 16500.00,
percentage: 34.0,
targetDate: "2026-06-30",
},
{
id: "3",
name: "Vacation Fund",
priority: "low",
targetAmount: 5000.00,
currentAmount: 1200.00,
remaining: 3800.00,
percentage: 24.0,
targetDate: "2025-12-15",
},
],
};
export async function GET(request: NextRequest) {
try {
// Return demo analytics data
return NextResponse.json(demoAnalytics);
} catch (error) {
console.error("Error fetching analytics:", error);
return NextResponse.json(
{ error: "Failed to fetch analytics" },
{ status: 500 }
);
}
}