Make 0009/0010 idempotent and aligned with current models so server migrate after a wipe does not miss schema fields. Co-authored-by: Cursor <cursoragent@cursor.com>
FunZone Accounting Backend
A standalone Django REST service that powers the FunZone accounting app
(funzone-accounting). It is fully decoupled from the main FunZone backend:
- It keeps its own database (SQLite by default) with the chart of accounts, journal vouchers, invoices, products, parties, treasury, payroll and settings.
- It does not have its own user table. Instead it authorizes requests
statelessly by validating the admin JWT issued by the FunZone backend,
using the shared
SECRET_KEY. Only tokens carryingis_staff/is_superuserclaims (i.e. admin logins) are accepted.
Operational data (owners, customers, payments, withdrawals) still comes directly from the FunZone backend; the frontend talks to both services.
Endpoints
Base path: /api/accounting/
| Resource | Path | Methods |
|---|---|---|
| Chart of accounts | accounts/ |
GET, POST, PATCH, PUT, DELETE |
| Parties | parties/ |
GET, POST, PATCH, PUT, DELETE |
| Products | products/ |
GET, POST, PATCH, PUT, DELETE |
| Journal vouchers | vouchers/ |
GET, POST, PATCH, PUT, DELETE |
| Invoices | invoices/ |
GET, POST, PATCH, PUT, DELETE |
| Treasury | treasury/ |
GET, POST, PATCH, PUT, DELETE |
| Employees | employees/ |
GET, POST, PATCH, PUT, DELETE |
| Payslips | payslips/ |
GET, POST, PATCH, PUT, DELETE |
| Company settings | settings/ |
GET, PATCH |
| Reset (wipe + reseed) | reset/ |
POST |
All payloads use camelCase keys to match the frontend types.
Setup
cd funzone-accounting-backend
python -m venv .venv
.venv\Scripts\activate # Windows
pip install -r requirements.txt
copy .env.example .env # then set SECRET_KEY to match FunZone
python manage.py migrate
python manage.py runserver 8010
The first migrate seeds a clean chart of accounts (zeroed balances) and the
default company settings/account mapping. No demo business data is created.
Auth
The frontend logs in via the FunZone admin endpoint
(/api/auth/token/admin/) and reuses the returned access token for this service.
Make sure SECRET_KEY here is identical to the FunZone backend's.
Docker
SQLite (default, zero extra services):
docker compose up -d --build
The API listens on http://localhost:8010 (/health, /api/accounting/...).
Set SECRET_KEY to match the FunZone backend before starting:
SECRET_KEY=your-shared-secret docker compose up -d --build
Optional PostgreSQL instead of SQLite:
docker compose --profile postgres up -d --build
Then set DATABASE_URL=postgresql://accounting_user:accounting_password@accounting-db:5432/accounting_db in your environment or .env file.