Next.js frontend for BluLedger financial management system.
- Modern Dashboard: Real-time financial overview with KPIs, charts, and analytics
- Multi-tenancy: Organization-based data isolation and management
- Account Management: Track multiple accounts with different currencies and types
- Transaction Tracking: Income, expense, and transfer transaction management
- Authentication: Secure JWT-based authentication with automatic token refresh
- Responsive Design: Beautiful UI with smooth animations and dark mode support
- Framework: Next.js 16 with React 19
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: Radix UI, HeroUI
- Animations: Framer Motion
- Data Fetching: TanStack Query (React Query)
- HTTP Client: Axios
- Charts: Recharts
- Forms: React Hook Form with Zod validation
- Install dependencies:
npm install- Configure environment:
cp .env.example .env
# Edit .env with your backend API URL- Start the development server:
npm run devThe application will be available at http://localhost:3000.
Create a .env.local file in the root directory:
NEXT_PUBLIC_API_URL=http://localhost:3001/api/v1src/
├── app/ # Next.js app directory
│ ├── dashboard/ # Dashboard pages
│ ├── login/ # Login page
│ ├── register/ # Registration page
│ └── page.tsx # Home page
├── components/ # React components
│ ├── ui/ # UI components
│ └── DashboardLayout.tsx
├── hooks/ # Custom React hooks
│ ├── useAuth.ts
│ ├── useAccounts.ts
│ └── useTransactions.ts
├── services/ # API services
│ ├── auth.service.ts
│ ├── account.service.ts
│ └── transaction.service.ts
├── lib/ # Utilities and configs
│ └── api-client.ts # Axios instance
└── types/ # TypeScript types
└── api.ts
- User registration and login
- JWT token management with automatic refresh
- Protected routes with authentication guards
- Session persistence across page reloads
- Financial KPIs (revenue, expenses, profit, cashflow)
- Interactive charts for revenue, expenses, and cashflow trends
- Recent transactions table
- Account balance overview
- Create and manage multiple organizations
- Switch between organizations seamlessly
- Role-based access control (admin, member, viewer)
- Organization-scoped data isolation
- Create accounts with different types (Asset, Liability, Equity, etc.)
- Multi-currency support
- Real-time balance tracking
- Account categorization
- Record income, expense, and transfer transactions
- Automatic balance calculations
- Transaction categories and tags
- Date and time tracking
- Transaction history with filtering
# Start development server
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Run linter
npm run lintThe frontend communicates with the BluLedger backend API. All API requests include:
- Authorization: JWT token in Authorization header
- Organization Context:
x-org-idheader for multi-tenant data isolation
The API client (src/lib/api-client.ts) handles:
- Automatic token attachment to requests
- Token refresh on expiration
- Error handling and retry logic
- Redirect to login on authentication failure
- User logs in via
/loginpage - Backend returns access token (stored in localStorage) and refresh token (HTTP-only cookie)
- Protected routes verify authentication status
- On token expiration, client automatically refreshes using refresh token
- On logout, tokens are cleared and user is redirected to login
All data operations are scoped to the selected organization:
- User selects an organization from their list
- Organization ID is stored in localStorage
- All API requests include
x-org-idheader - Backend returns only data belonging to that organization
- Users can switch organizations via the UI
- Home (
/): Landing page with auto-redirect based on auth status - Login (
/login): User authentication - Register (
/register): New user registration - Dashboard (
/dashboard): Main financial overview - Reports (
/dashboard/reports): Detailed financial reports - Settings (
/dashboard/settings): Application settings
- 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