Skip to content

Repository files navigation

TR · EN

Depolyx — Türkçe

Depolyx; ürün, depo, stok, alış-satış, cari hesap, tahsilat, ödeme ve kârlılık süreçlerini tek merkezde yöneten kurgusal işletme uygulamasıdır. Web MVP; Next.js, TypeScript ve doğrudan PostgreSQL üzerinde çalışır. Docker gerektirmez.

Mevcut durum

PostgreSQL destekli Web MVP; kimlik doğrulama, katalog, stok, alış/satış, finans, raporlama, kullanıcı yönetimi ve audit modüllerini içerir. Uygulama genelinde rol bazlı, ortak ve responsive bir header/navbar kullanılır. Android ve iOS istemcileri sonraki fazın kapsamındadır.

Özellikler

  • Rol bazlı güvenli oturum: yönetici, operasyon, finans ve görüntüleyici
  • Ürün, kategori, varyant, birim, SKU, barkod ve çoklu depo yönetimi
  • Doğrulamalı CSV katalog/başlangıç stoğu önizleme ve atomik içe aktarma
  • Append-only stok hareketleri, hareketli ortalama maliyet ve doğrulanabilir bakiye projection'ı
  • DRAFT, POSTED, CANCELED alış/satış belge yaşam döngüsü
  • Atomik stok ve cari etkileri, ters hareketli iptal ve idempotent kritik işlemler
  • Cari ekstre, tahsilat, ödeme, kasa/banka hareketleri ve çoklu/kısmi kapama
  • Düşük stok, gecikmiş vade, günlük kasa, stok değeri, satış ve brüt kâr raporları
  • Tarih/depo/iş ortağı filtreleri, CSV dışa aktarma ve yazdırma/PDF görünümü
  • Yöneticiye özel kullanıcı oluşturma, rol/durum yönetimi, parola yenileme ve oturum iptali
  • Filtrelenebilir append-only audit izi ve sunucu tarafında RBAC
  • Yetkiye göre otomatik süzülen, aktif ekranı gösteren ortak responsive navigasyon

Mimari

apps/web                 Next.js App Router web uygulaması ve /api/v1 REST API
apps/mobile              Faz 2 Capacitor kabuğu için ayrılan workspace
packages/domain          Roller, yetkiler ve domain sözleşmeleri
packages/validation      Ortak Zod giriş sözleşmeleri
packages/api-client      Paylaşılan API istemcisi ve OpenAPI v1 belgesi
packages/database        PostgreSQL, migration, seed, oturum ve audit
packages/catalog         Katalog ve CSV içe aktarma servisleri
packages/inventory       Append-only stok motoru ve projection
packages/trade           Alış/satış belge yaşam döngüsü
packages/finance         Cari, ödeme, kasa ve kapama servisleri
packages/reports         Dashboard ve salt-okunur rapor sorguları
packages/ui              Paylaşılabilir UI workspace'i
scripts                  Demo seed, kritik E2E ve güvenlik taraması

Akış UI → API → application service → PostgreSQL şeklindedir. Finansal ve stok mutasyonları UI'dan doğrudan veritabanına erişmez. Miktarlar NUMERIC(18,4), tutarlar NUMERIC(18,2) olarak hesaplanır; JavaScript kayan nokta aritmetiği finansal toplam üretmez.

Gereksinimler

  • Node.js 22+
  • npm 10+
  • PostgreSQL 15+

Yerel kurulum

DBeaver veya PostgreSQL aracınızla boş bir depolyx veritabanı oluşturun. Ardından:

cp .env.example .env
npm install
npm run db:migrate
npm run db:seed
npm run dev

PowerShell karşılığı:

Copy-Item .env.example .env
npm install
npm run db:migrate
npm run db:seed
npm run dev

.env içindeki DATABASE_URL değerini kendi yerel PostgreSQL kullanıcınıza göre düzenleyin. Uygulama varsayılan olarak http://localhost:3000 adresinde açılır. Yerel ağdan erişim gerekiyorsa npm run dev --workspace @depolyx/web -- -H 0.0.0.0 komutunu kullanın. Sağlık kontrolü /api/v1/health, OpenAPI belgesi /api/v1/openapi yolundadır.

Migration ve demo verisi

npm run db:migrate, sıralı SQL dosyalarını transaction, advisory lock ve SHA-256 checksum kontrolüyle uygular. Uygulanmış migration sonradan değiştirilirse komut başarısız olur.

npm run db:seed tekrar çalıştırılabilir şekilde şunları hazırlar:

  • Dört kurgusal rol hesabı
  • Birim ve depo referansları
  • Kurgusal toptancı ve perakendeci cari kartları
  • Filtre kahve ve termal etiket ürünleri
  • Onaylı alış, stok girişi, onaylı satış ve kısmi tahsilat akışı

Demo verilerinin tamamı kurgusaldır.

Demo hesapları

Tüm hesapların parolası DepolyxDemo!2026 değeridir.

