# NTech [πŸ‡·πŸ‡Έ Srpska verzija](Readme_sr.md) ![Go Version](https://img.shields.io/badge/go-1.26-blue) ![License](https://img.shields.io/badge/license-MIT-green) image A business application for computer repair shop management, parts inventory tracking, and sales. Built with Go, it runs in the browser and requires no internet connection or external services. > ⚠️ The project is under active development. It is not ready for production use. --- ## About the Project NTech is an internal application built for a specific user β€” a computer repair shop that, in addition to repairs, manages a parts inventory, sales of components and pre-built configurations, as well as client and supplier records. The goal is simple: everything the repair shop needs to track is located in one place, without relying on Excel spreadsheets or paper records. --- ## Features ### Implemented - Initial setup on first run (setup wizard) - Database migration system - User interface β€” sidebar navigation, theme system (dark/light), dashboard with statistics - User login β€” server-side sessions, account locking - Two-factor authentication (TOTP) β€” activation with a QR code; secret encrypted at rest (AES-256-GCM, key kept outside the database) - Backup (one-time) codes for 2FA β€” generated on activation, stored as bcrypt hashes; a fallback to TOTP at login - Brute-force protection β€” IP locking after 5 failed attempts within 15 minutes - CSRF protection β€” double-submit cookie pattern, automatic token injection into all forms - Security HTTP headers (CSP, X-Frame-Options, Referrer-Policy, nosniff...) - Login attempt logging β€” history by user, IP, reason, date - Users and roles β€” admin panel, user management - Inventory β€” items, categories, filtering, critical stock levels - Service orders β€” intake, status bar, costs, receipt - Sales orders β€” items, calculation, receipt with company and client details - Procurement β€” records of purchases from suppliers - Sales price calculation on procurement β€” markup (global, per category, per item), landed costs (customs, shipping...) allocated across items, two-way markup↔price computation; respects VAT-payer status - Price revaluation (nivelacija) β€” sales price changes with an audit trail (oldβ†’new, reason, source, user) - Company profile and modules β€” features toggle based on company type and VAT-payer status - VAT records (KIR/KPR) β€” books of issued and received invoices, auto-filled from sales and procurement - VAT calculation per period + mapping to the PP-PDV form; imports (customs declaration) tracked in fields 006/106 - VAT rate code list - Clients and suppliers β€” contact database - Reminders β€” records with deadlines - Reports β€” revenue overview, inventory status - Settings β€” company name, address, Tax ID (PIB), logo; theme toggle - Background images β€” login page and app, with blur, transparency and glass effect - Personal theme and background β€” each user can set their own theme and background image - Permission matrix (RBAC) β€” admin panel for permissions by role; enforced at the route level (both mutations and views) and in handlers - Flash messages β€” one-time feedback after an action - Automatic SQLite backup β€” with configurable number of retained copies; restore from a copy (safe, with no downtime) - Charts β€” monthly revenue on reports (Chart.js) - Structured logging β€” `log/slog` (JSON in production, text in development); separate auth log in fail2ban format - Automated tests β€” unit and integration over a SQLite database (crypto, RBAC, login flows, form validators, reports) ### Planned - Fiscalization (ESIR/PFR) β€” specification in Project.md - KPO book and double-entry bookkeeping (optional, later phase) - PostgreSQL support (for multi-user environments) - WebAuthn / Passkey login (database schema is already prepared) - Notifications (email / WhatsApp) β€” deferred to a later phase - Barcode scanning via camera β€” deferred to a later phase --- ## Technologies | Technology | Role | | ------------------------------------------------------------------------------------ | ------------------------------- | | [Go](https://go.dev) | backend language | | [chi](https://github.com/go-chi/chi) | HTTP router | | [html/template](https://pkg.go.dev/html/template) | server-side templates | | [Alpine.js](https://alpinejs.dev) | client-side UI logic | | [SQLite](https://sqlite.org) + [modernc.org/sqlite](https://gitlab.com/cznic/sqlite) | main database (pure Go, no CGO) | | [PostgreSQL](https://www.postgresql.org) + [pgx/v5](https://github.com/jackc/pgx) | optional production database | --- ## Running the Application ### Requirements - Go 1.24 or newer - Git ### Steps ```bash # 1. Clone the repository git clone cd GoNtech # 2. Copy the configuration file cp ntech.env.example ntech.env # Open ntech.env and set the values (see the table below) # 3. Load environment variables and run in the development environment export $(grep -v '^#' ntech.env | xargs) go run ./cmd/ntech ```