Smart Panchayat is a Node.js and Express-based backend system designed to streamline rural governance and commerce. It integrates Sequelize ORM for database management, Firebase Authentication for secure login via mobile OTP, and supports shops, products, orders, and shipment management in a scalable microservices-ready architecture.
- Project Overview/Purpose
- Features/Functionality
- Tech Stack
- Installation
- Config/Environment Variables
- Tests
- Deployment Instructions
- Coding standards/Linting
- License
- Author
Smart Panchayat is a comprehensive platform designed to streamline and optimize the management of resources and information within a Panchayat. It aims to improve efficiency, transparency, and accountability in local governance. Target users include Panchayat officials, residents, and other stakeholders. The project addresses the challenges of managing resources, tracking projects, and engaging with the community effectively.
- User Management (CRUD operations, role-based access control)
- Shop Management (add, update, view shops)
- Product Management (add, update, delete, view products; manage product categories)
- Order Management (add, update, view order history)
- Shipment Management (Track shipments, add shops to shipments, manage shipment products)
- Category Management (add, update, delete categories)
- Agent Management (CRUD operations)
- Secure Authentication (Firebase authentication)
- Robust Data Validation (using Joi)
- Detailed Logging (using Winston)
- AWS S3 Integration for file storage
- Database Migrations (using Sequelize)
- Unit Tests for various services
Smart-Panchayat/
βββ src/
β βββ config/ # Database & Firebase config
β β βββ db.js # Sequelize config
β β βββ firebase/ # Firebase setup
β β β βββ firebase_config.js
β β βββ index.js # Central config export
β β
β βββ migrations/ # Sequelize migration files
β βββ seeders/ # Sequelize seeders
β βββ models/ # Sequelize models
β β βββ index.js # Model associations setup
β β
β βββ services/ # Business logic
β β βββ user.service.js
β β βββ shop.service.js
β β βββ ...
β β
β βββ controllers/ # Route handlers (calls services)
β β βββ user.controller.js
β β βββ shop.controller.js
β β βββ ...
β β
β βββ routes/ # Express routes
β β βββ user.routes.js
β β βββ shop.routes.js
β β βββ index.js # Register all routes
β β
β βββ middleware/ # Express middlewares
β β βββ firebaseAuth.js
β β βββ errorHandler.js
β β βββ ...
β β
β βββ utils/ # Utilities
β β βββ logger.js
β β βββ response.js
β β
β βββ tests/ # Unit & integration tests
β β βββ controllers/
β β βββ services/
β β βββ utils/
β β
β βββ app.js # Express app entry point
β
βββ .eslintrc.cjs # ESLint config
βββ .prettierrc # Prettier config
βββ .gitignore
βββ package.json
βββ README.md
- Backend: Node.js, Express.js
- Database: Sequelize, PostgreSQL (implied from migrations)
- Cloud: AWS S3 (for file storage), Firebase (for Authentication)
- ORM: Sequelize
- Validation: Joi
- Logging: Winston
- Security: Helmet, bcrypt, Firebase Authentication
- Other: dotenv, morgan, aws-sdk, firebase-admin
- Clone the repository:
git clone <repository url>- Install dependencies:
npm install- Migrate the database:
npx sequelize-cli db:migrate- Seed the database (if needed):
npx sequelize-cli db:seed --seed 20250905060733-admin-user.js- Run the eslint linter:
npm run lintCreate a .env file in the root directory with the following variables:
DB_HOST=localhost DB_USER=root DB_PASS=yourpassword DB_NAME=smart_panchayat DB_DIALECT=mysql
FIREBASE_PROJECT_ID=your_project_id FIREBASE_PRIVATE_KEY=your_private_key FIREBASE_CLIENT_EMAIL=your_service_account_email
DEFAULT_PROFILE_IMAGE=https://example.com/default.png
Run unit tests:
npm testDeployment instructions would depend on your chosen platform (e.g., Heroku, AWS, Google Cloud). Generally, you would need to build the application (npm run build), create a Docker image, and deploy the image to your chosen platform.
The project uses ESLint for code linting. Run npm run lint to check for code style issues. Prettier is used for code formatting.
All Rights Reserved.
Copyright (c) 2025, Deviprasad Rai P Unauthorized copying, modification, distribution, or use of this software, via any medium, is strictly prohibited. Proprietary and confidential.
Deviprasad Rai P dpraidola@gmail.com