Skip to content

rahulraikwar00/AddressSync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

116 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Address Sync System

MIT License Python Version FastAPI Docker SQLAlchemy

Address Sync System


πŸ“‹ Overview

The Address Sync System is a microservice that simplifies updating address information across multiple agencies using Aadhaar as a unique identifier.

Users can request updates β†’ agencies approve/reject β†’ system syncs changes.


✨ Features

🏠 Requester (Citizen)

  • Register/Login via Aadhaar
  • View agencies
  • Submit address update requests
  • Track request status
  • Cancel pending requests

🏒 Agency

  • Register/Login
  • View pending requests
  • Approve/Reject requests
  • Access request history

πŸ“Š Admin

  • Status tracking (Pending / Approved / Rejected / Cancelled)
  • Filtering
  • Stats dashboard
  • Audit logs

πŸ—οΈ Tech Stack

Backend

  • FastAPI
  • SQLAlchemy
  • SQLite / PostgreSQL
  • JWT Auth
  • Python 3.10+

Frontend

  • HTML, CSS, Vanilla JS

DevOps

  • Docker
  • Docker Compose
  • Git

βš™οΈ System Flow

Citizen β†’ Request β†’ Agency
   ↓           ↑
Status ← Approval
   ↓
Address Updated

πŸ“¦ Prerequisites

  • Python 3.10+
  • Docker & Docker Compose
  • Git
  • curl

πŸš€ Installation

1. Clone

git clone https://github.com/yourusername/address-sync-system.git
cd address-sync-system

2. Backend Setup

Option A: Docker

cd backend
docker-compose up -d --build
docker-compose logs -f
docker-compose down

Option B: Local

cd backend
python -m venv venv
source venv/bin/activate   # Linux/Mac
venv\Scripts\activate      # Windows

pip install -r requirements.txt

mkdir data static

Create .env:

DATABASE_URL=sqlite:///./data/address_sync.db
SECRET_KEY=your-secret-key
DEBUG=True
ALLOWED_ORIGINS=http://localhost:3000,http://localhost:8000

Run:

uvicorn main:app --reload

🌐 Access

Service URL
App http://localhost:8000
Docs http://localhost:8000/docs
ReDoc http://localhost:8000/redoc

πŸ’» Usage

Demo Users

Aadhaar Name Password
123456789012 Rajesh Kumar Rajesh@1234

Demo Agencies

ID Name
municipal_bangalore Bangalore MC

πŸ”Œ API Example

# Health
curl http://localhost:8000/health

# Register
curl -X POST http://localhost:8000/users/register \
-H "Content-Type: application/json" \
-d '{"aadhaar_number":"123456789012","password":"Test@123"}'

πŸ“‘ API Endpoints

User

  • POST /users/register
  • POST /users/login
  • GET /users/me

Agency

  • POST /agencies/register
  • POST /agencies/login

Requests

  • POST /requests/create
  • GET /requests/my-requests
  • PUT /requests/{id}

πŸ“Š Data Models

User

{
  "aadhaar_number": "string",
  "name": "string",
  "email": "string",
  "current_address": "string"
}

Request

{
  "id": "uuid",
  "status": "pending | approved | rejected"
}

βš™οΈ Environment Variables

DATABASE_URL=sqlite:///./data/address_sync.db
SECRET_KEY=secret
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=1440

🐳 Docker

services:
  backend:
    build: ./backend
    ports:
      - "8000:8000"

πŸ§ͺ Testing

python test_full_api.py

🚒 Deployment

Railway

railway up

Render

  • Build: pip install -r requirements.txt
  • Start: uvicorn main:app --host 0.0.0.0 --port $PORT

πŸ”§ Troubleshooting

Port Issue

lsof -i :8000
kill -9 PID

Docker Issue

sudo systemctl start docker

🀝 Contributing

git checkout -b feature/new-feature
git commit -m "Add feature"
git push origin feature/new-feature

πŸ“„ License

MIT License


πŸ™Œ Credits

  • FastAPI
  • SQLAlchemy
  • Docker

πŸ“ž Contact

  • GitHub Issues
  • Docs
  • Community

Made with ❀️

About

Seamlessly sync user address updates across multiple documents using Aadhaar as a base. Secure, fast, and built with FastAPI and Twilio integration. adsync.lunosis.xyz

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors