Node.js Express backend API server for the FinSync360 ERP system with comprehensive financial management, inventory control, and Tally integration capabilities.
Status: ✅ DEPLOYED & OPERATIONAL
- Production URL: https://finsync-backend-d34180691b06.herokuapp.com
- Health Check: https://finsync-backend-d34180691b06.herokuapp.com/health
- Database: MongoDB Atlas (shared cluster)
- Integration Tests: 7/7 endpoints passing (100% success rate)
- Authentication & Authorization: JWT-based security with role-based access control
- Tally Integration: Bidirectional XML-based synchronization
- Financial Management: Complete voucher system (sales, purchase, payment, receipt, etc.)
- Inventory Management: Multi-godown support with batch tracking
- Payment Processing: Razorpay integration with UPI/QR code support
- GST Compliance: GSTN integration and reconciliation
- Communication: WhatsApp/Email notifications and reminders
- Reporting: Advanced financial and inventory reports
- Multi-tenant: Company-based data isolation
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/auth/profile- Get user profile (requires auth)
GET|POST|PUT|DELETE /api/transactions- Transaction management (vouchers)GET|POST|PUT|DELETE /api/budgets- Budget managementGET|POST|PUT|DELETE /api/vouchers- Voucher operationsGET|POST|PUT|DELETE /api/inventory- Inventory managementGET|POST|PUT|DELETE /api/payments- Payment processingGET|POST|PUT|DELETE /api/parties- Customer/Supplier management
GET /health- Health check endpointGET /api/companies- Company managementGET /api/users- User managementGET /api/reports- Report generationGET /api/notifications- Notification management
- Node.js 18+
- MongoDB 6.0+ (or use production MongoDB Atlas)
- npm or yarn
- Install dependencies
cd backend
npm install- Environment configuration
cp .env.example .env
# Edit .env with your configuration- Start development server
npm run devThe server will start on http://localhost:5000
Development (.env)
NODE_ENV=development
PORT=5000
MONGODB_URI=mongodb://localhost:27017/finsync360
JWT_SECRET=your-jwt-secret-key
BCRYPT_ROUNDS=12
ENCRYPTION_KEY=your-32-character-encryption-key
# Payment Integration
RAZORPAY_KEY_ID=your-razorpay-key-id
RAZORPAY_KEY_SECRET=your-razorpay-secret
# Communication Services
TWILIO_ACCOUNT_SID=your-twilio-sid
TWILIO_AUTH_TOKEN=your-twilio-token
EMAIL_SERVICE_API_KEY=your-email-api-key
# External APIs
GSTN_API_KEY=your-gstn-api-key
FRONTEND_URL=http://localhost:3000
# Logging
LOG_LEVEL=infoProduction (Heroku Config Vars)
NODE_ENV=development
MONGODB_URI=mongodb+srv://hhirawat5:R79fVWIVMLY1BSUh@finsync.xwmeuwe.mongodb.net/finsync360?retryWrites=true&w=majority&authSource=admin
JWT_SECRET=jFVdOwGOOHRA0716lvQ0F1PlY1GFbXZNxE5mtgZvPs8=
BCRYPT_ROUNDS=12
ENCRYPTION_KEY=frbcHZWNefSNvpn70bEVJw35JhPnN3+o
FRONTEND_URL=https://finsync-frontend-nextjs-fbce311426ec.herokuapp.com
RAZORPAY_KEY_ID=dummy_key_for_development
RAZORPAY_KEY_SECRET=dummy_secret_for_development
REDIS_URL=rediss://:p0ebd99f9f300dac913073c895f7acb6dfca3af58be5791df4823f62bc4a82c18@ec2-52-200-79-251.compute-1.amazonaws.com:26720
LOG_LEVEL=info# All tests
npm test
# Specific test suites
npm run test:auth
npm run test:vouchers
npm run test:inventory
npm run test:payments# Test production API endpoints
cd ../mobile
node test-production-api.js- Add Heroku remote
heroku git:remote -a finsync-backend -r heroku-backend- Deploy to production
git push heroku-backend `git subtree split --prefix=backend HEAD`:refs/heads/master --force- Configure environment variables
heroku config:set MONGODB_URI="your-mongodb-connection-string" --app finsync-backend
heroku config:set JWT_SECRET="your-jwt-secret" --app finsync-backend
# ... other environment variablescurl https://finsync-backend-d34180691b06.herokuapp.com/healthbackend/
├── src/
│ ├── config/ # Database and app configuration
│ ├── controllers/ # Route controllers
│ ├── middleware/ # Authentication, validation, error handling
│ ├── models/ # MongoDB schemas
│ ├── routes/ # API route definitions
│ ├── services/ # Business logic services
│ ├── utils/ # Utility functions
│ └── server.js # Express app setup
├── tests/ # Test suites
├── logs/ # Application logs
├── scripts/ # Database scripts and utilities
├── package.json
├── Procfile # Heroku deployment configuration
└── README.md
- JWT Authentication: Secure token-based authentication
- Password Hashing: bcrypt with configurable rounds
- Data Encryption: AES encryption for sensitive data
- Rate Limiting: API rate limiting to prevent abuse
- Input Validation: Comprehensive request validation
- CORS Protection: Configurable CORS policies
- Helmet Security: Security headers and protection
- MongoDB Sanitization: NoSQL injection prevention
- Structured Logging: Winston-based logging system
- Health Monitoring: Built-in health check endpoints
- Error Tracking: Comprehensive error handling and reporting
- Performance Metrics: Request timing and performance monitoring
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
This project is licensed under the MIT License.