https://github.com/shobhit141141/esahayak
Esahayak buyers/leads management platform built on next js
https://github.com/shobhit141141/esahayak
jest mantine next postgresql prisma react redis tailwindcss typescript zod
Last synced: 3 months ago
JSON representation
Esahayak buyers/leads management platform built on next js
- Host: GitHub
- URL: https://github.com/shobhit141141/esahayak
- Owner: Shobhit141141
- License: mit
- Created: 2025-09-13T09:25:32.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-09-15T05:56:43.000Z (10 months ago)
- Last Synced: 2025-09-15T07:26:17.781Z (10 months ago)
- Topics: jest, mantine, next, postgresql, prisma, react, redis, tailwindcss, typescript, zod
- Language: TypeScript
- Homepage: https://esahayak-leads.vercel.app
- Size: 1.08 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ Esahayak Leads
## Buyers/leads managemnt platform
## ๐ Table of Contents
- [Tech Stack](#-tech-stack)
- [Features](#-features)
- [File Structure](#-file-structure)
- [Prerequisites](#-prerequisites)
- [Quick Start](#-quick-start)
- [Unit test](#-unit-test)
## ๐งฐ Tech Stack (badges)
        
## โจ Features
- **Demo Login with cookies**: Simple authentication using cookies
- **Import/Export by CSV**: data import/export functionality
- **Type Safety**: Fully typed database operations
- **ZOD validation**: Schema validation with Zod
- **Buyers Managementes**: CRUD operations for managing buyers with filters/sorting/pagination
- **Column specific sorting**: sort and filter data in tables for specific columns
- **Buyers history**: Track and view the history of buyer interactions
- **Admin/Agent Roles**: Different access levels for admins and agents
- **Concurrency Handling**: simultaneous data operations are managed
- **Error Boundaries**: Graceful error handling in components/pages.
- **Rate limiting using REDIS+IP**: based on requests by IP per minute.
- **Unit Testing**: Basic unit test setup with Jest.
## ๐ File Structure
```plaintext
esahayak/
src/
โโโ app/
โ โโโ api/ # API route handlers
โ โโโ buyers/ # Pages or components related to buyers
โ โโโ error/ # Additional error handling pages/components
โ โโโ users/ # Pages or components related to users
โ โโโ error.tsx # Global error boundary
โ โโโ globals.css # Global stylesheet
โ โโโ icon.ico # App icon
โ โโโ layout.tsx # Root layout component
โ โโโ not-found.tsx # 404 page
โ โโโ page.tsx # Main entry page
โโโ components/ # Reusable UI components
โโโ context/ # React context providers and hooks
โโโ generated/ # Auto-generated prisma client
โโโ lib/ # Utility libraries and services
โโโ types/ # TypeScript type definitions
โโโ utils/ # Helper functions
โโโ middleware.ts # Middleware logic
โโโ public/ # Static assets (images, fonts, etc.)
โโโ styles/ # Additional stylesheets
โโโ tests/ # Unit and integration tests
```
## ๐ Prerequisites
Before you begin, ensure you have:
- Node.js 18+ installed
- PostgreSQL database (local or cloud)
- Git installed
- npm or yarn package manager
## ๐ Quick Start
### 1. Clone the Repository
```bash
git clone https://github.com/Shobhit141141/esahayak.git
cd esahayak
```
### 2. Install Dependencies
```bash
npm install
```
### 3. Set Up Environment Variables
Copy a `.env.sample` in `.env` file at the root of your project and configure the following environment variables:
```env
DATABASE_URL="postgresql://USER:PASSWORD@HOST:PORT/DATABASE"
UPSTASH_REDIS_REST_URL="your-upstash-redis-url"
UPSTASH_REDIS_REST_TOKEN="your-upstash-redis-token"
```
### 4. Set Up the Database
Run the following commands to set up your database schema and generate the Prisma client:
```bash
npm run db:setup
```
This will:
- Run migrations (prisma migrate dev)
- Generate Prisma client (prisma generate)
### 5.Open prisma studio (Optional)
```bash
npm run prisma:studio
```
### 6. Start the Development Server
```bash
npm run dev
```
Open your browser and navigate to `http://localhost:3000` to see the application in action.
## ๐งช Unit Test
### 1. Create a Test File
Create a test file in the `utils/__tests__` directory (e.g., `__tests__/example.test.tsx`).
### 2. Write a Test
```tsx
import { render, screen } from "@testing-library/react";
import ExampleComponent from "../components/ExampleComponent";
test("renders example component", () => {
render();
expect(screen.getByText(/example/i)).toBeInTheDocument();
});
```
### 3. Run Tests
```bash
npx jest
```