Skip to content

abnahid/Zenvira

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zenvira Logo

Zenvira

A Modern Full-Stack Pharmaceutical E-Commerce Platform

FeaturesTech StackGetting StartedDocumentationContributing

Next.js React Express Prisma PostgreSQL TypeScript


Overview

Zenvira is a comprehensive, production-ready pharmaceutical e-commerce platform that connects customers with verified medication sellers. Built with modern technologies and best practices, it provides a seamless shopping experience with robust seller management, order processing, and administrative controls.

Why Zenvira?

  • Multi-vendor Marketplace: Support for multiple sellers with individual dashboards
  • Role-based Access Control: Customer, Seller, and Admin roles with specific permissions
  • Real-time Stock Management: Automatic inventory tracking and prevention of overselling
  • Secure Authentication: Email verification, password reset, and session management
  • Production Ready: Optimized for deployment on Vercel with serverless architecture

Features

For Customers

  • Browse and search medicines with advanced filtering
  • Add products to cart and wishlist
  • Place orders with multiple payment options
  • Track order status in real-time
  • Write and read product reviews
  • Email-based account verification

For Sellers

  • Apply to become a verified seller
  • Manage product listings (CRUD operations)
  • View and process orders
  • Access sales analytics and statistics
  • Track customer reviews

For Administrators

  • Review and approve seller applications
  • Manage all users, products, and orders
  • Platform-wide analytics dashboard
  • Category management
  • Full access control

Tech Stack

Frontend (zenvira-client)

Technology Version Purpose
Next.js 16.1.6 React meta-framework with App Router
React 19.2.3 UI library
TypeScript 5.x Type safety
TailwindCSS 4.x Utility-first CSS
shadcn/ui 3.8.0 Component library
Radix UI 1.4.3 Accessible UI primitives
Better Auth 1.4.18 Authentication client

Backend (server)

Technology Version Purpose
Express.js 5.2.1 Web framework
Prisma 7.3.0 ORM with PostgreSQL
PostgreSQL 15+ Primary database
Better Auth 1.4.18 Authentication server
Nodemailer 7.0.13 Email services
bcrypt 6.0.0 Password hashing

Project Structure

Zenvira/
├── zenvira-client/          # Next.js frontend application
│   ├── src/
│   │   ├── app/             # App Router pages
│   │   ├── components/      # Reusable React components
│   │   ├── context/         # React Context providers
│   │   ├── lib/             # Utilities and configurations
│   │   └── data/            # Static data
│   └── public/              # Static assets
│
├── server/                  # Express.js backend API
│   ├── src/
│   │   ├── routes/          # API route handlers
│   │   ├── middleware/      # Authentication middleware
│   │   └── lib/             # Prisma client and auth config
│   ├── prisma/              # Database schema and migrations
│   └── api/                 # Vercel serverless functions
│
├── docs/                    # Documentation
└── README.md                # This file

Getting Started

Prerequisites

  • Node.js >= 20.0.0
  • npm or yarn or pnpm
  • PostgreSQL >= 15
  • Git

Environment Setup

1. Clone the Repository

git clone https://github.com/abnahid/Zenvira.git
cd Zenvira

2. Backend Setup (Server)

# Navigate to server directory
cd server

# Install dependencies
npm install

# Create environment file
cp .env.example .env

Configure your .env file:

# Database
DATABASE_URL="postgresql://user:password@localhost:5432/zenvira?schema=public"

# Authentication
BETTER_AUTH_SECRET="your-secret-key-min-32-characters"
BETTER_AUTH_URL="http://localhost:5000"

# CORS
TRUSTED_ORIGIN="http://localhost:3000"

# Email (Gmail SMTP)
SMTP_USER="your-email@gmail.com"
SMTP_PASS="your-app-password"
SMTP_FROM_EMAIL="noreply@zenvira.com"
# Run database migrations
npm run db:migrate

# Seed database (optional)
npx prisma db seed

# Start development server
npm run dev

The API server will be running at http://localhost:5000

3. Frontend Setup (Client)

# Navigate to client directory (from root)
cd zenvira-client

# Install dependencies
npm install

# Create environment file
cp .env.example .env.local

Configure your .env.local file:

NEXT_PUBLIC_API_BASE_URL="http://localhost:5000"
# Start development server
npm run dev

The client will be running at http://localhost:3000


API Documentation

Base URL

  • Development: http://localhost:5000/api
  • Production: https://your-domain.vercel.app/api

Authentication Endpoints

Method Endpoint Description
POST /api/auth/sign-up/email Register new user
POST /api/auth/sign-in/email Login user
POST /api/auth/sign-out Logout user
GET /api/auth/session Get current session

Medicine Endpoints

Method Endpoint Description
GET /api/medicines Get all medicines (with filters)
GET /api/medicines/:slug Get medicine by slug
POST /api/medicines Create medicine (seller/admin)
PUT /api/medicines/:id Update medicine
DELETE /api/medicines/:id Delete medicine

Order Endpoints

Method Endpoint Description
GET /api/orders Get user's orders
POST /api/orders Create new order
PUT /api/orders/:id/status Update order status
DELETE /api/orders/:id Cancel order

For complete API documentation, see docs/api-contract.md


Deployment

Deploying to Vercel

Backend

cd server
vercel --prod

Required environment variables in Vercel:

  • DATABASE_URL (with ?sslmode=require)
  • BETTER_AUTH_SECRET
  • BETTER_AUTH_URL
  • TRUSTED_ORIGIN
  • SMTP_USER
  • SMTP_PASS

Frontend

cd zenvira-client
vercel --prod

Required environment variables:

  • NEXT_PUBLIC_API_BASE_URL

Database Schema

┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│    User     │────<│   Order     │────<│  OrderItem  │
└─────────────┘     └─────────────┘     └─────────────┘
      │                                        │
      │ 1:N                                    │ N:1
      ▼                                        ▼
┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   Review    │     │  Category   │────<│  Medicine   │
└─────────────┘     └─────────────┘     └─────────────┘
      │                                        │
      └────────────────────────────────────────┘
                         N:1

Scripts

Server Scripts

Script Description
npm run dev Start development server with hot reload
npm run build Build for production
npm start Start production server
npm run db:migrate Run database migrations
npm run db:push Push schema changes
npm run db:studio Open Prisma Studio

Client Scripts

Script Description
npm run dev Start development server
npm run build Build for production
npm start Start production server
npm run lint Run ESLint

Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Security

For security vulnerabilities, please see our Security Policy.


License

This project is licensed under the MIT License - see the LICENSE file for details.


Author

abnahid

Abdul Jabbar Al Nahid
Student of Level-6
abnahid.com

GitHub LinkedIn Website


Acknowledgments


Made with ❤️ by abnahid

Back to top ↑

About

Zenvira is a comprehensive, production-ready pharmaceutical e-commerce platform that connects customers with verified medication sellers. Built with modern technologies and best practices, it provides a seamless shopping experience with robust seller management, order processing, and etc

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages