// ==========================================================
// Vamos criar seu projeto?
// ==========================================================
$ npx create-next-app@latest aliadus-erp --typescript --tailwind --eslint
Creating a new Next.js project in aliadus-erp...
Installing dependencies: react, react-dom, next, typescript, @types/react, @types/node
added 243 packages in 32s
$ cd aliadus-erp
$ npm install prisma @prisma/client
added 5 packages in 8s
$ npx prisma init
✔ Your Prisma schema was created at prisma/schema.prisma
$ npm install @auth/prisma-adapter next-auth
added 12 packages in 15s
$ npm install zustand react-hook-form @hookform/resolvers zod
added 8 packages in 6s
$ npm install lucide-react clsx tailwind-merge
added 4 packages in 3s
$ npm install @tanstack/react-query axios
added 6 packages in 5s
$ npm install date-fns react-datepicker
added 3 packages in 4s
$ npm install recharts react-table
added 7 packages in 7s
$ npm install --save-dev @types/node
added 1 package in 2s
// ==========================================================
// Configurando Prisma Schema...
// ==========================================================
model User { id String @id @default(cuid()) name String? email String @unique password String role Role @default(USER) createdAt DateTime @default(now()) }
model Company { id String @id @default(cuid()) name String cnpj String @unique users User[] createdAt DateTime @default(now()) }
model Product { id String @id @default(cuid()) name String code String @unique price Decimal stock Int companyId String }
model Order { id String @id @default(cuid()) customerId String total Decimal status OrderStatus items OrderItem[] createdAt DateTime @default(now()) }
$ npx prisma db push
✔ Your database is now in sync with your Prisma schema
// ==========================================================
// ALIADUS ERP - Enterprise Resource Planning System v2.0
// ==========================================================
class
ERPSystem {
constructor(config) { this.modules = []; this.database = new Database(); this.auth = new AuthService(); }
async initialize() { await this.database.connect(); await this.auth.setup(); this.loadModules(); }
loadModules() { this.modules = [new FinanceModule(), new InventoryModule(), new HRModule(), new SalesModule()]; }
}
class
FinanceModule {
constructor() { this.accounts = []; this.transactions = []; this.reports = []; }
async createAccount(data) { const account = { id: generateId(), name: data.name, type: data.type, balance: 0 }; this.accounts.push(account); return account; }
async processTransaction(tx) { const account = this.accounts.find(a => a.id === tx.accountId); if (!account) throw new Error("Account not found"); account.balance += tx.amount; this.transactions.push(tx); }
async generateReport(period) { const txs = this.transactions.filter(t => t.date >= period.start && t.date <= period.end); return { total: txs.reduce((sum, t) => sum + t.amount, 0), count: txs.length }; }
}
class
InventoryModule {
constructor() { this.products = []; this.warehouses = []; this.movements = []; }
async addProduct(product) { this.products.push({ ...product, id: generateId(), stock: 0, minStock: product.minStock || 10 }); }
async updateStock(productId, qty, type) { const product = this.products.find(p => p.id === productId); product.stock += qty; this.movements.push({ productId, qty, type, date: new Date() }); }
async checkLowStock() { return this.products.filter(p => p.stock <= p.minStock).map(p => ({ id: p.id, name: p.name, stock: p.stock })); }
}
class
HRModule {
constructor() { this.employees = []; this.departments = []; this.attendance = []; this.payroll = []; }
async hireEmployee(employee) { this.employees.push({ ...employee, id: generateId(), status: "active", hireDate: new Date() }); }
async processPayroll(month) { const payroll = this.employees.map(e => ({ employeeId: e.id, salary: e.salary, deductions: this.calculateDeductions(e), net: e.salary - this.calculateDeductions(e) })); return payroll; }
calculateDeductions(employee) { return employee.salary * 0.11 + (employee.salary > 5000 ? employee.salary * 0.075 : 0); }
async recordAttendance(employeeId, date, status) { this.attendance.push({ employeeId, date, status, timestamp: new Date() }); }
}
class
SalesModule {
constructor() { this.orders = []; this.customers = []; this.invoices = []; this.quotes = []; }
async createOrder(order) { const newOrder = { ...order, id: generateId(), status: "pending", createdAt: new Date() }; this.orders.push(newOrder); return newOrder; }
async updateOrderStatus(orderId, status) { const order = this.orders.find(o => o.id === orderId); order.status = status; order.updatedAt = new Date(); }
async generateInvoice(orderId) { const order = this.orders.find(o => o.id === orderId); const invoice = { id: generateId(), orderId, amount: order.total, status: "issued" }; this.invoices.push(invoice); return invoice; }
}
const
erp = new ERPSystem({ env: "production", dbUrl: "postgresql://prod-db.aliadus.com", apiKey: "****" });
await
erp.initialize();
// ==========================================================
// ERP System Successfully Initialized - Production Mode
// Modules: Finance, Inventory, HR, Sales, Purchase, Reports
// Database: Connected | Auth: Enabled | Cache: Active
// ==========================================================
Inovação que Transforma
Soluções tecnológicas avançadas para impulsionar o seu negócio. Inteligência artificial, segurança digital e muito mais.
Conheça Nossos Sistemas