MongoDB structure, initialization flow, collection contracts, indexes, and seed data used by the application.
MongoDB 7 (dockerized for local full-stack mode).tucreditoonline.database/init/init-db.js.| Collection | Main required fields | Notes |
|---|---|---|
users | email, createdAt | Uses soft delete field deletedAt and optional updatedAt. |
credittypes | name, baseInterestRate, maxAmount, createdAt | Catalog for available loan products and rules used by calculator and request flow. |
creditrequests | email, requestedAmount, status, createdAt | Status enum in validator: Pending, Approved, Rejected. |
services | (none defined in validator) | Container for service catalog data used by frontend informational pages. |
contactmessages | (none defined in validator) | Stores contact form submissions and moderation status. |
Schema validators are currently configured for core operational collections and can be expanded as domain requirements evolve.
| Collection | Indexes | Reason |
|---|---|---|
users | email (unique), createdAt, deletedAt | Fast authentication lookup, chronological listing, and soft-delete filtering. |
credittypes | isActive, name (unique), createdAt | Public pages and calculators filter active products frequently. |
creditrequests | status, email, createdAt (desc) | Admin dashboard and request tracking are status/date driven. |
contactmessages | status, createdAt (desc) | Operational inbox views prioritize message status and recency. |
Personal Credit, Express Credit, Consolidation Credit, and Business Credit.docker compose up --builddocker compose downdocker compose down -vResetting with -v recreates the volume and reruns initialization scripts from scratch.