Rol E-posta Yetki alanı
Yönetici admin@depolyx.local Tüm modüller
Operasyon operasyon@depolyx.local Katalog, stok, alış ve satış
Finans finans@depolyx.local Cari, tahsilat, ödeme ve vade
Görüntüleyici goruntuleyici@depolyx.local Dashboard ve raporlar

Temel ekranlar

  • / — Dashboard ve uyarılar
  • /catalog — Ürün ve depo yönetimi
  • /inventory — Stok bakiyeleri ve hareketler
  • /trade — Alış/satış belgeleri
  • /finance — Cari ve ödemeler
  • /reports — Rapor merkezi
  • /admin/users — Kullanıcı, rol, durum, parola ve oturum yönetimi
  • /admin/audit — Kullanıcı, işlem, kaynak ve tarih filtreli audit kayıtları

CSV ürün şablonu apps/web/public/catalog-import-template.csv dosyasındadır.

API

Sürümlü REST API /api/v1 altında sunulur. Öne çıkan uçlar:

  • /api/v1/auth/* — Giriş, çıkış ve oturum
  • /api/v1/catalog/* — Katalog ve CSV içe aktarma
  • /api/v1/inventory/* — Stok bakiyeleri ve hareketleri
  • /api/v1/trade/* — Alış/satış belge yaşam döngüsü
  • /api/v1/finance/* — Cari hesaplar, kasa ve ödemeler
  • /api/v1/reports/* — Dashboard, raporlar ve CSV dışa aktarma
  • /api/v1/users/* — Yöneticiye özel kullanıcı yönetimi
  • /api/v1/audit-events — Filtrelenebilir audit kayıtları

OpenAPI sözleşmesi /api/v1/openapi üzerinden alınabilir.

Doğrulama komutları

npm run lint
npm run typecheck
npm test
npm run security:scan
npm run build

Çalışan bir uygulamaya karşı ürün girişinden satış ve tahsilata; kullanıcı oluşturma, RBAC, pasifleştirme ve audit doğrulamasına kadar kritik API akışı:

E2E_BASE_URL=http://127.0.0.1:3000 npm run test:e2e

PowerShell:

$env:E2E_BASE_URL = "http://127.0.0.1:3000"
npm run test:e2e

npm run check; lint, type-check, test, secret/PII/lisans/bağımlılık taraması ve production build adımlarını birlikte çalıştırır. CI ayrıca production sunucusunu başlatıp kritik E2E akışını yürütür.

Production çalıştırma

npm ci
npm run db:migrate
npm run db:seed
npm run build
npm run start --workspace @depolyx/web -- --hostname 0.0.0.0

Production ortamında güçlü PostgreSQL bilgileri, HTTPS/TLS, ters proxy ve secret yöneticisi kullanın. Production oturum çerezi Secure olduğu için uygulama HTTPS üzerinden sunulmalıdır. .env dosyaları Git tarafından dışlanır.

Güvenlik

  • Oturum belirteçlerinin yalnız SHA-256 özeti veritabanında saklanır.
  • Cookie HttpOnly, SameSite=Strict; production'da Secure olarak ayarlanır.
  • Yetki kontrolleri yalnız UI'da değil bütün API mutasyonlarında uygulanır.
  • Kullanıcı değişiklikleri optimistic version ile korunur; son yönetici ve kendi hesabını kilitleme engellenir.
  • Rol, aktiflik veya parola değişikliklerinde ilgili kullanıcının oturumları iptal edilir.
  • Audit, stok, cari, ödeme ve kasa hareketleri append-only korunur.
  • Kritik mutasyonlar idempotency anahtarı ve PostgreSQL kilitleri kullanır.
  • CI secret, PII, bağımlılık lisansı ve npm audit kontrolleri çalıştırır.

Bilinen sınırlar

MVP; tek işletme, TRY ve birden fazla depo içindir. E-fatura, resmî muhasebe, vergi beyanı, banka/POS, e-ticaret, çoklu para birimi ve çok şirketli konsolidasyon kapsam dışıdır.


Depolyx — English

Depolyx is a fictional business application that manages products, warehouses, inventory, purchasing, sales, partner accounts, collections, payments, and profitability in one place. The web MVP runs on Next.js, TypeScript, and a direct PostgreSQL connection; Docker is not required.

Current status

The PostgreSQL-backed Web MVP includes authentication, catalog, inventory, trade, finance, reporting, user management, and audit modules. Every authenticated screen uses the same responsive, role-aware header and navigation. Android and iOS clients belong to the next phase.

Features

  • Secure role-based sessions for administrators, operations, finance, and read-only viewers
  • Product, category, variant, unit, SKU, barcode, and multi-warehouse management
  • Validated two-step CSV preview and atomic catalog/opening-stock import
  • Append-only stock movements, moving weighted-average cost, and a verifiable balance projection
  • DRAFT, POSTED, and CANCELED purchase/sale document lifecycle
  • Atomic inventory/account effects, reversal-based cancellation, and idempotent critical mutations
  • Partner statements, collections, payments, cash/bank movements, and partial or multi-item allocation
  • Low-stock and overdue alerts plus daily cash, inventory value, sales, and gross-profit reports
  • Date, warehouse, and partner filters; CSV export; print/PDF view
  • Administrator-only user creation, role/status management, password resets, and session revocation
  • Filterable append-only audit trail and server-side RBAC
  • Shared responsive navigation that filters links by permission and highlights the active screen

Architecture

apps/web                 Next.js App Router web app and /api/v1 REST API
apps/mobile              Workspace reserved for the Phase 2 Capacitor shell
packages/domain          Roles, permissions, and domain contracts
packages/validation      Shared Zod input contracts
packages/api-client      Shared API client and OpenAPI v1 contract
packages/database        PostgreSQL, migrations, seed, sessions, and audit
packages/catalog         Catalog and CSV import services
packages/inventory       Append-only stock engine and projection
packages/trade           Purchase/sale document lifecycle
packages/finance         Partner, payment, cash, and allocation services
packages/reports         Dashboard and read-only reporting queries
packages/ui              Shared UI workspace
scripts                  Demo seed, critical E2E, and security scans

The request flow is UI → API → application service → PostgreSQL. Financial and stock mutations never access the database directly from the UI. Quantities use NUMERIC(18,4) and financial totals use NUMERIC(18,2); JavaScript floating-point arithmetic is not used for monetary totals.

Requirements

  • Node.js 22+
  • npm 10+
  • PostgreSQL 15+

Local setup

Create an empty PostgreSQL database named depolyx, then run:

cp .env.example .env
npm install
npm run db:migrate
npm run db:seed
npm run dev

On PowerShell, use Copy-Item .env.example .env for the first command. Update DATABASE_URL in .env for your local PostgreSQL credentials. The app opens at http://localhost:3000. To expose the development server on your local network, run npm run dev --workspace @depolyx/web -- -H 0.0.0.0. Health and OpenAPI endpoints are /api/v1/health and /api/v1/openapi.

Migrations and fictional demo data

npm run db:migrate applies ordered SQL migrations with a transaction, advisory lock, and SHA-256 checksum verification.

npm run db:seed is repeatable and creates fictional role accounts, units, warehouses, wholesale/retail partners, products, a posted purchase, stock, a posted sale, and a partial collection. No real person or company data is included.

All demo accounts use the password DepolyxDemo!2026.

Role Email Scope
Administrator admin@depolyx.local All modules
Operations operasyon@depolyx.local Catalog, stock, purchasing, and sales
Finance finans@depolyx.local Partner accounts, collections, payments, and due dates
Viewer goruntuleyici@depolyx.local Dashboard and reports

Main screens

  • / — Dashboard and alerts
  • /catalog — Product and warehouse management
  • /inventory — Stock balances and movements
  • /trade — Purchase and sale documents
  • /finance — Partner accounts and payments
  • /reports — Reporting center
  • /admin/users — User, role, status, password, and session management
  • /admin/audit — Audit events filtered by user, action, source, and date

The catalog import template is apps/web/public/catalog-import-template.csv.

API

The versioned REST API is available under /api/v1. Main endpoint groups include:

  • /api/v1/auth/* — Login, logout, and session
  • /api/v1/catalog/* — Catalog and CSV import
  • /api/v1/inventory/* — Stock balances and movements
  • /api/v1/trade/* — Purchase/sale document lifecycle
  • /api/v1/finance/* — Partner accounts, cash, and payments
  • /api/v1/reports/* — Dashboard, reports, and CSV export
  • /api/v1/users/* — Administrator-only user management
  • /api/v1/audit-events — Filterable audit events

The OpenAPI contract is served from /api/v1/openapi.

Verification

npm run lint
npm run typecheck
npm test
npm run security:scan
npm run build

Run the critical product-to-sale-to-collection flow plus user creation, RBAC, deactivation, and audit verification against a running app:

E2E_BASE_URL=http://127.0.0.1:3000 npm run test:e2e

npm run check combines linting, type checking, tests, secret/PII/license/dependency scans, and the production build. CI also starts the production server and executes the critical E2E flow.

Production

npm ci
npm run db:migrate
npm run db:seed
npm run build
npm run start --workspace @depolyx/web -- --hostname 0.0.0.0

Use strong PostgreSQL credentials, HTTPS/TLS, a reverse proxy, and a secret manager in production. The production session cookie is Secure, so the application must be served over HTTPS. .env files are excluded from Git.

Security and limitations

Session tokens are stored only as SHA-256 hashes. Cookies are HttpOnly, SameSite=Strict, and Secure in production. API mutations enforce server-side RBAC. User updates use optimistic versions; self-lockout and removal of the final active administrator are blocked. Role, active-state, and password changes revoke the affected sessions. Audit, stock, account, payment, and cash records are append-only. Critical mutations use idempotency keys and PostgreSQL locking.

The MVP targets one company, TRY, and multiple warehouses. E-invoicing, statutory accounting, tax filing, bank/POS integrations, e-commerce, multiple currencies, and multi-company consolidation are outside scope.

About

Inventory, sales and payments in sync.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages