Λογιστικό κομμάτι
Open source accounting application to use in Greece
Here’s a list of open-source accounting applications you can consider if you’re operating in Greece (suitable for small businesses, SMEs or self-employed users). Open-source software gives you access to the source code, can be self-hosted, and can be more flexible than proprietary alternatives — but may require some technical setup and adaptation to local Greek accounting/tax requirements. 
⸻
📊 Open-Source Accounting & ERP Systems
🧾 1. GnuCash • Mature open-source accounting app for personal and small business accounting (double-entry bookkeeping). • Works on Windows, macOS, Linux. • Handles income/expenses, reconciliations, invoicing, reports and multiple currencies. • Great for freelancers & small enterprises that don’t need full ERP. 
👉 Good if you want a simple, standalone accounting tool you can run locally without subscription fees.
⸻
📊 2. Manager.io • Free accounting software with desktop and optional cloud versions. • Desktop edition is free and full-featured, including invoices, general ledger, VAT, cash flow, etc. • Open source (code is accessible) and popular with freelancers & SMEs. 
👉 Strong choice for businesses that want a modern GUI and straightforward setup.
⸻
🧑💼 3. ERPNext • Full open-source ERP suite with a comprehensive accounting module (plus CRM, inventory & payroll). • Scales from small enterprises up to larger companies. • Web-based architecture makes it suitable for hosted or on-premises deployment. 
👉 Best if you want integrated accounting + ERP and are willing to do a bit of configuration.
⸻
📒 4. LedgerSMB • Open-source double-entry accounting & ERP system with browser-based UI. • Built for small/medium businesses with features like accounts payable/receivable, multi-currency support, invoices, reports, inventory and more. • Uses PostgreSQL and can be hosted locally or in the cloud. 
👉 Good for business owners comfortable with web server setups.
⸻
💡 Other Tools to Consider
🧠 Dolibarr • Modular ERP + CRM platform with basic accounting features (invoicing, payments, bank reconciliation). • Open source and extensible. 
👉 Works well if you also want CRM/ERP alongside accounting.
⸻
🧩 Notes on Using These in Greece • Local tax compliance (AADE / myDATA): None of the above open-source tools natively connect to the Greek tax authority (AADE) or myDATA reporting — you’ll likely need either an add-on, custom integration, or to export data for submission through compliant software. • Support & localization: Open source solutions often require some configuration for Greek chart of accounts, VAT rules, and tax forms. It’s advisable to work with a local IT service or accountant familiar with these tools. • Alternatives: Commercial Greece-focused solutions like Epsilon Smart focus on myDATA compliance (not open source but directly integrated). 
⸻
🧠 Quick Choice Guide • Simple & free for small business: GnuCash or Manager.io • More advanced / integrated: ERPNext or LedgerSMB • ERP + CRM needs: Dolibarr
⸻
If you tell me the size of your business (e.g., freelancer, small company, medium enterprise) and specific needs (e.g., invoicing, VAT reporting, inventory, payroll), I can recommend the best fit and setup tips tailored for Greece.
How should I structure db on my pern app to make accounting ledger for many users separately?
To design a multi-tenant accounting ledger in a PERN stack (PostgreSQL + Express + React + Node.js), you want: • Strong isolation between users/organizations • Double-entry accounting correctness • Scalable querying for reports • Auditability
Below is a production-grade schema approach used in real accounting systems.
⸻
- First Decision: Multi-Tenant Strategy
You have 3 options:
A. Shared DB, Shared Tables (Most Common)
Add tenant_id (organization_id) to all tables.
✔ Simple ✔ Easy reporting across tenants ✔ Cheap infra ✘ Must enforce row-level security
Recommended for most PERN SaaS apps.
⸻
B. Shared DB, Separate Schemas
Each tenant has its own PostgreSQL schema.
✔ Strong isolation ✘ Hard migrations ✘ Hard analytics
Use if tenants are large enterprises.
⸻
C. Separate Databases
✔ Maximum isolation ✘ Operational complexity
Use only for very large SaaS.
⸻
👉 For PERN apps: Option A with Row-Level Security (RLS).
⸻
- Core Accounting Principle
Use double-entry accounting.
Every transaction must have:
Total Debits = Total Credits
So we model: • Accounts • Transactions • Journal Entries (lines)
⸻
- Recommended PostgreSQL Schema
3.1 Tenants & Users
tenants
id (uuid pk) name created_at
users
id email password_hash
user_tenants
user_id tenant_id role
This allows multiple users per company.
⸻
3.2 Chart of Accounts
accounts
id tenant_id code -- 1000 Cash name type -- asset/liability/equity/revenue/expense parent_id -- for hierarchy currency created_at
Why hierarchy?
Example:
Assets Cash Bank
⸻
3.3 Transactions
High-level business event.
transactions
id tenant_id date description reference created_by created_at
Example: Invoice payment.
⸻
3.4 Journal Entries (Ledger Lines)
Actual accounting records.
journal_entries
id tenant_id transaction_id account_id debit NUMERIC(18,2) credit NUMERIC(18,2) currency created_at
Constraint:
CHECK (debit = 0 OR credit = 0)
And enforce balancing in backend.
⸻
3.5 Optional Tables
Customers / Vendors
contacts
id tenant_id name type -- customer/vendor
Invoices
invoices
id tenant_id contact_id amount status
Invoices generate transactions.
⸻
- Enforcing Tenant Isolation
Use PostgreSQL Row-Level Security.
Example:
ALTER TABLE accounts ENABLE ROW LEVEL SECURITY;
CREATE POLICY tenant_isolation ON accounts USING (tenant_id = current_setting('app.tenant_id')::uuid);
In Express middleware:
await db.query("SET app.tenant_id = $1", [tenantId]);
This prevents cross-tenant leaks.
⸻
- Indexing Strategy
Critical for ledger performance.
CREATE INDEX idx_entries_tenant_date ON journal_entries(tenant_id, created_at);
CREATE INDEX idx_entries_account ON journal_entries(account_id);
⸻
- Ledger Queries
Account Balance
SELECT account_id, SUM(debit - credit) AS balance FROM journal_entries WHERE tenant_id = $1 GROUP BY account_id;
⸻
Trial Balance
SELECT a.code, a.name, SUM(e.debit) AS total_debit, SUM(e.credit) AS total_credit FROM accounts a JOIN journal_entries e ON a.id = e.account_id WHERE a.tenant_id = $1 GROUP BY a.code, a.name;
⸻
- Important Accounting Rules
Never update journal entries
Use reversing entries instead.
Add:
reversed_entry_id
Auditability matters.
⸻
Use immutable transactions
Add:
locked BOOLEAN DEFAULT false
After posting, lock transaction.
⸻
Use timestamps everywhere
Needed for audit logs and reports.
⸻
- Scaling Tips
If you expect millions of entries: • Partition journal_entries by tenant_id or date. • Use materialized views for balances. • Cache account balances.
⸻
- PERN Backend Structure
Example Node service layers:
/services ledgerService.js transactionService.js reportService.js
Never let React call ledger tables directly.
⸻
- Example Flow
User pays invoice: 1. Create transaction 2. Insert journal entries:
Debit Cash 100 Credit Accounts Receivable 100
3. Lock transaction
⸻
- Common Mistakes to Avoid
❌ One table per user ❌ Updating ledger rows ❌ Not enforcing debit=credit ❌ Mixing currencies without fx table ❌ No audit trail
⸻
- If You Need Advanced Accounting
Add: • Fiscal periods • VAT tables • Multi-currency FX rates • Inventory ledger • Cost centers • Budgets
⸻
- If You Want, I Can Next Provide • Full SQL schema • Prisma schema • Sequelize models • React UI structure • Example posting logic
Just tell me 👍
If I would like to have 5000000 users is the one db shared tables ok?
Short answer: Yes — one PostgreSQL database with shared tables and tenant_id is usually fine for 5,000,000 users, if designed correctly. But the real constraint is transactions per second + ledger rows, not raw user count.
Below is how to reason about it like a systems architect.
⸻
- What Matters More Than User Count
For an accounting ledger, scaling depends on:
Metric Why it matters Active tenants Isolation overhead Ledger rows Table size + index bloat Writes/sec WAL + locking Reads/reporting Query cost Tenant size distribution “Whales” vs small users
Example: • 5M users • Avg 100 journal entries/year → 500M ledger rows/year
This is big but totally doable for PostgreSQL with partitioning.
Postgres installations routinely handle billions of rows.
⸻
- When Shared Tables Are Still OK
Shared tables with tenant_id works if:
✔ You implement: 1. Partitioning 2. Proper indexes 3. Row-Level Security 4. Connection pooling 5. Async reporting
Then you can scale far beyond 5M users.
Many SaaS companies do this.
⸻
- Recommended Architecture for 5M Users
3.1 Partition the Ledger Table
Ledger is the biggest table.
Partition by:
Option A — By tenant hash
PARTITION BY HASH (tenant_id)
Pros: • Even distribution • Good for many small tenants
⸻
Option B — By date + tenant
PARTITION BY RANGE (created_at)
Pros: • Faster reports by period • Archiving easy
⸻
Example
CREATE TABLE journal_entries ( id BIGSERIAL, tenant_id UUID, account_id UUID, debit NUMERIC, credit NUMERIC, created_at TIMESTAMP ) PARTITION BY HASH (tenant_id);
Create 32–128 partitions.
This avoids giant indexes.
⸻
3.2 Use Composite Indexes
CREATE INDEX idx_entries_tenant_account ON journal_entries (tenant_id, account_id);
CREATE INDEX idx_entries_tenant_date ON journal_entries (tenant_id, created_at);
Without tenant-first indexes, performance dies.
⸻
3.3 Connection Pooling
Use: • PgBouncer • node-postgres pool
Because 5M users ≠ 5M connections.
⸻
3.4 Async Reporting
Trial balance on 500M rows is expensive.
Use: • Materialized views • Cached balances • Event-driven updates
Example:
account_balances
tenant_id account_id balance
Update via triggers or worker queue.
⸻
3.5 Row-Level Security Still Works
Postgres handles RLS well at scale if indexed.
⸻
- When One Database Is NOT Enough
You’ll need sharding if:
🚨 Signs • 10k writes/sec sustained • Ledger > 5–10 TB • One tenant has 100M+ entries • Query latency > 500 ms
Then move to:
Horizontal Sharding
Shard by tenant_id.
Example:
db_1 tenants A–F db_2 tenants G–L
Your app router chooses DB.
Still same schema.
⸻
- Real-World Examples
Large SaaS using shared tables: • Shopify • Stripe • Slack
They shard later only when necessary.
⸻
- Cost Comparison
Strategy Cost Ops complexity Shared DB Low Low Multi-schema Medium Medium Multi-DB High High Sharded Very high Very high
Start simple.
⸻
- Recommended Plan for Your PERN App
Phase 1 (0–1M users) • Shared tables • tenant_id • RLS • Indexes
⸻
Phase 2 (1–10M users) • Partition journal_entries • Cache balances • Async reporting
⸻
Phase 3 (10M+ users) • Shard by tenant • Read replicas • Data warehouse for analytics
⸻
- Important Accounting-Specific Scaling Tip
Ledger tables are append-only.
That’s perfect for PostgreSQL: • Minimal locking • Good WAL compression • Easy partition pruning
So accounting systems scale better than social apps.
⸻
- Key Takeaway
👉 5M users is not a problem for one PostgreSQL database 👉 Poor schema and missing partitioning is the real problem.
⸻
If you want, I can next: • Estimate storage for your expected usage • Design partitioning SQL • Draw ER diagram • Write Prisma schema
Just tell me your expected transactions per user 👍