Skip to content

farhan-6710/slooze

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

Slooze — Commodities Management System

Full-stack commodities management with role-based access control. Built with NestJS + GraphQL + Prisma (backend) and Next.js + Apollo Client (frontend).


🚀 Getting Started

Prerequisites

Node.js v18+ or Bun

First-Time Setup (Required for Everyone)

# Clone repository
git clone <repository-url> && cd slooze

# Setup Environment Variables
cp server/.env.example server/.env
cp client/.env.local.example client/.env.local

# Setup Backend
cd server
npm install && npx prisma generate && npx prisma db push && npm run seed
bun install && bunx prisma generate && bunx prisma db push && bun run seed  # Alternative

# Setup Frontend
cd ../client
npm install
bun install  # Alternative

Daily Development

# Terminal 1 - Backend (port 4000)
cd server
npm run start:dev
bun run start:dev  # Alternative

# Terminal 2 - Frontend (port 3000)
cd client
npm run dev
bun run dev  # Alternative

GraphQL Playground: http://localhost:4000/graphql

Environment Files

The repository includes .env.example files with default development values:

  • server/.env.example → Copy to server/.env
  • client/.env.local.example → Copy to client/.env.local

Both files are pre-configured for local development. You only need to change JWT_SECRET in production.

Demo Credentials

Email Password Role
manager@slooze.com password Manager (Dashboard + Products)
storekeeper@slooze.com password Store Keeper (Products only)

✨ Features

  • Auth: JWT authentication with role-based access (Manager, Store Keeper)
  • Dashboard: Product stats, category distribution, stock alerts (Manager only)
  • Products: CRUD operations, search/filter, real-time updates
  • UI: Light/dark theme, modal forms, responsive design (shadcn/ui)

🛠️ Tech Stack

Frontend: Next.js 16, TypeScript, Apollo Client, Tailwind v4, shadcn/ui
Backend: NestJS 10, GraphQL (code-first), Prisma 5, SQLite, JWT


📋 Common Commands

When to Run

Command When Purpose
npm install or bun install First time / new deps Install packages
npx prisma generate or bunx prisma generate First time / schema changes Generate Prisma types
npx prisma db push or bunx prisma db push First time / schema changes Update database
npm run seed or bun run seed First time / reset data Seed demo data
npm run start:dev or bun run start:dev Daily Start dev server

Database Management

# Open database GUI (localhost:5555)
npx prisma studio
bunx prisma studio  # Alternative

# Reset database
rm prisma/dev.db && npx prisma db push && npm run seed
rm prisma/dev.db && bunx prisma db push && bun run seed  # Alternative

🔌 GraphQL API Examples

# Login
mutation {
  login(input: { email: "manager@slooze.com", password: "password" }) {
    token
    user {
      name
      role
    }
  }
}

# Get Products
query {
  products {
    id
    name
    sku
    category
    price
    quantity
    status
  }
}

# Dashboard Stats (Manager only)
query {
  dashboardStats {
    totalProducts
    lowStockCount
    totalInventoryValue
  }
}

# Create Product
mutation {
  createProduct(
    input: {
      name: "Rice"
      sku: "RICE-001"
      category: "Grains"
      price: 45.99
      quantity: 250
      status: "ACTIVE"
    }
  ) {
    id
  }
}

🐛 Troubleshooting

Port in use: lsof -ti:4000 | xargs kill -9 (server) or lsof -ti:3000 | xargs kill -9 (client)
Database issues: Delete server/prisma/dev.db, run npx prisma db push && npm run seed (or bunx prisma db push && bun run seed)
Auth errors: Clear browser localStorage, verify server is running


📚 Documentation

© Slooze. All Rights Reserved. | careers@slooze.xyz

About

Slooze is a full-stack commodities management system with role-based access for managers and storekeepers, featuring dashboards, stock alerts, and product CRUD with real-time updates over a NestJS + GraphQL + Prisma backend and a Next.js + Apollo Client frontend.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors