Skip to content

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):

SettingWhy
AUTH_SECRETthe 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_ALLOWEDthe origins of your frontends, if other sites call the API
PAGING_MAX_ROWS, EXPORT_MAX_DOCUMENTS, GRIDFS_UPLOAD_MAX_BYTEScaps against huge reads and uploads; off by default
EXPORT_CSV_ESCAPE_FORMULAStrue 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 set RATE_LIMIT_TRUSTED_PROXIES, or all clients share one address.
  • Probe /api/mongocamp-server/health/ready from your platform, and schedule backups (mongocamp.BackupJob).

The full list is the production checklist.

What you built ​

StepLines of code you wrote for it
schema, types, validationthe declaration
owner, timestamps, soft delete, versions, audit, indexes, relationsone line each
business rulesone plugin
checkoutone route

Every rule applies to the API, the composables, live updates and server code alike.

Released under the MIT License.