10. Going to production
The shop works. Before it goes live:
Server side rendering
Load lists with useAsyncData (step 2), so the first page comes with its data. The module carries the BSON values of the documents (ObjectId, Decimal128, …) in the payload. The session cookie goes along, so each request renders with its own user. Nothing is shared between requests.
Settings of the server
Set these in mongocamp.server.config or as environment variables (the variables win):
| Setting | Why |
|---|---|
AUTH_SECRET | the secret of the tokens. Without it the server generates one and stores it in the database; set your own to control and rotate it |
CORS_ORIGINS_ALLOWED | the origins of your frontends, if other sites call the API |
PAGING_MAX_ROWS, EXPORT_MAX_DOCUMENTS, GRIDFS_UPLOAD_MAX_BYTES | caps against huge reads and uploads; off by default |
EXPORT_CSV_ESCAPE_FORMULAS | true when users open csv exports in a spreadsheet |
FILTER_OPERATORS_DENIED | $where, $function and $accumulator are refused in client filters by default; keep it that way |
BODY_MAX_BYTES (64 MiB) and WATCH_QUEUE_MAX (1000) are on by default.
The database
- A replica set, for live updates (step 8) and for transactions of imports.
- Back up the audit collection (
mc_audit) if you need the history longer than its retention (365 days by default,audit: { retentionDays }). - Failed logins are limited by default (
RATE_LIMIT_LOGIN=10/15m); behind a proxy setRATE_LIMIT_TRUSTED_PROXIES, or all clients share one address. - Probe
/api/mongocamp-server/health/readyfrom your platform, and schedule backups (mongocamp.BackupJob).
The full list is the production checklist.
What you built
| Step | Lines of code you wrote for it |
|---|---|
| schema, types, validation | the declaration |
| owner, timestamps, soft delete, versions, audit, indexes, relations | one line each |
| business rules | one plugin |
| checkout | one route |
Every rule applies to the API, the composables, live updates and server code alike.
