Skip to content

devi5040/Smart-Panchayat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

596 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Smart Panchayat

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.


2. Table of Contents

  1. Project Overview/Purpose
  2. Features/Functionality
  3. Tech Stack
  4. Installation
  5. Config/Environment Variables
  6. Tests
  7. Deployment Instructions
  8. Coding standards/Linting
  9. License
  10. Author

3. Project Overview/Purpose

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.


4. Features/Functionality

  • 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

πŸ“‚ Project Structure

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

5. Tech Stack

  • 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

6. Installation

  1. Clone the repository:
git clone <repository url>
  1. Install dependencies:
npm install
  1. Migrate the database:
npx sequelize-cli db:migrate
  1. Seed the database (if needed):
npx sequelize-cli db:seed --seed 20250905060733-admin-user.js
  1. Run the eslint linter:
npm run lint

7. Config/Environment Variables

Create a .env file in the root directory with the following variables:

  • Database

DB_HOST=localhost DB_USER=root DB_PASS=yourpassword DB_NAME=smart_panchayat DB_DIALECT=mysql

  • Firebase

FIREBASE_PROJECT_ID=your_project_id FIREBASE_PRIVATE_KEY=your_private_key FIREBASE_CLIENT_EMAIL=your_service_account_email

  • Default profile image

DEFAULT_PROFILE_IMAGE=https://example.com/default.png


8. Tests

Run unit tests:

npm test

9. Deployment Instructions

Deployment 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.


10. Coding standards/Linting

The project uses ESLint for code linting. Run npm run lint to check for code style issues. Prettier is used for code formatting.


11. License

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.


12. Author

Deviprasad Rai P dpraidola@gmail.com

About

Smart Panchayat is a digital solution designed to modernize and streamline Panchayat-level governance. It aims to provide a centralized platform for managing village-level administration, public services, and citizen engagement. The project focuses on digitizing records, improving service delivery, and enhancing transparency through technology.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors