el-contador 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +15 -0
- package/README.md +112 -0
- package/admin/app.html +5082 -0
- package/admin/index.html +32 -0
- package/admin/login.html +102 -0
- package/bin/cli.js +46 -0
- package/docker-compose.yml +57 -0
- package/package.json +35 -0
- package/server/.env.example +19 -0
- package/server/Dockerfile +14 -0
- package/server/README.md +46 -0
- package/server/db/init.js +33 -0
- package/server/db/pool.js +12 -0
- package/server/db/schema.sql +249 -0
- package/server/db/wait.js +23 -0
- package/server/index.js +102 -0
- package/server/middleware/auth.js +40 -0
- package/server/package-lock.json +2111 -0
- package/server/package.json +21 -0
- package/server/routes/approval-settings.js +58 -0
- package/server/routes/auth.js +169 -0
- package/server/routes/bank.js +232 -0
- package/server/routes/customers.js +139 -0
- package/server/routes/dashboard.js +119 -0
- package/server/routes/expense-categories.js +131 -0
- package/server/routes/expenses.js +606 -0
- package/server/routes/invoice-config.js +111 -0
- package/server/routes/reconciliation.js +173 -0
- package/server/routes/sales.js +274 -0
- package/server/routes/suppliers.js +235 -0
- package/server/routes/vat-reports.js +228 -0
- package/server/scripts/batch-import-expenses.js +182 -0
- package/server/services/invoice-extraction.js +160 -0
package/.env.example
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Used by docker-compose for Postgres and the backend.
|
|
2
|
+
# Copy to .env and set values: cp .env.example .env
|
|
3
|
+
|
|
4
|
+
DB_USER=el_contador
|
|
5
|
+
DB_PASSWORD=
|
|
6
|
+
DB_NAME=el_contador_finance
|
|
7
|
+
|
|
8
|
+
SESSION_SECRET=changeme-generate-a-long-random-string
|
|
9
|
+
|
|
10
|
+
# Host port for admin (default 3080)
|
|
11
|
+
# ADMIN_PORT=3080
|
|
12
|
+
|
|
13
|
+
# First admin login (default: admin@example.com, password = DB_PASSWORD if INIT_ADMIN_PASSWORD not set)
|
|
14
|
+
# INIT_ADMIN_EMAIL=admin@example.com
|
|
15
|
+
# INIT_ADMIN_PASSWORD= # leave unset to use DB_PASSWORD as admin password
|
package/README.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# El Contador
|
|
2
|
+
|
|
3
|
+
Bookkeeping and expense management – expenses, sales, bank transactions, and reconciliation. Run with Docker.
|
|
4
|
+
|
|
5
|
+
## Install (first time)
|
|
6
|
+
|
|
7
|
+
1. Create a project directory and add the package:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
mkdir my-books && cd my-books
|
|
11
|
+
npm init -y
|
|
12
|
+
npm install el-contador
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
2. Copy the env template and set at least `DB_PASSWORD` and `SESSION_SECRET`:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
cp node_modules/el-contador/.env.example .env
|
|
19
|
+
# Edit .env: set DB_PASSWORD and SESSION_SECRET
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`.env` is never published with the package (it is gitignored and not in the published files). Each installation uses its own `.env`; you can also set the Gemini API key later in the admin under **Invoice settings** (see below).
|
|
23
|
+
|
|
24
|
+
3. Start the app:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx el-contador
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Or without the CLI:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
docker compose -f node_modules/el-contador/docker-compose.yml --env-file .env up -d
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
4. Open the admin UI at `http://localhost:3080` (or the port in `ADMIN_PORT`). Log in with the admin user (see `.env`: `INIT_ADMIN_EMAIL` / `INIT_ADMIN_PASSWORD`, or `DB_PASSWORD` if `INIT_ADMIN_PASSWORD` is not set).
|
|
37
|
+
|
|
38
|
+
## Deploy on another server
|
|
39
|
+
|
|
40
|
+
On a new server (VPS, dedicated, etc.):
|
|
41
|
+
|
|
42
|
+
1. Install Node.js (v18+), npm, and Docker (and Docker Compose).
|
|
43
|
+
2. Create a directory and install the app as above (e.g. `npm init -y`, `npm install el-contador`, copy `.env.example` to `.env`, set `DB_PASSWORD` and `SESSION_SECRET`).
|
|
44
|
+
3. Start with `npx el-contador` (or the `docker compose -f ...` command). The app listens on `ADMIN_PORT` (default 3080) on the host.
|
|
45
|
+
4. To expose it on a **subdomain or domain** (e.g. `admin.example.com`), configure a **reverse proxy** (nginx, Caddy, or Apache) on that server. The package does not install or configure nginx for you; you add the proxy config yourself. See below.
|
|
46
|
+
|
|
47
|
+
## Nginx reverse proxy (subdomain / domain)
|
|
48
|
+
|
|
49
|
+
The app is built to run behind a reverse proxy (`trust proxy` is enabled). To serve it on a subdomain (e.g. `contador.example.com`) with nginx:
|
|
50
|
+
|
|
51
|
+
1. Ensure the app is running and listening on a port (e.g. `3080`) on the same machine.
|
|
52
|
+
2. Create a server block for your subdomain. Example (HTTP only):
|
|
53
|
+
|
|
54
|
+
```nginx
|
|
55
|
+
server {
|
|
56
|
+
listen 80;
|
|
57
|
+
server_name contador.example.com;
|
|
58
|
+
|
|
59
|
+
location / {
|
|
60
|
+
proxy_pass http://127.0.0.1:3080;
|
|
61
|
+
proxy_http_version 1.1;
|
|
62
|
+
proxy_set_header Host $host;
|
|
63
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
64
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
65
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Adjust `server_name` and `3080` if your `ADMIN_PORT` is different.
|
|
71
|
+
|
|
72
|
+
3. Reload nginx: `sudo nginx -t && sudo systemctl reload nginx`.
|
|
73
|
+
4. Point DNS for `contador.example.com` to this server’s IP.
|
|
74
|
+
5. For HTTPS, use Let’s Encrypt (e.g. `certbot --nginx -d contador.example.com`) or add an SSL block; Certbot can add the proxy headers if needed.
|
|
75
|
+
|
|
76
|
+
The setup does **not** configure nginx automatically (no install script or config file that edits nginx). You add the server block and DNS yourself so it works with your host and domain.
|
|
77
|
+
|
|
78
|
+
## Update
|
|
79
|
+
|
|
80
|
+
To get the latest app version:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm update el-contador
|
|
84
|
+
docker compose -f node_modules/el-contador/docker-compose.yml --env-file .env up -d --build
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Or use the CLI:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npx el-contador update
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Your data (database and uploads) lives in Docker volumes and is not overwritten by updates.
|
|
94
|
+
|
|
95
|
+
## Commands (CLI)
|
|
96
|
+
|
|
97
|
+
- `el-contador` or `el-contador start` – start the stack (requires `.env` in current directory).
|
|
98
|
+
- `el-contador down` or `el-contador stop` – stop containers.
|
|
99
|
+
- `el-contador update` – run `npm update el-contador` then rebuild and start.
|
|
100
|
+
|
|
101
|
+
## Publishing to npm (maintainers)
|
|
102
|
+
|
|
103
|
+
1. Create an npm account at [npmjs.com/signup](https://www.npmjs.com/signup) if needed.
|
|
104
|
+
2. Log in from the package root: `npm login` (username, password, email; OTP if 2FA is enabled).
|
|
105
|
+
3. From this directory (the package root): `npm publish --access public`.
|
|
106
|
+
`--access public` is required for unscoped packages.
|
|
107
|
+
4. Update `repository.url` in `package.json` to your real Git URL before publishing.
|
|
108
|
+
5. For later releases: bump `version` in `package.json`, then `npm publish` again.
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
MIT
|