NearBuy is a location-based application that helps users discover nearby shops (within a 2β5 meter radius) that stock specific items β like βMaggieβ, βbatteriesβ, or βcoffee sachetsβ β with real-time availability, quantity, and shop status.
The project consists of a robust FastAPI backend and a modern Next.js frontend.
- β‘ Fast Geo-Search: Powered by Typesense, find shops within a given radius that stock a specific item.
- π Real-Time Inventory: Track stock levels per shop, per item.
- π Accurate Spatial Queries: Uses PostGIS for precise location data management.
- πΊοΈ Interactive Maps: Visualize shop locations and search results on a map.
- π Role-Based Auth: Secure cookie-based authentication for Users, Vendors, and Contributors.
- π± Modern UI: Responsive design built with Next.js, Tailwind CSS, and Framer Motion.
- π³ Fully Containerized: Docker support for consistent development and deployment.
- Framework: FastAPI
- Database: PostgreSQL + PostGIS
- Search: Typesense
- ORM: SQLAlchemy (Async) + SQLModel
- Migrations: Alembic
- Framework: Next.js 16 (App Router)
- Styling: Tailwind CSS v4
- Maps: Leaflet (React Leaflet)
- State/Validation: React Hook Form, Zod
- Docker & Docker Compose
- Node.js 18+ (for local frontend)
- Python 3.10+ (for local backend)
The easiest way to run the full stack (Backend + DB + Search) is via Docker.
# Clone the repository
git clone https://github.com/iamrahulroyy/NearBuy
cd NearBuy
# Start the services
docker-compose up --buildcd NearBuy
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # or .venv\Scripts\activate on Windows
# Install dependencies
pip install -r requirements.txt
# Run the server
python main.pycd frontend
# Install dependencies
npm install
# Run the development server
npm run devNEARBUY/
βββ app/ # Backend Source Code
β βββ api/ # API Endpoints
β βββ core/ # Config & Security
β βββ db/ # Database Models
β βββ services/ # Business Logic
βββ frontend/ # Frontend Source Code
β βββ src/app/ # Next.js Pages
β βββ src/components/ # UI Components
βββ scripts/ # Seeding & Utility Scripts
βββ alembic/ # Database Migrations
βββ docker-compose.yml # Docker Services Config
βββ README.md # Project Documentation
Pull requests are welcome! Please ensure your code follows the project's style guidelines.
MIT Β© Rahul Roy